summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorJonathan Waltman <jonathan.waltman@gmail.com>2013-01-09 08:37:53 -0600
committerJonathan Waltman <jonathan.waltman@gmail.com>2013-01-09 08:37:53 -0600
commitbba6104b84f04e6988a99a90cb817bbc1161efde (patch)
treeec57973523a2b0e870899a6d154901c5ae48d760 /tests/test_autodoc.py
parent69b74303b8575f71b917c78e8d2f2fe6ddab464d (diff)
downloadsphinx-git-bba6104b84f04e6988a99a90cb817bbc1161efde.tar.gz
Issue #1069: Add failing test for signature formatting of "partial" functions without kwargs.
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index a93bd7186..7a1d6d7f0 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -182,6 +182,20 @@ def test_format_signature():
# test processing by event handler
assert formatsig('method', 'bar', H.foo1, None, None) == '42'
+ # test functions created via functools.partial
+ from functools import partial
+ curried1 = partial(lambda a, b, c: None, 'A')
+ assert formatsig('function', 'curried1', curried1, None, None) == \
+ '(b, c)'
+ curried2 = partial(lambda a, b, c=42: None, 'A')
+ assert formatsig('function', 'curried2', curried2, None, None) == \
+ '(b, c=42)'
+ curried3 = partial(lambda a, b, *c: None, 'A')
+ assert formatsig('function', 'curried3', curried3, None, None) == \
+ '(b, *c)'
+ curried4 = partial(lambda a, b, c=42, *d, **e: None, 'A')
+ assert formatsig('function', 'curried4', curried4, None, None) == \
+ '(b, c=42, *d, **e)'
def test_get_doc():
def getdocl(objtype, obj, encoding=None):