Skip to content

Commit

Permalink
tests: coverage for typing_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPyser committed Sep 20, 2024
1 parent 7bbf3cc commit b7fee37
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions xivo/tests/test_typing_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# from typing import get_type_hints

from typing import get_type_hints

from xivo.typing_utils import JSON


class TestAnnotations:
# the relevant test coverage relies on the mypy linter checking those annotations,
# not on runtime tests
a: JSON = dict(name="hello")
b: JSON = 2
c: JSON = [1, 2, 3]
d: JSON = "hello"
e: JSON = True
f: JSON = 3.14
g: JSON = None
h: JSON = [a, b, c, d, e, f, g]
i: JSON = {"a": a, "b": b, "c": c, "d": d, "e": e, "f": f, "g": g}

def test_annotations(self):
annots = get_type_hints(self.__class__)
assert all(t is JSON for t in annots.values())

0 comments on commit b7fee37

Please sign in to comment.