1
0

datetime_test.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # ical2vdir - convert .ics file to vdir directory
  2. #
  3. # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. import datetime
  18. import pytest
  19. import ical2vdir
  20. _CEST = datetime.timezone(datetime.timedelta(hours=+2))
  21. @pytest.mark.parametrize(
  22. ("dt_obj", "expected_str"),
  23. [
  24. (datetime.datetime(2012, 7, 17, 12, 0, tzinfo=_CEST), "20120717T120000+0200"),
  25. (
  26. datetime.datetime(2012, 7, 17, 12, 0, tzinfo=datetime.timezone.utc),
  27. "20120717T120000+0000",
  28. ),
  29. ],
  30. )
  31. def test__datetime_basic_isoformat(dt_obj, expected_str):
  32. # pylint: disable=protected-access
  33. assert ical2vdir._datetime_basic_isoformat(dt_obj) == expected_str