diff --git a/CHANGELOG.md b/CHANGELOG.md index e466ee5a..a75b3fc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.15.1 + +- Fix `fully_qualified` should be `typehints_fully_qualified` + ## 1.15.0 - Resolve type guard imports before evaluating annotations for objects diff --git a/src/sphinx_autodoc_typehints/__init__.py b/src/sphinx_autodoc_typehints/__init__.py index 492c35d2..5ecff688 100644 --- a/src/sphinx_autodoc_typehints/__init__.py +++ b/src/sphinx_autodoc_typehints/__init__.py @@ -121,7 +121,7 @@ def format_annotation(annotation: Any, config: Config) -> str: module = "typing" full_name = f"{module}.{class_name}" if module != "builtins" else class_name - fully_qualified: bool = getattr(config, "fully_qualified", False) + fully_qualified: bool = getattr(config, "typehints_fully_qualified", False) prefix = "" if fully_qualified or full_name == class_name else "~" role = "data" if class_name in _PYDATA_ANNOTATIONS else "class" args_format = "\\[{}]" diff --git a/tests/test_sphinx_autodoc_typehints.py b/tests/test_sphinx_autodoc_typehints.py index e5a9b4cd..aa366636 100644 --- a/tests/test_sphinx_autodoc_typehints.py +++ b/tests/test_sphinx_autodoc_typehints.py @@ -221,14 +221,14 @@ def test_format_annotation(inv: Inventory, annotation: Any, expected_result: str # Test with the "fully_qualified" flag turned on if "typing" in expected_result_not_simplified: expected_result_not_simplified = expected_result_not_simplified.replace("~typing", "typing") - conf = create_autospec(Config, fully_qualified=True, simplify_optional_unions=False) + conf = create_autospec(Config, typehints_fully_qualified=True, simplify_optional_unions=False) assert format_annotation(annotation, conf) == expected_result_not_simplified # Test with the "fully_qualified" flag turned on if "typing" in expected_result or __name__ in expected_result: expected_result = expected_result.replace("~typing", "typing") expected_result = expected_result.replace("~" + __name__, __name__) - conf = create_autospec(Config, fully_qualified=True) + conf = create_autospec(Config, typehints_fully_qualified=True) assert format_annotation(annotation, conf) == expected_result # Test for the correct role (class vs data) using the official Sphinx inventory