Skip to content

Commit b4e0ba9

Browse files
committed
test: update insert_empty_rows tests to raise ValueError for empty input
1 parent deef90a commit b4e0ba9

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

tests/adapters/test_mysql.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ def test_fetch_specific_columns(mysql_adapter: MySQLAdapter):
4242
assert all(len(row) == 1 for row in result)
4343

4444

45-
def test_insert_empty_rows(mysql_adapter: MySQLAdapter):
46-
mysql_adapter.insert("users", [])
47-
result = mysql_adapter.fetch("users", ["id"])
48-
assert len(result) == 0
45+
def test_insert_empty_rows_raises(mysql_adapter: MySQLAdapter):
46+
with pytest.raises(ValueError):
47+
mysql_adapter.insert("users", [])
4948

5049

5150
def test_insert_batch(mysql_adapter: MySQLAdapter):

tests/adapters/test_postgres.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ def test_fetch_specific_columns(pg_adapter: PostgresAdapter):
3838
assert all(len(row) == 1 for row in result)
3939

4040

41-
def test_insert_empty_rows(pg_adapter: PostgresAdapter):
42-
pg_adapter.insert("users", [])
43-
result = pg_adapter.fetch("users", ["id"])
44-
assert len(result) == 0
45-
41+
def test_insert_empty_rows_raises(pg_adapter: PostgresAdapter):
42+
with pytest.raises(ValueError):
43+
pg_adapter.insert("users", [])
4644

4745
def test_insert_batch(pg_adapter: PostgresAdapter):
4846
rows = [{"id": i, "email": f"user{i}@test.com", "username": f"user{i}"} for i in range(1, 502)]

0 commit comments

Comments
 (0)