summaryrefslogtreecommitdiff
path: root/tests/test_autodoc.py
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa@gmail.com>2014-07-02 00:09:11 +0900
committerTakayuki Shimizukawa <shimizukawa@gmail.com>2014-07-02 00:09:11 +0900
commitb3aa4aa81bb7311136587c134f805b86d2435fb3 (patch)
tree450eb165bfe808e19d5f8bbd08918a56e493bb3d /tests/test_autodoc.py
parentf781f55b28662cf759f06cda48f7b48a6c0c70e6 (diff)
downloadsphinx-git-b3aa4aa81bb7311136587c134f805b86d2435fb3.tar.gz
* In autodoc, fix display of parameter defaults containing backslashes. Closes #1502
Diffstat (limited to 'tests/test_autodoc.py')
-rw-r--r--tests/test_autodoc.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_autodoc.py b/tests/test_autodoc.py
index 0be694f38..a7b2cee0d 100644
--- a/tests/test_autodoc.py
+++ b/tests/test_autodoc.py
@@ -163,10 +163,13 @@ def test_format_signature():
# test for functions
def f(a, b, c=1, **d):
pass
+ def g(a='\n'):
+ pass
assert formatsig('function', 'f', f, None, None) == '(a, b, c=1, **d)'
assert formatsig('function', 'f', f, 'a, b, c, d', None) == '(a, b, c, d)'
assert formatsig('function', 'f', f, None, 'None') == \
'(a, b, c=1, **d) -> None'
+ assert formatsig('function', 'g', g, None, None) == r"(a='\\n')"
# test for classes
class D:
@@ -206,9 +209,12 @@ def test_format_signature():
pass
def foo2(b, *c):
pass
+ def foo3(self, d='\n'):
+ pass
assert formatsig('method', 'H.foo', H.foo1, None, None) == '(b, *c)'
assert formatsig('method', 'H.foo', H.foo1, 'a', None) == '(a)'
assert formatsig('method', 'H.foo', H.foo2, None, None) == '(b, *c)'
+ assert formatsig('method', 'H.foo', H.foo3, None, None) == r"(d='\\n')"
# test exception handling (exception is caught and args is '')
assert formatsig('function', 'int', int, None, None) == ''