Commit 67f2b0d
authored
Refactor/configuration normalize orderedset (#599)
* test: add API contract tests for Configuration across all topologies
Systematic test matrix covering the observable behavior of all public
Configuration APIs (current_state_value, configuration_values,
configuration, current_state, model.state) across flat, compound,
parallel, and complex parallel StateCharts.
Verifies type contracts (scalar vs OrderedSet), value correctness,
model identity, and the uninitialized async lifecycle. Uses
pytest.parametrize over 14 topology x lifecycle scenarios x sync/async
engines, plus setter and uninitialized edge cases (39 tests total).
* refactor: normalize Configuration internals to always use OrderedSet
Introduce two boundary functions (_read_from_model / _write_to_model)
that confine the None|scalar|OrderedSet trichotomy to the model edge.
All other methods (add, discard, states setter, values) now operate on
a uniform OrderedSet, eliminating per-method type branching.
The model still receives the same denormalized values as before
(None for empty, scalar for single state, OrderedSet for multiple).
Fixes edge case: configuration_values now returns OrderedSet() for
uninitialized config instead of OrderedSet([None]), since None is not
a valid state value.
Prepares the codebase for the persistence protocol work (#597).1 parent 8d17ba9 commit 67f2b0d
File tree
4 files changed
+365
-47
lines changed- docs
- statemachine
- tests
4 files changed
+365
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 68 | + | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
88 | 84 | | |
89 | | - | |
| 85 | + | |
90 | 86 | | |
91 | 87 | | |
92 | 88 | | |
93 | 89 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 90 | + | |
100 | 91 | | |
101 | 92 | | |
102 | 93 | | |
103 | 94 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
113 | 99 | | |
114 | 100 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
127 | 105 | | |
128 | 106 | | |
129 | 107 | | |
| |||
153 | 131 | | |
154 | 132 | | |
155 | 133 | | |
156 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
0 commit comments