|
12 | 12 | ElectricalComponentId, |
13 | 13 | EvCharger, |
14 | 14 | HybridEvCharger, |
| 15 | + ProblematicElectricalComponent, |
15 | 16 | UnrecognizedEvCharger, |
16 | 17 | UnspecifiedEvCharger, |
17 | 18 | ) |
@@ -86,3 +87,55 @@ def test_unrecognized_ev_charger_type( |
86 | 87 | assert charger.microgrid_id == microgrid_id |
87 | 88 | assert charger.name == "unrecognized_charger" |
88 | 89 | assert charger.type == 999 |
| 90 | + |
| 91 | + |
| 92 | +def test_unspecified_ev_charger_is_problematic( |
| 93 | + component_id: ElectricalComponentId, microgrid_id: MicrogridId |
| 94 | +) -> None: |
| 95 | + """Test that `UnspecifiedEvCharger` is a `ProblematicElectricalComponent`.""" |
| 96 | + charger = UnspecifiedEvCharger( |
| 97 | + id=component_id, |
| 98 | + microgrid_id=microgrid_id, |
| 99 | + _provides_telemetry=True, |
| 100 | + _accepts_control=True, |
| 101 | + _allow_construction=True, |
| 102 | + ) |
| 103 | + |
| 104 | + assert isinstance(charger, ProblematicElectricalComponent) |
| 105 | + assert isinstance(charger, EvCharger) |
| 106 | + |
| 107 | + |
| 108 | +def test_unrecognized_ev_charger_is_problematic( |
| 109 | + component_id: ElectricalComponentId, microgrid_id: MicrogridId |
| 110 | +) -> None: |
| 111 | + """Test that `UnrecognizedEvCharger` is a `ProblematicElectricalComponent`.""" |
| 112 | + charger = UnrecognizedEvCharger( |
| 113 | + id=component_id, |
| 114 | + microgrid_id=microgrid_id, |
| 115 | + type=999, |
| 116 | + _provides_telemetry=True, |
| 117 | + _accepts_control=True, |
| 118 | + _allow_construction=True, |
| 119 | + ) |
| 120 | + |
| 121 | + assert isinstance(charger, ProblematicElectricalComponent) |
| 122 | + assert isinstance(charger, EvCharger) |
| 123 | + |
| 124 | + |
| 125 | +@pytest.mark.parametrize("cls", [AcEvCharger, DcEvCharger, HybridEvCharger]) |
| 126 | +def test_recognized_ev_charger_types_are_not_problematic( |
| 127 | + cls: type[AcEvCharger | DcEvCharger | HybridEvCharger], |
| 128 | + component_id: ElectricalComponentId, |
| 129 | + microgrid_id: MicrogridId, |
| 130 | +) -> None: |
| 131 | + """Test that recognized EV charger types are NOT `ProblematicElectricalComponent`.""" |
| 132 | + charger = cls( |
| 133 | + id=component_id, |
| 134 | + microgrid_id=microgrid_id, |
| 135 | + _provides_telemetry=True, |
| 136 | + _accepts_control=True, |
| 137 | + _allow_construction=True, |
| 138 | + ) |
| 139 | + |
| 140 | + assert not isinstance(charger, ProblematicElectricalComponent) |
| 141 | + assert isinstance(charger, EvCharger) |
0 commit comments