diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 65f2441..7595e4c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,18 +1,12 @@ + + - - - - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -159,6 +169,15 @@ @@ -171,7 +190,10 @@ - + + + diff --git a/sciunit2/records.py b/sciunit2/records.py index dbaa0ee..88bb339 100644 --- a/sciunit2/records.py +++ b/sciunit2/records.py @@ -130,8 +130,8 @@ def commit(self, size): k, v = self.__pending # eid, Metadata v.size = size # self.__f[k] = str(v) - script = "insert into revs (data) values (?)" - self.__c.execute(script, [str(v)]) + script = "insert into revs (id,data) values (?,?)" + self.__c.execute(script, [str(k),str(v)]) self.__f.commit() return self.__to_rev(k), v diff --git a/tests/test_rm.py b/tests/test_rm.py index 6df4f45..60d2378 100644 --- a/tests/test_rm.py +++ b/tests/test_rm.py @@ -43,6 +43,25 @@ def test_single(self): assert_is_none(testit.sciunit('exec', 'true')) + for _ in range(3): + testit.sciunit('exec', 'true') + + testit.sciunit('rm', 'e4') + + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', 'e4') + assert_equal(r.exception.code, 1) + + testit.sciunit('exec', 'true') + + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', 'e4') + assert_equal(r.exception.code, 0) + + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', 'e5') + assert_equal(r.exception.code, 1) + def test_range(self): with assert_raises(SystemExit) as r: testit.sciunit('rm', 'e1-') @@ -103,3 +122,25 @@ def test_range(self): assert_is_none(testit.sciunit('rm', 'e1-10')) assert_is_none(testit.sciunit('exec', 'true')) + + for _ in range(4): + testit.sciunit('exec', 'true') + + testit.sciunit('rm', 'e3-5') + + for eid in ['e3', 'e4', 'e5']: + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', eid) + assert_equal(r.exception.code, 1) + + testit.sciunit('exec', 'true') + + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', 'e3') + assert_equal(r.exception.code, 0) + + testit.sciunit('exec', 'true') + + with assert_raises(SystemExit) as r: + testit.sciunit('repeat', 'e4') + assert_equal(r.exception.code, 0)