MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / test_save_load_roundtrip

Function test_save_load_roundtrip

tests/test_persistence.py:5–21  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

3
4
5def test_save_load_roundtrip(tmp_path):
6 state = LearnedState(
7 signal_weights=[0.55, 0.45],
8 calibration_temperature=0.75,
9 shadow_consecutive_wins=1,
10 shadow_promoted=False,
11 embedding_index_size=487,
12 model_priors={"deepseek": {"alpha": 5, "beta": 2}},
13 )
14 save_state(state, tmp_path)
15 loaded = load_state(tmp_path)
16 assert loaded.signal_weights == [0.55, 0.45]
17 assert loaded.calibration_temperature == 0.75
18 assert loaded.shadow_consecutive_wins == 1
19 assert not loaded.shadow_promoted
20 assert loaded.embedding_index_size == 487
21 assert loaded.model_priors["deepseek"]["alpha"] == 5
22
23
24def test_load_missing_dir_returns_defaults(tmp_path):

Callers

nothing calls this directly

Calls 3

LearnedStateClass · 0.90
save_stateFunction · 0.90
load_stateFunction · 0.90

Tested by

no test coverage detected