diff --git a/src/pytkdocs/loader.py b/src/pytkdocs/loader.py index a8cc8c5..658cc34 100644 --- a/src/pytkdocs/loader.py +++ b/src/pytkdocs/loader.py @@ -5,6 +5,8 @@ iterating over their members, etc. """ +from __future__ import annotations + import importlib import inspect import pkgutil diff --git a/tests/fixtures/final.py b/tests/fixtures/final.py new file mode 100644 index 0000000..33a788f --- /dev/null +++ b/tests/fixtures/final.py @@ -0,0 +1,10 @@ +# from __future__ import annotations + +from typing import Final, get_type_hints + +name: Final[str] = "final" + +class Class: + value: Final = 3000 + +# get_type_hints(Class) diff --git a/tests/test_loader.py b/tests/test_loader.py index 9c8d98a..bb15fe7 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -536,3 +536,8 @@ def test_load_decorated_function(): assert child.category == "function" assert child.parent is child.root assert child.parent.name == "decorated_function" + +def test_load_final_annotations(): + """Load things annotated as final.""" + loader = Loader(new_path_syntax=True) + obj = loader.get_object_documentation("tests.fixtures.final")