From c22cdbffa50ac634f7fecf080f3c3b5662e67131 Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Thu, 17 Sep 2026 11:07:06 +0900 Subject: Added importance --- tests/test_memory_store.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'tests/test_memory_store.py') 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 -- cgit v1.3