datetime_test.py 572 B

12345678910111213141516171819202122
  1. import datetime
  2. import pytest
  3. import ics2vdir
  4. _CEST = datetime.timezone(datetime.timedelta(hours=+2))
  5. @pytest.mark.parametrize(
  6. ("dt_obj", "expected_str"),
  7. [
  8. (datetime.datetime(2012, 7, 17, 12, 0, tzinfo=_CEST), "20120717T120000+0200"),
  9. (
  10. datetime.datetime(2012, 7, 17, 12, 0, tzinfo=datetime.timezone.utc),
  11. "20120717T120000+0000",
  12. ),
  13. ],
  14. )
  15. def test__datetime_basic_isoformat(dt_obj, expected_str):
  16. # pylint: disable=protected-access
  17. assert ics2vdir._datetime_basic_isoformat(dt_obj) == expected_str