MCPcopy
hub / github.com/pandas-dev/pandas / test_calendar

Function test_calendar

pandas/tests/tseries/holiday/test_calendar.py:26–46  ·  view source on GitHub ↗
(transform)

Source from the content-addressed store, hash-verified

24 "transform", [lambda x: x, lambda x: x.strftime("%Y-%m-%d"), lambda x: Timestamp(x)]
25)
26def test_calendar(transform):
27 start_date = datetime(2012, 1, 1)
28 end_date = datetime(2012, 12, 31)
29
30 calendar = USFederalHolidayCalendar()
31 holidays = calendar.holidays(transform(start_date), transform(end_date))
32
33 expected = [
34 datetime(2012, 1, 2),
35 datetime(2012, 1, 16),
36 datetime(2012, 2, 20),
37 datetime(2012, 5, 28),
38 datetime(2012, 7, 4),
39 datetime(2012, 9, 3),
40 datetime(2012, 10, 8),
41 datetime(2012, 11, 12),
42 datetime(2012, 11, 22),
43 datetime(2012, 12, 25),
44 ]
45
46 assert list(holidays.to_pydatetime()) == expected
47
48
49def test_calendar_caching():

Callers

nothing calls this directly

Calls 4

holidaysMethod · 0.80
transformFunction · 0.50
to_pydatetimeMethod · 0.45

Tested by

no test coverage detected