diff options
Diffstat (limited to 'tests/test_memory_store.py')
| -rw-r--r-- | tests/test_memory_store.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_memory_store.py b/tests/test_memory_store.py index b83d217..f24f975 100644 --- a/tests/test_memory_store.py +++ b/tests/test_memory_store.py @@ -122,6 +122,7 @@ def test_created_at_round_trips_as_utc(tmp_path): content="UTC timestamp test.", category=MemoryCategory.SEMANTIC, created_at=created_at, + importance=2, ) store.add(memory) @@ -270,3 +271,59 @@ def test_search_filters_by_category(tmp_path): ) assert [result.id for result in results] == [episodic.id] + + +def test_importance_round_trips_through_get(tmp_path): + store = create_store(tmp_path) + + memory = LongTermMemory.create( + "High importance memory.", + MemoryCategory.SEMANTIC, + 3, + ) + + store.add(memory) + + result = store.get(memory.id) + + assert result is not None + assert result.importance == 3 + + +def test_importance_round_trips_through_list(tmp_path): + store = create_store(tmp_path) + + first = LongTermMemory.create( + "Minor memory.", + MemoryCategory.SEMANTIC, + 1, + ) + second = LongTermMemory.create( + "Important memory.", + MemoryCategory.SEMANTIC, + 3, + ) + + store.add(first) + store.add(second) + + result = store.list() + + assert [memory.importance for memory in result] == [1, 3] + + +def test_importance_round_trips_through_search(tmp_path): + store = create_store(tmp_path) + + memory = LongTermMemory.create( + "Important Rust preference.", + MemoryCategory.SEMANTIC, + 3, + ) + + store.add(memory) + + result = store.search("Rust") + + assert len(result) == 1 + assert result[0].importance == 3 |
