diff options
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): |