test_isocalendar.py 674 B

1234567891011121314151617181920
  1. from pandas import (
  2. DataFrame,
  3. DatetimeIndex,
  4. )
  5. import pandas._testing as tm
  6. def test_isocalendar_returns_correct_values_close_to_new_year_with_tz():
  7. # GH#6538: Check that DatetimeIndex and its TimeStamp elements
  8. # return the same weekofyear accessor close to new year w/ tz
  9. dates = ["2013/12/29", "2013/12/30", "2013/12/31"]
  10. dates = DatetimeIndex(dates, tz="Europe/Brussels")
  11. result = dates.isocalendar()
  12. expected_data_frame = DataFrame(
  13. [[2013, 52, 7], [2014, 1, 1], [2014, 1, 2]],
  14. columns=["year", "week", "day"],
  15. index=dates,
  16. dtype="UInt32",
  17. )
  18. tm.assert_frame_equal(result, expected_data_frame)