Skip to content

Commit 89e184a

Browse files
committed
remove some overlap/duplication of tests
1 parent 18c1a2d commit 89e184a

File tree

5 files changed

+3
-41
lines changed

5 files changed

+3
-41
lines changed

tests/instruments/test_adcp.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,6 @@ def test_adcp_sensor_config_active_variables() -> None:
148148
)
149149
assert config_with.active_variables() == {"U": "uo", "V": "vo"}
150150

151-
with pytest.raises(pydantic.ValidationError, match="no enabled sensors"):
152-
ADCPConfig(
153-
max_depth_meter=-1000.0,
154-
num_bins=40,
155-
period_minutes=5.0,
156-
sensors=[], # all disabled → invalid
157-
)
158-
159151

160152
def test_adcp_sensor_config_yaml() -> None:
161153
"""ADCPConfig sensors survive YAML serialisation."""

tests/instruments/test_ctd.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,6 @@ def test_ctd_sensor_config_active_variables() -> None:
191191
)
192192
assert config_temp_only.active_variables() == {"T": "thetao"}
193193

194-
with pytest.raises(pydantic.ValidationError, match="no enabled sensors"):
195-
CTDConfig(
196-
stationkeeping_time_minutes=50,
197-
min_depth_meter=-11.0,
198-
max_depth_meter=-2000.0,
199-
sensors=[], # all absent = all disabled → invalid
200-
)
201-
202194

203195
def test_ctd_sensor_config_yaml() -> None:
204196
"""CTDConfig sensors survive YAML serialisation."""

tests/instruments/test_ship_underwater_st.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ def test_ship_underwater_st_sensor_config_active_variables() -> None:
148148
)
149149
assert config_temp_only.active_variables() == {"T": "thetao"}
150150

151-
with pytest.raises(pydantic.ValidationError, match="no enabled sensors"):
152-
ShipUnderwaterSTConfig(
153-
period_minutes=5.0,
154-
sensors=[], # all disabled → invalid
155-
)
156-
157151

158152
def test_ship_underwater_st_sensor_config_yaml() -> None:
159153
"""ShipUnderwaterSTConfig sensors survive YAML serialisation."""

tests/instruments/test_xbt.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,6 @@ def test_xbt_sensor_config_active_variables() -> None:
170170
)
171171
assert config_with_temp.active_variables() == {"T": "thetao"}
172172

173-
with pytest.raises(pydantic.ValidationError, match="no enabled sensors"):
174-
XBTConfig(
175-
min_depth_meter=-2.0,
176-
max_depth_meter=-285.0,
177-
fall_speed_meter_per_second=6.7,
178-
deceleration_coefficient=0.00225,
179-
sensors=[], # all disabled → invalid
180-
)
181-
182173

183174
def test_xbt_sensor_config_yaml() -> None:
184175
"""XBTConfig sensors survive YAML serialisation."""

tests/test_utils.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,9 @@ def test_calc_wp_stationkeeping_time_no_instruments(expedition):
365365
assert stationkeeping_null == datetime.timedelta(0) # at least one is 0 time
366366

367367

368-
def test_sensor_registry_every_sensor_type_has_entry():
369-
"""Every SensorType must be present as a key in SENSOR_REGISTRY."""
370-
for sensor in SensorType:
371-
assert sensor in SENSOR_REGISTRY, f"{sensor} missing from SENSOR_REGISTRY"
372-
373-
374-
def test_sensor_registry_no_extra_keys():
375-
"""SENSOR_REGISTRY should not contain keys outside SensorType."""
376-
for key in SENSOR_REGISTRY:
377-
assert isinstance(key, SensorType)
368+
def test_sensor_registry_keys_match_sensor_type():
369+
"""SENSOR_REGISTRY keys must be exactly the set of SensorType members."""
370+
assert set(SENSOR_REGISTRY.keys()) == set(SensorType)
378371

379372

380373
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)