Orchestrata Ultimate › Tests › Reference › memory

Tests reference — tests/memory

tests/memory — 12 test modules, 262 test functions. Source tree: tests/memory at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Modules

Module Tests Covers
test_cold_store.py 12 2
test_cold_store_expanded.py 17 2
test_cold_store_extended.py 31 2
test_compressor.py 10 2
test_compressor_extended.py 50 2
test_embedding.py 14 1
test_hot_store.py 17 2
test_hot_store_delete_session_regression.py 2 2
test_hot_store_extended.py 47 2
test_memory_engine.py 18 2
test_memory_engine_extended.py 26 2
test_token_counter.py 18 1

Module details

tests/memory/test_cold_store.py

source · 12 tests · 199 lines

Tests for memory.cold_store — GraphMemoryStore paths.

Covers: memory.cold_store, core.protocols/ (package)

Kind Name Line Description
function test_id 36
function test_available_when_no_driver 90
function test_available_when_driver 96
function test_store_no_driver_returns_false 109
function test_store_success_returns_true 122
function test_store_unreachable_endpoint_returns_false 128
function test_retrieve_no_driver_returns_none 155
function test_search_by_scope_no_driver_returns_empty 162
function test_delete_no_driver_skips 170
function test_count_no_driver_returns_zero 176
function test_close_no_driver 188
function test_close_with_driver 195

tests/memory/test_cold_store_expanded.py

source · 17 tests · 226 lines

Expanded tests for memory.cold_store with real graph.

Covers: memory.cold_store, core.protocols/ (package)

Kind Name Line Description
function test_id 48
class TestGraphMemoryStoreConnection 52
method TestGraphMemoryStoreConnection.test_connect_and_close 54
method TestGraphMemoryStoreConnection.test_available_false_when_no_driver 66
class TestGraphMemoryStoreCrud 71
method TestGraphMemoryStoreCrud.test_store_and_retrieve 73
method TestGraphMemoryStoreCrud.test_retrieve_missing 101
method TestGraphMemoryStoreCrud.test_delete 106
method TestGraphMemoryStoreCrud.test_delete_missing 120
method TestGraphMemoryStoreCrud.test_count 125
method TestGraphMemoryStoreCrud.test_count_all 144
class TestGraphMemoryStoreSearch 156
method TestGraphMemoryStoreSearch.test_search_by_session 158
method TestGraphMemoryStoreSearch.test_search_by_agent 172
method TestGraphMemoryStoreSearch.test_search_no_match 185
class TestGraphMemoryStoreNoDriver 191
method TestGraphMemoryStoreNoDriver.test_store_no_driver 193
method TestGraphMemoryStoreNoDriver.test_retrieve_no_driver 204
method TestGraphMemoryStoreNoDriver.test_search_no_driver 210
method TestGraphMemoryStoreNoDriver.test_delete_no_driver 217
method TestGraphMemoryStoreNoDriver.test_count_no_driver 223

tests/memory/test_cold_store_extended.py

source · 31 tests · 673 lines

Extended tests for memory.cold_store — GraphMemoryStore uncovered paths.

Covers: memory.cold_store, core.protocols/ (package)

