Skip to content

Commit a16ce6e

Browse files
committed
FormalAnnotation tests
1 parent e873c45 commit a16ce6e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from typing import Any, Union, Optional, Callable, Iterable, Sized
2+
3+
from pytest import mark
4+
5+
from pyannotating import FormalAnnotation, InputAnnotationAnnotation, AnnotationTemplate, input_annotation, Special
6+
7+
8+
@mark.parametrize(
9+
"input_resource, result",
10+
[(42, 42), (Any, Any), (int | float, int | float)]
11+
)
12+
def test_formal_annotation(input_resource: Any, result: Any):
13+
assert FormalAnnotation()[input_resource] == result
14+
15+
16+
@mark.parametrize(
17+
'doc',
18+
["Documentation", "\n\t.!#@$2*-_\n", b"\tHello\n\tWorld\n\t!", str()]
19+
)
20+
def test_formal_annotation_documenting(doc: str):
21+
assert FormalAnnotation(doc).__doc__ == doc

0 commit comments

Comments
 (0)