assert repr(offset) == expected @pytest.mark.parametrize( 'offset', [BaseCFTimeOffset(), MonthBegin(), YearBegin()], ids=_id_func) def test_to_offset_offset_input(offset): assert to_offset(offset) == offset @pytest.mark.parametrize(('freq', 'expected'), [('M', MonthEnd()), ('2M', MonthEnd(n=2)), ('MS', MonthBegin()), ('2MS', MonthBegin(n=2)), ('D', Day()), ('2D', Day(n=2)), ('H', Hour()), ('2H', Hour(n=2)), ('T', Minute()), ('2T', Minute(n=2)), ('min', Minute()), ('2min', Minute(n=2)), ('S', Second()), ('2S', Second(n=2))], ids=_id_func) def test_to_offset_sub_annual(freq, expected): assert to_offset(freq) == expected _ANNUAL_OFFSET_TYPES = {'A': YearEnd, 'AS': YearBegin}
ids=_id_func, ) def test_to_offset_offset_input(offset): assert to_offset(offset) == offset @pytest.mark.parametrize( ("freq", "expected"), [ ("M", MonthEnd()), ("2M", MonthEnd(n=2)), ("MS", MonthBegin()), ("2MS", MonthBegin(n=2)), ("D", Day()), ("2D", Day(n=2)), ("H", Hour()), ("2H", Hour(n=2)), ("T", Minute()), ("2T", Minute(n=2)), ("min", Minute()), ("2min", Minute(n=2)), ("S", Second()), ("2S", Second(n=2)), ], ids=_id_func, ) def test_to_offset_sub_annual(freq, expected): assert to_offset(freq) == expected _ANNUAL_OFFSET_TYPES = {"A": YearEnd, "AS": YearBegin}
@pytest.fixture(params=_CFTIME_CALENDARS) def calendar(request): return request.param @pytest.mark.parametrize( ("offset", "expected_n"), [ (BaseCFTimeOffset(), 1), (YearBegin(), 1), (YearEnd(), 1), (QuarterBegin(), 1), (QuarterEnd(), 1), (Tick(), 1), (Day(), 1), (Hour(), 1), (Minute(), 1), (Second(), 1), (Millisecond(), 1), (Microsecond(), 1), (BaseCFTimeOffset(n=2), 2), (YearBegin(n=2), 2), (YearEnd(n=2), 2), (QuarterBegin(n=2), 2), (QuarterEnd(n=2), 2), (Tick(n=2), 2), (Day(n=2), 2), (Hour(n=2), 2), (Minute(n=2), 2), (Second(n=2), 2), (Millisecond(n=2), 2),
[BaseCFTimeOffset(), MonthBegin(), QuarterBegin(), YearBegin()], ids=_id_func ) def test_to_offset_offset_input(offset): assert to_offset(offset) == offset @pytest.mark.parametrize( ('freq', 'expected'), [('M', MonthEnd()), ('2M', MonthEnd(n=2)), ('MS', MonthBegin()), ('2MS', MonthBegin(n=2)), ('D', Day()), ('2D', Day(n=2)), ('H', Hour()), ('2H', Hour(n=2)), ('T', Minute()), ('2T', Minute(n=2)), ('min', Minute()), ('2min', Minute(n=2)), ('S', Second()), ('2S', Second(n=2))], ids=_id_func ) def test_to_offset_sub_annual(freq, expected): assert to_offset(freq) == expected _ANNUAL_OFFSET_TYPES = { 'A': YearEnd,
[BaseCFTimeOffset(), MonthBegin(), YearBegin()], ids=_id_func ) def test_to_offset_offset_input(offset): assert to_offset(offset) == offset @pytest.mark.parametrize( ('freq', 'expected'), [('M', MonthEnd()), ('2M', MonthEnd(n=2)), ('MS', MonthBegin()), ('2MS', MonthBegin(n=2)), ('D', Day()), ('2D', Day(n=2)), ('H', Hour()), ('2H', Hour(n=2)), ('T', Minute()), ('2T', Minute(n=2)), ('min', Minute()), ('2min', Minute(n=2)), ('S', Second()), ('2S', Second(n=2))], ids=_id_func ) def test_to_offset_sub_annual(freq, expected): assert to_offset(freq) == expected _ANNUAL_OFFSET_TYPES = { 'A': YearEnd,