From eb918cce598e0d908e9151fadeab32de31442792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=BChlbauer?= Date: Sat, 14 Dec 2024 15:20:32 +0100 Subject: [PATCH] add microsecond to test_parse_iso8601_like --- xarray/tests/test_cftimeindex.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/xarray/tests/test_cftimeindex.py b/xarray/tests/test_cftimeindex.py index e34714a344a..905ceabd5fe 100644 --- a/xarray/tests/test_cftimeindex.py +++ b/xarray/tests/test_cftimeindex.py @@ -35,9 +35,23 @@ standard_or_gregorian = "standard" -def date_dict(year=None, month=None, day=None, hour=None, minute=None, second=None): +def date_dict( + year=None, + month=None, + day=None, + hour=None, + minute=None, + second=None, + microsecond=None, +): return dict( - year=year, month=month, day=day, hour=hour, minute=minute, second=second + year=year, + month=month, + day=day, + hour=hour, + minute=minute, + second=second, + microsecond=microsecond, ) @@ -100,7 +114,9 @@ def test_parse_iso8601_like(string, expected): with pytest.raises(ValueError): parse_iso8601_like(string + "3") - parse_iso8601_like(string + ".3") + if result["second"] is None: + with pytest.raises(ValueError): + parse_iso8601_like(string + ".3") _CFTIME_CALENDARS = [