import pytest from crud_operations import CRUDOperations @pytest.fixture def crud_operations(): return CRUDOperations("sample.db") def test_create(crud_operations): crud_operations.create("users", ["id", "name", "age"], [1, "Alice", 25]) assert crud_operations.read("users", ["id", "name", "age"]) == [(1, "Alice", 25)] def test_read(crud_operations): crud_operations.create("users", ["id", "name", "age"], [1, "Alice", 25]) assert crud_operations.read("users", ["id", "name", "age"]) == [(1, "Alice", 25)] def test_update(crud_operations): crud_operations.create("users", ["id", "name", "age"], [1, "Alice", 25]) crud_operations.update("users", {"name": "Bob"}, "id = 1") assert crud_operations.read("users", ["id", "name", "age"]) == [(1, "Bob", 25)] def test_delete(crud_operations): crud_operations.create("users", ["id", "name", "age"], [1, "Alice", 25]) crud_operations.delete("users", "id = 1") assert crud_operations.read("users", ["id", "name", "age"]) == []