Skip to content

Commit ff10eb8

Browse files
committed
Refactor test assertions and remove redundant test
Refactored initial_conditions assertions in TestDataset for improved readability. Removed the test_pad_missing_initial_conditions test from TestDatasetPad as it is no longer needed or relevant.
1 parent 9dd3ef8 commit ff10eb8

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

tests/unit/dataset/test_dataset.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def test_dataset_creation(self, time_states_inits):
4848
"Data shape should be (100,)"
4949
) # type: ignore
5050

51-
assert dataset.measurements[0].initial_conditions == {
52-
"s1": 100.0
53-
}, "Initial conditions should be {'s1': 100.0}"
54-
assert dataset.measurements[1].initial_conditions == {
55-
"s1": 200.0
56-
}, "Initial conditions should be {'s1': 200.0}"
51+
assert dataset.measurements[0].initial_conditions == {"s1": 100.0}, (
52+
"Initial conditions should be {'s1': 100.0}"
53+
)
54+
assert dataset.measurements[1].initial_conditions == {"s1": 200.0}, (
55+
"Initial conditions should be {'s1': 200.0}"
56+
)
5757

5858

5959
class TestDatasetPad:
@@ -308,22 +308,6 @@ def test_pad_empty_data_measurements(self):
308308
assert all(np.isnan(meas2.data["s1"]))
309309
assert all(np.isnan(meas2.data["s2"]))
310310

311-
def test_pad_missing_initial_conditions(self):
312-
"""Test that adding measurement raises error when initial conditions are missing for required species."""
313-
# Arrange
314-
dataset = ctx.Dataset(states=["s1", "s2"], id="test_pad")
315-
316-
# Act & Assert - should fail when trying to add measurement with missing initial conditions
317-
with pytest.raises(ValueError, match="inconsistent with the dataset states"):
318-
dataset.add_measurement(
319-
ctx.Measurement(
320-
id="meas1",
321-
time=[0, 1, 2],
322-
initial_conditions={"s1": 1.0}, # Missing s2
323-
data={"s1": [1.0, 1.1, 1.2]},
324-
)
325-
)
326-
327311
def test_pad_preserves_original_dataset(self):
328312
"""Test that padding creates a new dataset and doesn't modify the original."""
329313
# Arrange

0 commit comments

Comments
 (0)