Kind Name Line Description
function test_id 41
class TestGraphMemoryStoreConnectionErrors 85
method TestGraphMemoryStoreConnectionErrors.test_connect_with_invalid_uri 87
class TestGraphMemoryStoreCrudExtended 99
method TestGraphMemoryStoreCrudExtended.test_store_overwrites_existing 101
method TestGraphMemoryStoreCrudExtended.test_store_merges_on_canonical_session_scoped_id 133 Memory's canonical merge key is id = <session_id>::<key>
method TestGraphMemoryStoreCrudExtended.test_store_batch_and_retrieve 180
method TestGraphMemoryStoreCrudExtended.test_store_with_none_summary_and_task 196
method TestGraphMemoryStoreCrudExtended.test_retrieve_nonexistent_key 212
method TestGraphMemoryStoreCrudExtended.test_count_with_session_id 217
class TestGraphMemoryStoreConnectivity 242 scripts/check_kg_connectivity.py found cold_store.py's :Session and
method TestGraphMemoryStoreConnectivity.test_store_links_session_and_agent_to_project 248
class TestGraphMemoryStoreSearchExtended 281
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_with_date_from 283
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_with_date_to 300
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_with_date_range 317
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_with_all_filters 335
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_with_task_id_only 356
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_no_conditions 371
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_limit 385
method TestGraphMemoryStoreSearchExtended.test_search_by_scope_no_match 399
class TestGraphMemoryStoreErrorPaths 410
method TestGraphMemoryStoreErrorPaths.test_store_error_with_bad_database 412
method TestGraphMemoryStoreErrorPaths.test_retrieve_error_with_bad_database 435
method TestGraphMemoryStoreErrorPaths.test_search_error_with_bad_database 452
method TestGraphMemoryStoreErrorPaths.test_delete_error_with_bad_database 470
method TestGraphMemoryStoreErrorPaths.test_count_error_with_bad_database 487
method TestGraphMemoryStoreErrorPaths.test_count_with_session_id_error_bad_database 504
class TestNodeToEntry 526
method TestNodeToEntry.test_node_to_entry_with_string_tags 527
method TestNodeToEntry.test_node_to_entry_with_string_metadata 542
method TestNodeToEntry.test_node_to_entry_with_missing_datetimes 557
method TestNodeToEntry.test_node_to_entry_with_string_datetimes 573
method TestNodeToEntry.test_node_to_entry_with_neo4j_datetime 591
method TestNodeToEntry.test_node_to_entry_with_string_classification 615
method TestNodeToEntry.test_node_to_entry_with_dict_node 630
method TestNodeToEntry.test_node_to_entry_with_missing_fields_defaults 660

tests/memory/test_compressor.py

source · 10 tests · 109 lines

Tests for memory/compressor.py.

Covers: memory.compressor, core.protocols/ (package)

Kind Name Line Description
class TestContextCompressor 28
method TestContextCompressor.test_summarize_empty 39
method TestContextCompressor.test_summarize_single_within_budget 46
method TestContextCompressor.test_summarize_truncates_when_over_budget 54
method TestContextCompressor.test_summarize_multiple_selects_best 61
method TestContextCompressor.test_rank_entries_recency 71
method TestContextCompressor.test_rank_entries_importance 80
method TestContextCompressor.test_format_entry_with_tags 89
method TestContextCompressor.test_format_entry_no_tags 95
method TestContextCompressor.test_extract_key_sentences_no_truncation 100
method TestContextCompressor.test_extract_key_sentences_selects_important 105

tests/memory/test_compressor_extended.py

source · 50 tests · 513 lines

Extended tests for memory.compressor — ContextCompressor uncovered paths.

Covers: memory.compressor, core.protocols/ (package)

