diff options
| author | Keewis <keewis@posteo.de> | 2020-08-05 19:22:43 +0200 |
|---|---|---|
| committer | Keewis <keewis@posteo.de> | 2020-08-05 19:22:43 +0200 |
| commit | 849d3c18a7498fd72faa29064a0c813ed457a6af (patch) | |
| tree | bb89a1c553b2a6c1a5ea9ae1833819f0c71f0379 /tests/test_ext_napoleon_docstring.py | |
| parent | e79cd79cd2d1e46d57fd6b941bd6348eb53bdb17 (diff) | |
| download | sphinx-git-849d3c18a7498fd72faa29064a0c813ed457a6af.tar.gz | |
remove the syntax checks from the escape method and update the tests
Diffstat (limited to 'tests/test_ext_napoleon_docstring.py')
| -rw-r--r-- | tests/test_ext_napoleon_docstring.py | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py index 6421e5fa2..23935925b 100644 --- a/tests/test_ext_napoleon_docstring.py +++ b/tests/test_ext_napoleon_docstring.py @@ -2238,28 +2238,15 @@ class TestNumpyDocstring: _token_type(token) @pytest.mark.parametrize( - ["spec", "pattern"], + ("name", "expected"), ( - pytest.param("*args, *kwargs", ".+: can only combine parameters of form", id="two args"), - pytest.param("**args, **kwargs", ".+: can only combine parameters of form", id="two kwargs"), - pytest.param( - "*args, **kwargs, other_parameter", - ".+: cannot combine .+ and .+ with more parameters", - id="more parameters", - ), - pytest.param("**kwargs, *args", r".+: wrong order of .+ and .+", id="swapped parameters"), - ) + ("x, y, z", "x, y, z"), + ("*args, **kwargs", r"\*args, \*\*kwargs"), + ("*x, **y", r"\*x, \*\*y"), + ), ) - def test_invalid_combined_args_and_kwargs(self, spec, pattern, app, warning): - docstring = dedent( - """\ - Parameters - ---------- - {} - variable args list and arbitrary keyword arguments - """ - ).format(spec) - config = Config() + def test_escape_args_and_kwargs(self, name, expected): + numpy_docstring = NumpyDocstring("") + actual = numpy_docstring._escape_args_and_kwargs(name) - with warns(warning, match=pattern): - str(NumpyDocstring(docstring, config, app, "method")) + assert actual == expected |
