Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tests/batcontrol/inverter/test_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@


class TestDummyInverter:
"""Test the Dummy inverter implementation"""
"""Test the Dummy inverter implementation.

These tests are implementation-specific, but they also act as one anchor
for the shared inverter mode semantics expected from backend
implementations.
"""

def test_dummy_initialization(self):
"""Test that dummy inverter initializes with correct default values"""
Expand All @@ -19,8 +24,8 @@ def test_dummy_initialization(self):
assert dummy.min_soc == 10
assert dummy.max_soc == 95

def test_dummy_mode_changes(self):
"""Test that mode changes work correctly"""
def test_dummy_implements_expected_inverter_mode_semantics(self):
"""Test that Dummy implements the expected shared inverter mode semantics."""
config = {'max_grid_charge_rate': 5000}
dummy = Dummy(config)

Expand Down
22 changes: 13 additions & 9 deletions tests/batcontrol/inverter/test_mqtt_inverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@


class TestMqttInverter:
"""Test the MQTT inverter implementation"""
"""Test the MQTT inverter implementation.

These tests are implementation-specific, but they also make the shared
inverter command semantics explicit for MQTT-backed control.
"""

def test_mqtt_inverter_initialization(self):
"""Test that MQTT inverter initializes with correct configuration"""
Expand Down Expand Up @@ -177,8 +181,8 @@ def test_mqtt_message_updates_max_charge_rate(self):
# Verify max_charge_rate was updated
assert inverter.max_grid_charge_rate == 6000

def test_set_mode_force_charge_publishes_command(self):
"""Test that force charge mode publishes correct MQTT commands"""
def test_force_charge_matches_inverter_mode_command_contract(self):
"""Test that MQTT force charge matches the expected inverter command contract."""
config = {
'base_topic': 'inverter',
'capacity': 10000,
Expand Down Expand Up @@ -207,8 +211,8 @@ def test_set_mode_force_charge_publishes_command(self):
rate_call = call('inverter/command/charge_rate', '3000', qos=1, retain=False)
assert rate_call in mock_client.publish.call_args_list

def test_set_mode_allow_discharge_publishes_command(self):
"""Test that allow discharge mode publishes correct MQTT command"""
def test_allow_discharge_matches_inverter_mode_command_contract(self):
"""Test that MQTT allow discharge matches the expected inverter command contract."""
config = {
'base_topic': 'inverter',
'capacity': 10000,
Expand All @@ -234,8 +238,8 @@ def test_set_mode_allow_discharge_publishes_command(self):
retain=False
)

def test_set_mode_avoid_discharge_publishes_command(self):
"""Test that avoid discharge mode publishes correct MQTT command"""
def test_avoid_discharge_matches_inverter_mode_command_contract(self):
"""Test that MQTT avoid discharge matches the expected inverter command contract."""
config = {
'base_topic': 'inverter',
'capacity': 10000,
Expand All @@ -261,8 +265,8 @@ def test_set_mode_avoid_discharge_publishes_command(self):
retain=False
)

def test_set_mode_limit_battery_charge_publishes_commands(self):
"""Test that limit battery charge mode publishes correct MQTT commands"""
def test_limit_battery_charge_matches_inverter_mode_command_contract(self):
"""Test that MQTT limit battery charge matches the expected inverter command contract."""
config = {
'base_topic': 'inverter',
'capacity': 10000,
Expand Down