MCPcopy Create free account
hub / github.com/MemTensor/MemOS / test_memory_interface_methods_called

Function test_memory_interface_methods_called

tests/mem_cube/test_general.py:67–94  ·  view source on GitHub ↗

Test that the correct memory interface methods are called.

(mem_cube)

Source from the content-addressed store, hash-verified

65
66
67def test_memory_interface_methods_called(mem_cube):
68 """Test that the correct memory interface methods are called."""
69 with (
70 patch("memos.mem_cube.general.get_json_file_model_schema") as mock_get_schema,
71 tempfile.TemporaryDirectory() as test_dir,
72 ):
73 mock_get_schema.return_value = mem_cube.config.model_schema
74
75 # Test load
76 mem_cube.load(test_dir)
77
78 # Verify all memory types are loaded
79 mem_cube.text_mem.load.assert_called_once_with(test_dir)
80 mem_cube.act_mem.load.assert_called_once_with(test_dir)
81 mem_cube.para_mem.load.assert_called_once_with(test_dir)
82
83 # Reset mocks
84 mem_cube.text_mem.reset_mock()
85 mem_cube.act_mem.reset_mock()
86 mem_cube.para_mem.reset_mock()
87
88 # Test dump
89 mem_cube.dump(test_dir)
90
91 # Verify all memory types are dumped
92 mem_cube.text_mem.dump.assert_called_once_with(test_dir)
93 mem_cube.act_mem.dump.assert_called_once_with(test_dir)
94 mem_cube.para_mem.dump.assert_called_once_with(test_dir)

Callers

nothing calls this directly

Calls 3

patchFunction · 0.85
loadMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected