-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |