Skip to content

Commit

Permalink
Fix fully_qualified should be typehints_fully_qualified (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Jan 10, 2022
1 parent 87759d4 commit d770c69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_autodoc_typehints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "\\[{}]"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sphinx_autodoc_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d770c69

Please sign in to comment.