From cd9c6e6f71e933a33c2cd3e2aa6855b903c2f9f1 Mon Sep 17 00:00:00 2001 From: Elizaveta Malinina Date: Wed, 24 Jul 2024 20:33:27 +0000 Subject: [PATCH] add test one of the years in extarct_time input is None --- tests/unit/preprocessor/_time/test_time.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/preprocessor/_time/test_time.py b/tests/unit/preprocessor/_time/test_time.py index b478a97143..8cda75b73b 100644 --- a/tests/unit/preprocessor/_time/test_time.py +++ b/tests/unit/preprocessor/_time/test_time.py @@ -170,6 +170,13 @@ def test_extract_time_no_time(self): cube = _create_sample_cube()[0] sliced = extract_time(cube, 1950, 1, 1, 1950, 12, 31) assert cube == sliced + + def test_extract_time_none_year(self): + """Test extract_time when one of the years is None.""" + cube = self.cube.coord('time').guess_bounds() + with assert_raises(ValueError): + extract_time(cube, None, 1, 1, 1950, 2, 1) + class TestClipTimerange(tests.Test):