Skip to content

Commit

Permalink
add a test for sphinxext + autoforwards
Browse files Browse the repository at this point in the history
  • Loading branch information
epsy committed Jul 14, 2022
1 parent ab8a136 commit 7dc09c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sigtools/tests/sphinxextfixt.py
Expand Up @@ -9,7 +9,7 @@ class AClass(object):
class_attr = True
"""class attr doc"""

def __init__(self):
def __init__(self): # pragma: no cover
self.abc = 123
"""instance attr doc"""

Expand All @@ -26,3 +26,7 @@ def kwo(a, b, c=1, d=2):
@specifiers.forwards_to(inner)
def outer(c, *args, **kwargs):
raise NotImplementedError


def autoforwards(d, *args, **kwargs):
return inner(*args, **kwargs) # pragma: no cover
6 changes: 6 additions & 0 deletions sigtools/tests/test_sphinxext.py
Expand Up @@ -56,6 +56,12 @@ def test_modifiers(self):
sphinxextfixt.AClass.outer, {}, '(a, b, c=1, d=2)', None)
self.assertEqual(('(a, b, *, c=1, d=2)', ''), r)

def test_autoforward(self):
r = self.sphinxext.process_signature(
app, 'function', 'sigtools.tests.sphinxextfixt.autoforwards',
sphinxextfixt.autoforwards, {}, '(d, *args, **kwargs)', None)
self.assertEqual(('(d, a, b)', ''), r)

def test_attribute(self):
r = self.sphinxext.process_signature(
app, 'attribute', 'sigtools.tests.sphinxextfixt.AClass.class_attr',
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist=test-{py39,py310}, pyflakes
envlist=test-{py39,py310},cover-py310-all,pyflakes
skipsdist=true

[testenv]
Expand Down

0 comments on commit 7dc09c1

Please sign in to comment.