fix: test: delete_rec

This commit is contained in:
rachmadaniHaryono 2020-08-06 14:52:31 +08:00
parent 9e85b59a35
commit 9ecf8857d7

View File

@ -936,16 +936,14 @@ def test_delete_rec_on_non_interger(index, low, high, is_range):
for bookmark in TEST_BOOKMARKS: for bookmark in TEST_BOOKMARKS:
bdb.add_rec(*bookmark) bdb.add_rec(*bookmark)
db_len = len(TEST_BOOKMARKS)
if is_range and not (isinstance(low, int) and isinstance(high, int)): if is_range and not (isinstance(low, int) and isinstance(high, int)):
with pytest.raises(TypeError): with pytest.raises(TypeError):
bdb.delete_rec(index=index, low=low, high=high, is_range=is_range) bdb.delete_rec(index=index, low=low, high=high, is_range=is_range)
return return
if not is_range and not isinstance(index, int): if not is_range and not isinstance(index, int):
res = bdb.delete_rec(index=index, low=low, high=high, is_range=is_range) with pytest.raises(TypeError):
assert not res bdb.delete_rec(index=index, low=low, high=high, is_range=is_range)
assert len(bdb.get_rec_all()) == db_len
else: else:
assert bdb.delete_rec(index=index, low=low, high=high, is_range=is_range) assert bdb.delete_rec(index=index, low=low, high=high, is_range=is_range)