Skip to content

Commit eda0024

Browse files
committed
InputAnnotationAnnotation tests
1 parent a16ce6e commit eda0024

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,23 @@ def test_formal_annotation(input_resource: Any, result: Any):
1919
)
2020
def test_formal_annotation_documenting(doc: str):
2121
assert FormalAnnotation(doc).__doc__ == doc
22+
23+
24+
@mark.parametrize('number_of_creation', [8])
25+
def test_input_annotation_annotation_loneliness(number_of_creation: int):
26+
annotations = tuple(InputAnnotationAnnotation() for _ in range(number_of_creation))
27+
28+
for first_annotation_index in range(number_of_creation):
29+
for second_annotation in annotations[first_annotation_index + 1:]:
30+
assert annotations[first_annotation_index] is second_annotation
31+
32+
33+
@mark.parametrize(
34+
"type_to_group",
35+
[int, float, int | float, Union[set, frozenset], Optional[tuple], InputAnnotationAnnotation]
36+
)
37+
def test_input_annotation_annotation_grouping(type_to_group: type):
38+
annotation = InputAnnotationAnnotation()
39+
40+
assert annotation | type_to_group == Union[annotation, type_to_group]
41+
assert type_to_group | annotation == Union[type_to_group | annotation]

0 commit comments

Comments
 (0)