Skip to content

Commit ae7a2d3

Browse files
author
Dylan Huang
committed
Add test for deleting a nonexistent row in TinyDBEvaluationRowStore
- Introduced `test_delete_row_nonexistent` to verify that attempting to delete a non-existent row returns a count of 0 and confirms the store remains empty.
1 parent 11221fb commit ae7a2d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_storage_backends.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ def test_delete_row(self, temp_dir: str):
118118
rows = store.read_rows()
119119
assert len(rows) == 0
120120

121+
def test_delete_row_nonexistent(self, temp_dir: str):
122+
"""Test deleting a row that doesn't exist returns 0."""
123+
db_path = os.path.join(temp_dir, "test.json")
124+
store = TinyDBEvaluationRowStore(db_path)
125+
126+
# Try to delete a row that doesn't exist
127+
deleted = store.delete_row("nonexistent-rollout")
128+
assert deleted == 0
129+
130+
# Verify store is still empty
131+
rows = store.read_rows()
132+
assert len(rows) == 0
133+
121134
def test_delete_all_rows(self, temp_dir: str):
122135
"""Test deleting all rows."""
123136
db_path = os.path.join(temp_dir, "test.json")

0 commit comments

Comments
 (0)