|
3 | 3 |
|
4 | 4 | """Behavioral tests for `ComponentGraphConfig` formula preferences. |
5 | 5 |
|
6 | | -These tests build a small, controllable graph (Grid -> Meter -> Device) |
| 6 | +These tests build a small, controllable graph (Grid -> Meter -> Component) |
7 | 7 | for each per-category formula method and assert the actual formula |
8 | | -output for the four meter/device-preference combinations: |
| 8 | +output for the four meter/component-preference combinations: |
9 | 9 |
|
10 | | - * default config -> device primary |
| 10 | + * default config -> component primary |
11 | 11 | * global True -> meter primary |
12 | 12 | * per-formula override = True -> meter primary (override wins) |
13 | | - * per-formula override = False -> device primary (override wins) |
| 13 | + * per-formula override = False -> component primary (override wins) |
14 | 14 |
|
15 | 15 | The drift test in `test_stub_drift.py` only checks signatures; this |
16 | 16 | file catches actual mis-wiring -- a swapped override, an inverted |
|
46 | 46 | _MGRID = MicrogridId(1) |
47 | 47 |
|
48 | 48 | # In every per-category topology built below, component #2 is the meter |
49 | | -# and #3 is the device that appears in the formula. |
| 49 | +# and #3 is the component that appears in the formula. |
50 | 50 | _METER_PRIMARY = "COALESCE(#2, #3, 0.0)" |
51 | | -_DEVICE_PRIMARY = "COALESCE(#3, #2, 0.0)" |
| 51 | +_COMPONENT_PRIMARY = "COALESCE(#3, #2, 0.0)" |
52 | 52 |
|
53 | 53 | # Each per-category graph builder takes an optional `config` and returns a |
54 | 54 | # graph rooted at the same Grid -> Meter pair, so the assertion strings |
@@ -104,7 +104,7 @@ def _battery_graph( |
104 | 104 | config: ComponentGraphConfig | None = None, |
105 | 105 | ) -> ComponentGraph[Any, Any, Any]: |
106 | 106 | # Grid -> Meter -> BatteryInverter -> Battery; the formula references |
107 | | - # the inverter (#3) as the device, the battery (#4) doesn't appear. |
| 107 | + # the inverter (#3) as the component, the battery (#4) doesn't appear. |
108 | 108 | return ComponentGraph( |
109 | 109 | components={ |
110 | 110 | _grid(), |
@@ -190,14 +190,14 @@ def _steam_boiler_graph( |
190 | 190 |
|
191 | 191 |
|
192 | 192 | @pytest.mark.parametrize("build_graph,method,override_field", _CATEGORIES) |
193 | | -def test_default_config_prefers_device( |
| 193 | +def test_default_config_prefers_component( |
194 | 194 | build_graph: GraphBuilder, |
195 | 195 | method: str, |
196 | 196 | override_field: str, # pylint: disable=unused-argument |
197 | 197 | ) -> None: |
198 | | - """Default config selects the device as the primary source.""" |
| 198 | + """Default config selects the component as the primary source.""" |
199 | 199 | formula = getattr(build_graph(None), method)(None) |
200 | | - assert formula == _DEVICE_PRIMARY |
| 200 | + assert formula == _COMPONENT_PRIMARY |
201 | 201 |
|
202 | 202 |
|
203 | 203 | @pytest.mark.parametrize("build_graph,method,override_field", _CATEGORIES) |
@@ -229,13 +229,13 @@ def test_override_true_wins_over_global_false( |
229 | 229 | def test_override_false_wins_over_global_true( |
230 | 230 | build_graph: GraphBuilder, method: str, override_field: str |
231 | 231 | ) -> None: |
232 | | - """A `False` per-formula override flips to device despite a `True` global.""" |
| 232 | + """A `False` per-formula override flips to component despite a `True` global.""" |
233 | 233 | config = ComponentGraphConfig( |
234 | 234 | prefer_meters_in_component_formulas=True, |
235 | 235 | formula_overrides=FormulaOverrides(**{override_field: False}), |
236 | 236 | ) |
237 | 237 | formula = getattr(build_graph(config), method)(None) |
238 | | - assert formula == _DEVICE_PRIMARY |
| 238 | + assert formula == _COMPONENT_PRIMARY |
239 | 239 |
|
240 | 240 |
|
241 | 241 | def _empty_graph() -> ComponentGraph[Any, Any, Any]: |
|
0 commit comments