Kind Name Line Description
function test_id 38
class TestEmptyAndBoundaryHandling 70
method TestEmptyAndBoundaryHandling.test_summarize_empty_entries_returns_empty_summary 71
method TestEmptyAndBoundaryHandling.test_summarize_empty_entries_with_different_strategies 78
method TestEmptyAndBoundaryHandling.test_summarize_zero_max_tokens 86
method TestEmptyAndBoundaryHandling.test_summarize_negative_max_tokens 94
method TestEmptyAndBoundaryHandling.test_summarize_empty_string_content 102
class TestTruncationEdgeCases 116
method TestTruncationEdgeCases.test_breaks_without_truncation_when_remaining_too_small 117 Cover branch 67->72: when remaining <= 20, break without adding.
method TestTruncationEdgeCases.test_truncates_when_remaining_above_threshold 131 When remaining > 20, truncation is attempted.
method TestTruncationEdgeCases.test_exactly_21_remaining_gets_truncated 141 Boundary: remaining == 21 should trigger truncation.
method TestTruncationEdgeCases.test_exactly_20_remaining_does_not_truncate 152 Boundary: remaining == 20 should break without adding.
method TestTruncationEdgeCases.test_single_entry_exceeds_budget_and_truncate 163 Single entry larger than max_tokens gets truncated if remaining > 20.
method TestTruncationEdgeCases.test_single_entry_exceeds_budget_but_remaining_too_small 172 Single entry larger than max_tokens where max_tokens <= 20.
class TestRankingStrategies 187
method TestRankingStrategies.test_rank_entries_relevance_default 188 Default RELEVANCE strategy with mixed scores.
method TestRankingStrategies.test_rank_entries_relevance_with_none_score 198 RELEVANCE strategy handles None relevance_score.
method TestRankingStrategies.test_rank_entries_relevance_tie_breaker_by_timestamp 207 When relevance is equal, newer entry wins.
method TestRankingStrategies.test_rank_entries_recency_order 216 RECENCY strategy sorts by created_at descending.
method TestRankingStrategies.test_rank_entries_importance_with_missing_key 227 IMPORTANCE strategy handles missing importance key.
method TestRankingStrategies.test_rank_entries_importance_all_same 236 IMPORTANCE strategy with equal values preserves stable-ish order.
method TestRankingStrategies.test_summarize_with_recency_strategy 243
method TestRankingStrategies.test_summarize_with_importance_strategy 253
class TestFormatEntry 267
method TestFormatEntry.test_format_entry_empty_tags 268
method TestFormatEntry.test_format_entry_single_tag 272
method TestFormatEntry.test_format_entry_multiple_tags 276
method TestFormatEntry.test_format_entry_empty_content 280
method TestFormatEntry.test_format_entry_no_tags_empty_content 284
class TestExtractKeySentences 294
method TestExtractKeySentences.test_fewer_sentences_than_max_returns_unchanged 295
method TestExtractKeySentences.test_exactly_max_sentences_returns_unchanged 299
method TestExtractKeySentences.test_single_sentence 303
method TestExtractKeySentences.test_selects_highest_scored_sentences 307
method TestExtractKeySentences.test_important_words_boost_score 314
method TestExtractKeySentences.test_multiple_important_words 325
method TestExtractKeySentences.test_empty_text 336
method TestExtractKeySentences.test_whitespace_only 339
method TestExtractKeySentences.test_no_important_words_long_text 342
method TestExtractKeySentences.test_max_sentences_one 349
class TestLargeData 361
method TestLargeData.test_many_entries 362
method TestLargeData.test_large_single_entry 370
method TestLargeData.test_many_entries_high_relevance 378
class TestRoundTripBehaviour 394
method TestRoundTripBehaviour.test_source_keys_match_selected_entries 395
method TestRoundTripBehaviour.test_content_contains_formatted_entries 406
method TestRoundTripBehaviour.test_token_count_is_accurate 415
method TestRoundTripBehaviour.test_summary_created_at_is_present 421
class TestCustomTokenCounter 432
method TestCustomTokenCounter.test_custom_counter_injected 433 Verify that a custom token counter is used.
method TestCustomTokenCounter.test_custom_counter_affects_truncation 451
method TestCustomTokenCounter.test_none_counter_uses_default 467 Default constructor uses WordTokenCounter.
class TestEdgeCases 480
method TestEdgeCases.test_entry_with_none_relevance 481 Entry with None relevance should not crash.
method TestEdgeCases.test_entry_with_special_characters 488
method TestEdgeCases.test_entry_with_newlines 494
method TestEdgeCases.test_duplicate_keys 500
method TestEdgeCases.test_very_long_tags 509

tests/memory/test_embedding.py

source · 14 tests · 111 lines

Tests for memory/embedding.py.

Covers: memory.embedding

Kind Name Line Description
class TestEmbeddingService 27
method TestEmbeddingService.test_tokenize_simple 28
method TestEmbeddingService.test_tokenize_empty 32
method TestEmbeddingService.test_tokenize_numbers 36
method TestEmbeddingService.test_compute_embedding_empty 40
method TestEmbeddingService.test_compute_embedding_no_tokens 45
method TestEmbeddingService.test_compute_embedding_has_values 50
method TestEmbeddingService.test_compute_embedding_normalized 56
method TestEmbeddingService.test_cosine_similarity_identical 62
method TestEmbeddingService.test_cosine_similarity_orthogonal 67
method TestEmbeddingService.test_cosine_similarity_different_lengths 73
method TestEmbeddingService.test_cosine_similarity_zero_vector 77
method TestEmbeddingService.test_search_filters_by_threshold 81
method TestEmbeddingService.test_search_respects_limit 95
method TestEmbeddingService.test_search_sorted_descending 102

tests/memory/test_hot_store.py

source · 17 tests · 286 lines

Tests for memory.hot_store — RedisMemoryStore paths.

Covers: memory.hot_store, core.protocols/ (package)

