66
77
88class TestMqttInverter :
9- """Test the MQTT inverter implementation"""
9+ """Test the MQTT inverter implementation.
10+
11+ These tests are implementation-specific, but they also make the shared
12+ inverter command semantics explicit for MQTT-backed control.
13+ """
1014
1115 def test_mqtt_inverter_initialization (self ):
1216 """Test that MQTT inverter initializes with correct configuration"""
@@ -177,8 +181,8 @@ def test_mqtt_message_updates_max_charge_rate(self):
177181 # Verify max_charge_rate was updated
178182 assert inverter .max_grid_charge_rate == 6000
179183
180- def test_set_mode_force_charge_publishes_command (self ):
181- """Test that force charge mode publishes correct MQTT commands """
184+ def test_force_charge_matches_inverter_mode_command_contract (self ):
185+ """Test that MQTT force charge matches the expected inverter command contract. """
182186 config = {
183187 'base_topic' : 'inverter' ,
184188 'capacity' : 10000 ,
@@ -207,8 +211,8 @@ def test_set_mode_force_charge_publishes_command(self):
207211 rate_call = call ('inverter/command/charge_rate' , '3000' , qos = 1 , retain = False )
208212 assert rate_call in mock_client .publish .call_args_list
209213
210- def test_set_mode_allow_discharge_publishes_command (self ):
211- """Test that allow discharge mode publishes correct MQTT command"""
214+ def test_allow_discharge_matches_inverter_mode_command_contract (self ):
215+ """Test that MQTT allow discharge matches the expected inverter command contract. """
212216 config = {
213217 'base_topic' : 'inverter' ,
214218 'capacity' : 10000 ,
@@ -234,8 +238,8 @@ def test_set_mode_allow_discharge_publishes_command(self):
234238 retain = False
235239 )
236240
237- def test_set_mode_avoid_discharge_publishes_command (self ):
238- """Test that avoid discharge mode publishes correct MQTT command"""
241+ def test_avoid_discharge_matches_inverter_mode_command_contract (self ):
242+ """Test that MQTT avoid discharge matches the expected inverter command contract. """
239243 config = {
240244 'base_topic' : 'inverter' ,
241245 'capacity' : 10000 ,
@@ -261,8 +265,8 @@ def test_set_mode_avoid_discharge_publishes_command(self):
261265 retain = False
262266 )
263267
264- def test_set_mode_limit_battery_charge_publishes_commands (self ):
265- """Test that limit battery charge mode publishes correct MQTT commands """
268+ def test_limit_battery_charge_matches_inverter_mode_command_contract (self ):
269+ """Test that MQTT limit battery charge matches the expected inverter command contract. """
266270 config = {
267271 'base_topic' : 'inverter' ,
268272 'capacity' : 10000 ,
0 commit comments