Skip to content

Commit 3fe4152

Browse files
committed
AnnotationTemplate test
1 parent eda0024 commit 3fe4152

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,26 @@ def test_input_annotation_annotation_grouping(type_to_group: type):
3939

4040
assert annotation | type_to_group == Union[annotation, type_to_group]
4141
assert type_to_group | annotation == Union[type_to_group | annotation]
42+
43+
44+
@mark.parametrize(
45+
"annotation_template, input_resource, result",
46+
[
47+
(AnnotationTemplate(Optional, [input_annotation]), int, Optional[int]),
48+
(
49+
AnnotationTemplate(Callable, [[input_annotation | int, input_annotation], Any]),
50+
float,
51+
Callable[[float | int, float], Any]
52+
),
53+
(
54+
AnnotationTemplate(
55+
Callable,
56+
[[input_annotation], AnnotationTemplate(Optional, [input_annotation])]
57+
),
58+
str,
59+
Callable[[str], Optional[str]]
60+
),
61+
]
62+
)
63+
def test_annotation_template(annotation_template: AnnotationTemplate, input_resource: Any, result: Any):
64+
assert annotation_template[input_resource] == result

0 commit comments

Comments
 (0)