Kind Name Line Description
function test_id 36
function test_entry_key_format 78
function test_index_key_format 83
function test_tag_key_format 88
function test_embed_key_format 93
function test_retrieve_missing_returns_none 104
function test_retrieve_found 110
function test_retrieve_by_scope_with_results 124
function test_retrieve_by_tag 148
function test_get_embeddings 171
function test_delete_found 195
function test_delete_not_found 206
function test_get_all_keys 217
function test_get_all_entries 234
function test_delete_session 252
function test_close_with_client 276
function test_close_without_client 282

tests/memory/test_hot_store_delete_session_regression.py

source · 2 tests · 79 lines

Regression test for RedisMemoryStore.delete_session (code review 2026-06-18).

Covers: memory.hot_store, core.protocols/ (package)

Kind Name Line Description
function test_id 27
function test_delete_session_keeps_other_sessions_embeddings 62

tests/memory/test_hot_store_extended.py

source · 47 tests · 585 lines

Extended tests for memory.hot_store — RedisMemoryStore uncovered paths.

Covers: memory.hot_store, core.protocols/ (package)

Kind Name Line Description
function test_id 41
class TestConnection 90
method TestConnection.test_connect_creates_client 92
method TestConnection.test_default_ttl 100
method TestConnection.test_custom_ttl 104
method TestConnection.test_custom_host_port 108
class TestStoreEdgeCases 124
method TestStoreEdgeCases.test_store_minimal_fields 126
method TestStoreEdgeCases.test_store_with_embedding 141
method TestStoreEdgeCases.test_store_sets_ttl 149
method TestStoreEdgeCases.test_store_special_characters 170
method TestStoreEdgeCases.test_store_multiple_tags 182
class TestRetrieveByKeyGlobal 196
method TestRetrieveByKeyGlobal.test_retrieve_by_key_global_missing 198
method TestRetrieveByKeyGlobal.test_retrieve_by_key_global_found 203
class TestRetrieveByScope 217
method TestRetrieveByScope.test_retrieve_by_scope_no_results 219
method TestRetrieveByScope.test_retrieve_by_scope_limit 225
method TestRetrieveByScope.test_retrieve_by_scope_wildcard_session 234
method TestRetrieveByScope.test_retrieve_by_scope_wildcard_volk 242
method TestRetrieveByScope.test_retrieve_by_scope_task_id_filter 250
method TestRetrieveByScope.test_retrieve_by_scope_date_from_filter 261
method TestRetrieveByScope.test_retrieve_by_scope_date_to_filter 281
method TestRetrieveByScope.test_retrieve_by_scope_volk_with_colons 301
class TestMatchesScope 316
method TestMatchesScope.test_session_mismatch 317
method TestMatchesScope.test_volk_mismatch 322
method TestMatchesScope.test_task_mismatch 327
method TestMatchesScope.test_date_from_exclude 334
method TestMatchesScope.test_date_to_exclude 346
method TestMatchesScope.test_all_match 358
method TestMatchesScope.test_no_filters 377
class TestRetrieveByTag 388
method TestRetrieveByTag.test_retrieve_by_tag_empty 390
method TestRetrieveByTag.test_retrieve_by_tag_multiple_entries 395
class TestGetEmbeddings 411
method TestGetEmbeddings.test_get_embeddings_empty 413
method TestGetEmbeddings.test_get_embeddings_multiple 418
class TestDelete 434
method TestDelete.test_delete_removes_index_and_embedding 436
method TestDelete.test_delete_entry_without_tags 455
class TestGetAll 469
method TestGetAll.test_get_all_keys_ordering 471
method TestGetAll.test_get_all_entries_multiple_volks 485
class TestDeleteSession 501
method TestDeleteSession.test_delete_session_clears_entries 503
method TestDeleteSession.test_delete_session_clears_embeddings 512
class TestNotConnected 525
method TestNotConnected.test_store_not_connected 527
method TestNotConnected.test_retrieve_not_connected 534
method TestNotConnected.test_retrieve_by_key_global_not_connected 540
method TestNotConnected.test_retrieve_by_scope_not_connected 546
method TestNotConnected.test_retrieve_by_tag_not_connected 552
method TestNotConnected.test_get_embeddings_not_connected 558
method TestNotConnected.test_delete_not_connected 564
method TestNotConnected.test_get_all_keys_not_connected 570
method TestNotConnected.test_get_all_entries_not_connected 576
method TestNotConnected.test_delete_session_not_connected 582

