From bfcb92f6fdb9c8b9ba03c02f0b8e4ca50d2b7612 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 21 Jan 2017 15:50:41 +0900 Subject: [PATCH] Fix #3285: autosummary: asterisks are escaped twice --- CHANGES | 1 + sphinx/ext/autosummary/__init__.py | 1 - tests/roots/test-autosummary/dummy_module.py | 2 +- tests/test_ext_autosummary.py | 8 ++++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index da787c7f7..2b73f00ef 100644 --- a/CHANGES +++ b/CHANGES @@ -51,6 +51,7 @@ Bugs fixed * Inline math in parsed-literal is not rendered well by LaTeX (ref #3340) * #3308: Parsed-literals don't wrap very long lines with pdf builder (ref #3340) * #3295: Could not import extension sphinx.builders.linkcheck +* #3285: autosummary: asterisks are escaped twice Release 1.5.1 (released Dec 13, 2016) diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index ce87444dd..382b749f1 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -302,7 +302,6 @@ class Autosummary(Directive): else: max_chars = max(10, max_item_chars - len(display_name)) sig = mangle_signature(sig, max_chars=max_chars) - sig = sig.replace('*', r'\*') # -- Grab the summary diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-autosummary/dummy_module.py index 1f4a47378..d24d7604f 100644 --- a/tests/roots/test-autosummary/dummy_module.py +++ b/tests/roots/test-autosummary/dummy_module.py @@ -71,5 +71,5 @@ class C: ''' -def func(arg_): +def func(arg_, *args, **kwargs): """Test function take an argument ended with underscore.""" diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py index 84c73d632..f53b7c2c5 100644 --- a/tests/test_ext_autosummary.py +++ b/tests/test_ext_autosummary.py @@ -95,3 +95,11 @@ def test_get_items_summary(app, status, warning): for key, expected in iteritems(expected_values): assert autosummary_items[key][2] == expected, 'Summary for %s was %r -'\ ' expected %r' % (key, autosummary_items[key], expected) + + # check an item in detail + assert 'func' in autosummary_items + func_attrs = ('func', + '(arg_, *args, **kwargs)', + 'Test function take an argument ended with underscore.', + 'dummy_module.func') + assert autosummary_items['func'] == func_attrs