@@ 120-136 (lines=17) @@ | ||
117 | assert final_cfg['b'] == 116 |
|
118 | ||
119 | ||
120 | def test_chained_config_scopes_fix_subentries(): |
|
121 | @ConfigScope |
|
122 | def cfg1(): |
|
123 | d = { |
|
124 | 'a': 10, |
|
125 | 'b': 20 |
|
126 | } |
|
127 | ||
128 | @ConfigScope |
|
129 | def cfg2(): |
|
130 | pass |
|
131 | ||
132 | final_cfg, summary = chain_evaluate_config_scopes([cfg1, cfg2], |
|
133 | fixed={'d': {'a': 0}}) |
|
134 | assert set(final_cfg['d'].keys()) == {'a', 'b'} |
|
135 | assert final_cfg['d']['a'] == 0 |
|
136 | assert final_cfg['d']['b'] == 20 |
|
137 | ||
138 | ||
139 | def test_empty_chain_contains_preset_and_fixed(): |
@@ 228-238 (lines=11) @@ | ||
225 | conf_scope() # would require SEVEN |
|
226 | ||
227 | ||
228 | def test_fixed_subentry_of_preset(): |
|
229 | @ConfigScope |
|
230 | def conf_scope(): |
|
231 | pass |
|
232 | ||
233 | cfg = conf_scope(preset={'d': {'a': 1, 'b': 2}}, fixed={'d': {'a': 10}}) |
|
234 | ||
235 | assert set(cfg.keys()) == {'d'} |
|
236 | assert set(cfg['d'].keys()) == {'a', 'b'} |
|
237 | assert cfg['d']['a'] == 10 |
|
238 | assert cfg['d']['b'] == 2 |
|
239 | ||
240 | ||
241 | @pytest.mark.parametrize("line,indent,expected", [ |