Browse Source

added tests for _datetime_basic_isoformat

Fabian Peter Hammerle 4 years ago
parent
commit
d0ad6d5725
2 changed files with 23 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 22 0
      tests/datetime_test.py

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
+.coverage
 .mypy_cache/

+ 22 - 0
tests/datetime_test.py

@@ -0,0 +1,22 @@
+import datetime
+
+import pytest
+
+import ics2vdir
+
+_CEST = datetime.timezone(datetime.timedelta(hours=+2))
+
+
+@pytest.mark.parametrize(
+    ("dt_obj", "expected_str"),
+    [
+        (datetime.datetime(2012, 7, 17, 12, 0, tzinfo=_CEST), "20120717T120000+0200"),
+        (
+            datetime.datetime(2012, 7, 17, 12, 0, tzinfo=datetime.timezone.utc),
+            "20120717T120000+0000",
+        ),
+    ],
+)
+def test__datetime_basic_isoformat(dt_obj, expected_str):
+    # pylint: disable=protected-access
+    assert ics2vdir._datetime_basic_isoformat(dt_obj) == expected_str