summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_utils.py
diff options
context:
space:
mode:
authorEric Larson <larson.eric.d@gmail.com>2020-05-22 12:36:33 -0400
committerEric Larson <larson.eric.d@gmail.com>2020-05-22 12:45:51 -0400
commitccc2427f8f3d5d7605c822b6143cfbc8058c0f3c (patch)
treedfc1b4e82e0ad632a0e87b3f3dd1a6565cf43e2c /numpy/lib/tests/test_utils.py
parent78593a1059f0a9c04385f97b2c1caa221efefa5f (diff)
downloadnumpy-ccc2427f8f3d5d7605c822b6143cfbc8058c0f3c.tar.gz
BUG: Indentation for docstrings
Diffstat (limited to 'numpy/lib/tests/test_utils.py')
-rw-r--r--numpy/lib/tests/test_utils.py20
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):