mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: autodoc: class processors on autofunction is no longer needed
This commit is contained in:
12
tests/roots/test-ext-autodoc/target/classes.py
Normal file
12
tests/roots/test-ext-autodoc/target/classes.py
Normal file
@@ -0,0 +1,12 @@
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
|
||||
class Bar:
|
||||
def __init__(self, x, y):
|
||||
pass
|
||||
|
||||
|
||||
class Baz:
|
||||
def __new__(cls, x, y):
|
||||
pass
|
||||
@@ -1164,6 +1164,33 @@ def test_descriptor_class(app):
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
def test_autofunction_for_classes(app):
|
||||
actual = do_autodoc(app, 'function', 'target.classes.Foo')
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:function:: Foo()',
|
||||
' :module: target.classes',
|
||||
'',
|
||||
]
|
||||
|
||||
actual = do_autodoc(app, 'function', 'target.classes.Bar')
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:function:: Bar(x, y)',
|
||||
' :module: target.classes',
|
||||
'',
|
||||
]
|
||||
|
||||
actual = do_autodoc(app, 'function', 'target.classes.Baz')
|
||||
assert list(actual) == [
|
||||
'',
|
||||
'.. py:function:: Baz(x, y)',
|
||||
' :module: target.classes',
|
||||
'',
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-autodoc')
|
||||
def test_autofunction_for_callable(app):
|
||||
actual = do_autodoc(app, 'function', 'target.callable.function')
|
||||
|
||||
@@ -30,10 +30,10 @@ def test_signature():
|
||||
inspect.signature('')
|
||||
|
||||
# builitin classes
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(ValueError):
|
||||
inspect.signature(int)
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
with pytest.raises(ValueError):
|
||||
inspect.signature(str)
|
||||
|
||||
# normal function
|
||||
|
||||
Reference in New Issue
Block a user