tests/memory/test_memory_engine.py

source · 18 tests · 323 lines

Tests for memory.memory_engine — MemoryEngine paths.

Covers: memory.memory_engine, core.protocols/ (package)

Kind Name Line Description
function test_id 38
function test_metadata 105
function test_store_delegates_to_hot 116
function test_retrieve_by_key_global 127
function test_retrieve_missing 135
function test_delete 141
function test_search_with_results 157
function test_search_max_entries_pre_filter 166
function test_search_max_age_seconds_pre_filter 179
function test_summarize_empty_returns_defaults 199
function test_update_validates_content_length 212
function test_health_checks 223
function test_health_stopped 230
function test_migrate_to_cold 242
function test_initialize 271
function test_initialize_is_idempotent 293
function test_start 313
function test_stop 320

tests/memory/test_memory_engine_extended.py

source · 26 tests · 486 lines

Extended tests for memory.memory_engine — MemoryEngine uncovered paths.

Covers: memory.memory_engine, core.protocols/ (package)

Kind Name Line Description
function test_id 44
class TestStoreValidation 106
method TestStoreValidation.test_store_content_too_long 108
method TestStoreValidation.test_store_too_many_tags 117
method TestStoreValidation.test_store_uses_custom_key 127
method TestStoreValidation.test_store_with_classification 140
method TestStoreValidation.test_store_with_tags_and_metadata 150
class TestSearch 167
method TestSearch.test_search_missing_embedding_fallback 169 Entries without embedding get embedded on-the-fly during search.
method TestSearch.test_search_no_results 184
method TestSearch.test_search_respects_limit 193
method TestSearch.test_search_min_similarity_filter 205
method TestSearch.test_search_applies_decay 224
class TestUpdate 249
method TestUpdate.test_update_content 251
method TestUpdate.test_update_tags 265
method TestUpdate.test_update_metadata 277
method TestUpdate.test_update_classification 289
method TestUpdate.test_update_all_fields 303
method TestUpdate.test_update_missing_raises_keyerror 327
method TestUpdate.test_update_content_too_long 332
method TestUpdate.test_update_tags_too_many 342
class TestDelete 359
method TestDelete.test_delete_cold_only 361
class TestSummarize 385
method TestSummarize.test_summarize_with_entries 387
method TestSummarize.test_summarize_falls_back_to_cold 405
class TestMigrate 423
method TestMigrate.test_migrate_to_cold_logs_errors_on_failure 425
class TestDecay 454
method TestDecay.test_apply_decay_with_none_score 455
method TestDecay.test_apply_decay_reduces_score 460
method TestDecay.test_apply_decay_system_classification 474

tests/memory/test_token_counter.py

source · 18 tests · 103 lines

Tests for memory/token_counter.py.

Covers: memory.token_counter

Kind Name Line Description
class TestWordTokenCounter 10
method TestWordTokenCounter.test_count_empty 11
method TestWordTokenCounter.test_count_single_word 15
method TestWordTokenCounter.test_count_multiple_words 19
method TestWordTokenCounter.test_truncate_zero_returns_empty 23
method TestWordTokenCounter.test_truncate_within_limit 27
method TestWordTokenCounter.test_truncate_reduces_words 32
class TestTiktokenCounter 39
method TestTiktokenCounter.test_count_empty 40
method TestTiktokenCounter.test_count_with_text 44
method TestTiktokenCounter.test_truncate_zero_returns_empty 50
method TestTiktokenCounter.test_truncate_within_limit 54
method TestTiktokenCounter.test_truncate_reduces 59
class TestTiktokenCounterFallback 66 TiktokenCounter falls back to word-based counting when tiktoken can't
method TestTiktokenCounterFallback.test_unknown_model_falls_back_to_none_encoding 72
method TestTiktokenCounterFallback.test_count_uses_word_fallback_for_unknown_model 76
method TestTiktokenCounterFallback.test_truncate_uses_word_fallback_for_unknown_model 81
class TestGetTokenCounter 88
method TestGetTokenCounter.test_openai_returns_tiktoken 89
method TestGetTokenCounter.test_deepseek_returns_tiktoken 93
method TestGetTokenCounter.test_none_returns_word 97
method TestGetTokenCounter.test_unknown_returns_word 101