MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _test_date2num_dst

Function _test_date2num_dst

lib/matplotlib/tests/test_dates.py:969–988  ·  view source on GitHub ↗
(date_range, tz_convert)

Source from the content-addressed store, hash-verified

967
968
969def _test_date2num_dst(date_range, tz_convert):
970 # Timezones
971
972 BRUSSELS = dateutil.tz.gettz('Europe/Brussels')
973 UTC = mdates.UTC
974
975 # Create a list of timezone-aware datetime objects in UTC
976 # Interval is 0b0.0000011 days, to prevent float rounding issues
977 dtstart = datetime.datetime(2014, 3, 30, 0, 0, tzinfo=UTC)
978 interval = datetime.timedelta(minutes=33, seconds=45)
979 interval_days = interval.seconds / 86400
980 N = 8
981
982 dt_utc = date_range(start=dtstart, freq=interval, periods=N)
983 dt_bxl = tz_convert(dt_utc, BRUSSELS)
984 t0 = 735322.0 + mdates.date2num(np.datetime64('0000-12-31'))
985 expected_ordinalf = [t0 + (i * interval_days) for i in range(N)]
986 actual_ordinalf = list(mdates.date2num(dt_bxl))
987
988 assert actual_ordinalf == expected_ordinalf
989
990
991def test_date2num_dst():

Callers 2

test_date2num_dstFunction · 0.85
test_date2num_dst_pandasFunction · 0.85

Calls 2

date_rangeFunction · 0.85
tz_convertFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…