Pickle a fresh GoalState to disk, reload it, and check that the round-tripped state still has the same shape (one open goal, not solved). The test takes some care to not exercise the GoalState lifecycle issue: it uses cheap field-projecting queries on each state, never the heavy Meta
(kernel)
| 114 | |
| 115 | |
| 116 | def test_goal_pickle_round_trip(kernel): |
| 117 | """Pickle a fresh GoalState to disk, reload it, and check that the |
| 118 | round-tripped state still has the same shape (one open goal, not |
| 119 | solved). The test takes some care to not exercise the GoalState |
| 120 | lifecycle issue: it uses cheap field-projecting queries on each |
| 121 | state, never the heavy MetaM ops.""" |
| 122 | state = kernel.goal_create("∀ n : Nat, n + 0 = n") |
| 123 | pre_n_goals = state.n_goals() |
| 124 | pre_solved = state.is_solved() |
| 125 | with tempfile.TemporaryDirectory() as d: |
| 126 | path = os.path.join(d, "goal.olean") |
| 127 | state.pickle(path) |
| 128 | assert os.path.getsize(path) > 0 |
| 129 | # Round-trip |
| 130 | loaded = kernel.goal_unpickle(path) |
| 131 | assert loaded.n_goals() == pre_n_goals |
| 132 | assert loaded.is_solved() == pre_solved |
| 133 | |
| 134 | |
| 135 | # ---------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected