Browse Source

added first tests for _event_prop_equal

Fabian Peter Hammerle 4 years ago
parent
commit
32c8ad8b90
3 changed files with 32 additions and 0 deletions
  1. 1 0
      .pylintrc
  2. 2 0
      README.md
  3. 29 0
      tests/prop_test.py

+ 1 - 0
.pylintrc

@@ -1,4 +1,5 @@
 [MESSAGE CONTROL]
 
 disable=bad-continuation, # black
+        missing-function-docstring,
         missing-module-docstring

+ 2 - 0
README.md

@@ -37,4 +37,6 @@ $ git clone https://github.com/fphammerle/ics2vdir.git
 $ cd ics2vdir
 $ pipenv sync --dev
 $ pipenv run pylint ics2vdir
+$ pipenv run mypy ics2vdir
+$ pipenv run pytest --cov=ics2vdir --cov-report=term-missing --cov-fail-under=100
 ```

+ 29 - 0
tests/prop_test.py

@@ -0,0 +1,29 @@
+import pytest
+from icalendar.prop import vCalAddress, vInt, vText
+
+from ics2vdir import _event_prop_equal
+
+
+@pytest.mark.parametrize(
+    ("prop_a", "prop_b", "expected_result"),
+    [
+        (vText("CONFIRMED"), vText("CONFIRMED"), True),
+        (vText("TENTATIVE"), vText("TENTATIVE"), True),
+        (vText("CONFIRMED"), vText("TENTATIVE"), False),
+        (vText("CONFIRMED"), vInt(0), False),
+        (vInt(0), vInt(0), True),
+        (vInt(0), vInt(21), False),
+        (
+            vCalAddress("mailto:someone@somewhere.com"),
+            vCalAddress("mailto:someone@somewhere.com"),
+            True,
+        ),
+        (
+            vCalAddress("mailto:someone@somewhere.com"),
+            vCalAddress("mailto:someelse@somewhere.com"),
+            False,
+        ),
+    ],
+)
+def test__event_prop_equal(prop_a, prop_b, expected_result):
+    assert _event_prop_equal(prop_a, prop_b) == expected_result