MCPcopy Index your code
hub / github.com/pydata/xarray / test_to_offset_quarter

Function test_to_offset_quarter

xarray/tests/test_cftime_offsets.py:302–326  ·  view source on GitHub ↗
(month_label, month_int, multiple, offset_str)

Source from the content-addressed store, hash-verified

300@pytest.mark.parametrize("offset_str", ["QS", "Q", "QE"])
301@pytest.mark.filterwarnings("ignore::FutureWarning") # Deprecation of "Q" etc.
302def test_to_offset_quarter(month_label, month_int, multiple, offset_str):
303 freq = offset_str
304 offset_type = _QUARTER_OFFSET_TYPES[offset_str]
305 if month_label:
306 freq = f"{freq}-{month_label}"
307 if multiple:
308 freq = f"{multiple}{freq}"
309 result = to_offset(freq)
310
311 if multiple and month_int:
312 expected = offset_type(n=multiple, month=month_int)
313 elif multiple:
314 if month_int:
315 expected = offset_type(n=multiple)
316 elif offset_type == QuarterBegin:
317 expected = offset_type(n=multiple, month=1)
318 elif offset_type == QuarterEnd:
319 expected = offset_type(n=multiple, month=12)
320 elif month_int:
321 expected = offset_type(month=month_int)
322 elif offset_type == QuarterBegin:
323 expected = offset_type(month=1)
324 elif offset_type == QuarterEnd:
325 expected = offset_type(month=12)
326 assert result == expected
327
328
329@pytest.mark.parametrize("freq", ["Z", "7min2", "AM", "M-", "AS-", "QS-", "1H1min"])

Callers

nothing calls this directly

Calls 1

to_offsetFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…