Skip to content

Commit a30a9fb

Browse files
committed
Test error when incompatible cubes in cubelist
1 parent 8c18272 commit a30a9fb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/operators/test_collapse.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,18 @@ def test_collapse_by_validity_time_cubelist(long_forecast_many_cubes):
223223
assert repr(collapsed_cube) == expected_cube
224224

225225

226+
def test_collapse_by_validity_time_incompatible_cubelist(long_forecast_many_cubes):
227+
"""Error raised when incompatible cubes are given."""
228+
foo_cubes = long_forecast_many_cubes.copy()
229+
for cube in foo_cubes:
230+
cube.rename("foo")
231+
test_cubes = long_forecast_many_cubes + foo_cubes
232+
with pytest.raises(
233+
ValueError, match="Cubes should be compatible when collapsing by validity time."
234+
):
235+
collapse.collapse_by_validity_time(test_cubes, "MEAN")
236+
237+
226238
def test_collapse_by_validity_time_percentile(long_forecast_multi_day):
227239
"""Reduce by validity time with percentiles."""
228240
# Test successful collapsing by validity time.

0 commit comments

Comments
 (0)