diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2020-05-23 07:35:57 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-23 07:35:57 -0600 |
commit | a699f2879ab3836fe6d1619c518c85956a3075c1 (patch) | |
tree | 587a19c249ebb31a255ab243e056f698264ccbf8 /numpy/lib/tests/test_utils.py | |
parent | 471a2ceaf3f0b77ca63003b196e8ba8c54283806 (diff) | |
parent | ccc2427f8f3d5d7605c822b6143cfbc8058c0f3c (diff) | |
download | numpy-a699f2879ab3836fe6d1619c518c85956a3075c1.tar.gz |
Merge pull request #16349 from larsoner/dep
BUG: Indentation for docstrings
Diffstat (limited to 'numpy/lib/tests/test_utils.py')
-rw-r--r-- | numpy/lib/tests/test_utils.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py index c96bf795a..261cfef5d 100644 --- a/numpy/lib/tests/test_utils.py +++ b/numpy/lib/tests/test_utils.py @@ -49,7 +49,7 @@ def old_func5(self, x): Bizarre indentation. """ return x -new_func5 = deprecate(old_func5) +new_func5 = deprecate(old_func5, message="This function is\ndeprecated.") def old_func6(self, x): @@ -74,10 +74,20 @@ def test_deprecate_fn(): @pytest.mark.skipif(sys.flags.optimize == 2, reason="-OO discards docstrings") -def test_deprecate_help_indentation(): - _compare_docs(old_func4, new_func4) - _compare_docs(old_func5, new_func5) - _compare_docs(old_func6, new_func6) +@pytest.mark.parametrize('old_func, new_func', [ + (old_func4, new_func4), + (old_func5, new_func5), + (old_func6, new_func6), +]) +def test_deprecate_help_indentation(old_func, new_func): + _compare_docs(old_func, new_func) + # Ensure we don't mess up the indentation + for knd, func in (('old', old_func), ('new', new_func)): + for li, line in enumerate(func.__doc__.split('\n')): + if li == 0: + assert line.startswith(' ') or not line.startswith(' '), knd + elif line: + assert line.startswith(' '), knd def _compare_docs(old_func, new_func): |