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

Function test_rollback

xarray/tests/test_cftime_offsets.py:1052–1065  ·  view source on GitHub ↗
(calendar, offset, initial_date_args, partial_expected_date_args)

Source from the content-addressed store, hash-verified

1050 ids=_id_func,
1051)
1052def test_rollback(calendar, offset, initial_date_args, partial_expected_date_args):
1053 date_type = get_date_type(calendar)
1054 initial = date_type(*initial_date_args)
1055 if isinstance(offset, MonthBegin | QuarterBegin | YearBegin):
1056 expected_date_args = partial_expected_date_args + (1,)
1057 elif isinstance(offset, MonthEnd | QuarterEnd | YearEnd):
1058 reference_args = partial_expected_date_args + (1,)
1059 reference = date_type(*reference_args)
1060 expected_date_args = partial_expected_date_args + (reference.daysinmonth,)
1061 else:
1062 expected_date_args = partial_expected_date_args
1063 expected = date_type(*expected_date_args)
1064 result = offset.rollback(initial)
1065 assert result == expected
1066
1067
1068_CFTIME_RANGE_TESTS = [

Callers

nothing calls this directly

Calls 3

get_date_typeFunction · 0.90
date_typeFunction · 0.85
rollbackMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…