def test_delete(self): """Test that the delete method works correctly.""" collection = CRUDCollection() collection.create("one", 1) assert collection.read("one") == 1 collection.delete("one") assert collection.read("one") is None
def test_update(self): """Test that the update method works correctly.""" collection = CRUDCollection() collection.create("one", 1) assert collection.read("one") == 1 collection.update("one", 2) assert collection.read("one") == 2
def test_read_empty(self): """Test that reading with a non-existing key returns None.""" collection = CRUDCollection() item = collection.read("one") assert item is None
def test_read_not_empty(self): """Test that reading a previously created item gives a non-empty result.""" collection = CRUDCollection() collection.create("one", 1) item = collection.read("one") assert item == 1