Skip to content

Commit 5a311f3

Browse files
committed
Add tests
1 parent 050a6e6 commit 5a311f3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

numpydoc/docscrape_sphinx.py

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def _process_param(self, param, desc, fake_autosummary):
131131
relies on Sphinx's plugin mechanism.
132132
"""
133133
param = self._escape_args_and_kwargs(param.strip())
134+
# param = param.strip()
134135
# XXX: If changing the following, please check the rendering when param
135136
# ends with '_', e.g. 'word_'
136137
# See https://github.com/numpy/numpydoc/pull/144

numpydoc/tests/test_docscrape.py

+26
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,32 @@ class Dummy:
12261226
assert "test attribute" in str(doc)
12271227

12281228

1229+
def test_args_and_kwargs():
1230+
cfg = dict()
1231+
doc = SphinxDocString("""
1232+
Parameters
1233+
----------
1234+
param1 : int
1235+
First parameter
1236+
*args : tuple
1237+
Arguments
1238+
**kwargs : dict
1239+
Keyword arguments
1240+
""", config=cfg)
1241+
line_by_line_compare(str(doc), """
1242+
:Parameters:
1243+
1244+
**param1** : int
1245+
First parameter
1246+
1247+
**\*args** : tuple
1248+
Arguments
1249+
1250+
**\*\*kwargs** : dict
1251+
Keyword arguments
1252+
""")
1253+
1254+
12291255
if __name__ == "__main__":
12301256
import nose
12311257
nose.run()

0 commit comments

Comments
 (0)