Skip to content

Commit

Permalink
add test for inspect.get_annotations()
Browse files Browse the repository at this point in the history
  • Loading branch information
InvincibleRMC committed Dec 21, 2024
1 parent 921657a commit e1e2c9a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_pytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,18 @@ def test_module_attribute_types() -> None:
assert module_annotations["list_int"] == "list[int]"
assert module_annotations["set_str"] == "set[str]"

@pytest.mark.skipif(
not m.defined___cpp_inline_variables,
reason="C++17 feature __cpp_inline_variables not available.",
)
@pytest.mark.skipif(sys.version_info < (3, 10),
reason="get_annotations function does not exist until Python3.10")
def test_get_annotations_compliance() -> None:
from inspect import get_annotations
module_annotations = get_annotations(m)

assert module_annotations["list_int"] == "list[int]"
assert module_annotations["set_str"] == "set[str]"

@pytest.mark.skipif(
not m.defined___cpp_inline_variables,
Expand Down

0 comments on commit e1e2c9a

Please sign in to comment.