mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add sphinx.util.inspect:isgenericalias()
This commit is contained in:
6
tests/roots/test-ext-autodoc/target/genericalias.py
Normal file
6
tests/roots/test-ext-autodoc/target/genericalias.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import List, Callable
|
||||
|
||||
#: A list of int
|
||||
T = List[int]
|
||||
|
||||
C = Callable[[int], None] # a generic alias not having a doccomment
|
||||
@@ -560,6 +560,18 @@ def test_isproperty(app):
|
||||
assert inspect.isproperty(func) is False # function
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason='python 3.7+ is required.')
|
||||
@pytest.mark.sphinx(testroot='ext-autodoc')
|
||||
def test_isgenericalias(app):
|
||||
from target.genericalias import C, T
|
||||
from target.methods import Base
|
||||
|
||||
assert inspect.isgenericalias(C) is True
|
||||
assert inspect.isgenericalias(T) is True
|
||||
assert inspect.isgenericalias(object()) is False
|
||||
assert inspect.isgenericalias(Base) is False
|
||||
|
||||
|
||||
def test_unpartial():
|
||||
def func1(a, b, c):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user