diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-08 13:17:28 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-10 02:41:58 +0900 |
commit | 6d1cafe7bd0ec10f453952b51aff80eb6f44c7b0 (patch) | |
tree | cbcfa3fa5e348132707d33dbdeda122f3571b721 /tests/test_ext_autodoc_configs.py | |
parent | e2c969c4955662a8c5e4da8b77672aaaa7729359 (diff) | |
download | sphinx-git-6d1cafe7bd0ec10f453952b51aff80eb6f44c7b0.tar.gz |
autodoc: Add Optional[t] to annotation of function and method
As typing.get_type_hints() doing, this adds Optional[t] to type
annotations if a default value equal to None is set.
Note: this is default behavior of inspect.signature() since Python 3.10.
Diffstat (limited to 'tests/test_ext_autodoc_configs.py')
-rw-r--r-- | tests/test_ext_autodoc_configs.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py index a0eba20c8..19936c5ae 100644 --- a/tests/test_ext_autodoc_configs.py +++ b/tests/test_ext_autodoc_configs.py @@ -490,7 +490,7 @@ def test_autodoc_typehints_signature(app): '.. py:module:: target.typehints', '', '', - '.. py:class:: Math(s: str, o: Any = None)', + '.. py:class:: Math(s: str, o: Optional[Any] = None)', ' :module: target.typehints', '', '', |