File size: 569 Bytes
659e47b 2eb5c6a e683f99 2eb5c6a 659e47b 2eb5c6a 659e47b 2eb5c6a 659e47b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# agents/tests/test_storage.py
import os
import pytest
from agents.tools.storage import Storage
@pytest.fixture
def temp_storage(tmp_path):
db_path = tmp_path / "test.db"
storage = Storage(config={"db_path": str(db_path)})
yield storage
# автоматически удалится tmp_path
def test_set_and_get(temp_storage):
temp_storage.set("foo", "bar")
assert temp_storage.get("foo") == "bar"
def test_delete(temp_storage):
temp_storage.set("key", "value")
temp_storage.delete("key")
assert temp_storage.get("key") is None
|