diff options
author | Joost van Zwieten <joostvanzwieten@gmail.com> | 2016-07-29 12:27:00 +0200 |
---|---|---|
committer | Joost van Zwieten <joostvanzwieten@gmail.com> | 2016-08-07 16:18:22 +0200 |
commit | 099b58f7fee7d4688faebace615e781245bf20b8 (patch) | |
tree | 84863c6d1e33d0a666e6934d845bcee910774f46 /tests/typing_test_data.py | |
parent | da7e2d9dda35714111cdc98ba07b3a75d7d3886f (diff) | |
download | sphinx-git-099b58f7fee7d4688faebace615e781245bf20b8.tar.gz |
ext.autodoc: fix formatting instance annotations
Currently `format_annotation` fails on instances, because instances don't have
`__module__` and `__qualname__` attributes. Defer building the
`qualified_name` of an annotation until we have established that the annotation
is a type.
Diffstat (limited to 'tests/typing_test_data.py')
-rw-r--r-- | tests/typing_test_data.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/typing_test_data.py b/tests/typing_test_data.py index 74a906ad1..461be7831 100644 --- a/tests/typing_test_data.py +++ b/tests/typing_test_data.py @@ -46,3 +46,11 @@ def f7(x: Callable[[int, str], int]) -> None: def f8(x: Tuple[int, str], y: Tuple[int, ...]) -> None: pass + + +class CustomAnnotation: + def __repr__(self): + return 'CustomAnnotation' + +def f9(x: CustomAnnotation(), y: 123) -> None: + pass |