From bf71a62b52dedd8ceaa47a96c144a3584e1bd95b Mon Sep 17 00:00:00 2001 From: MelissaWM Date: Wed, 23 Sep 2020 23:09:46 -0300 Subject: BUG: Fixes module data docstrings. Fixes gh-15325 --- numpy/f2py/tests/test_module_doc.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 numpy/f2py/tests/test_module_doc.py (limited to 'numpy/f2py/tests/test_module_doc.py') diff --git a/numpy/f2py/tests/test_module_doc.py b/numpy/f2py/tests/test_module_doc.py new file mode 100644 index 000000000..f597929ad --- /dev/null +++ b/numpy/f2py/tests/test_module_doc.py @@ -0,0 +1,16 @@ +import os +from . import util + +from numpy.testing import assert_equal + + +def _path(*a): + return os.path.join(*((os.path.dirname(__file__),) + a)) + + +class TestModuleDocString(util.F2PyTest): + sources = [_path('src', 'module_data', 'module_data_docstring.f90')] + + def test_module_docstring(self): + expected = "i : 'i'-scalar\nx : 'i'-array(4)\na : 'f'-array(2,3)\nb : 'f'-array(-1,-1), not allocated\x00\nfoo()\n\nWrapper for ``foo``.\n\n" + assert_equal(self.module.mod.__doc__, expected) -- cgit v1.2.1 From 16e8c26b86f29cb18470fccc57d95c942c30f642 Mon Sep 17 00:00:00 2001 From: MelissaWM Date: Thu, 24 Sep 2020 15:25:15 -0300 Subject: Fixing tests for pypy and win. --- numpy/f2py/tests/test_module_doc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'numpy/f2py/tests/test_module_doc.py') diff --git a/numpy/f2py/tests/test_module_doc.py b/numpy/f2py/tests/test_module_doc.py index f597929ad..9360b04a9 100644 --- a/numpy/f2py/tests/test_module_doc.py +++ b/numpy/f2py/tests/test_module_doc.py @@ -1,7 +1,9 @@ import os -from . import util +import sys +import pytest -from numpy.testing import assert_equal +from . import util +from numpy.testing import assert_equal, IS_PYPY def _path(*a): @@ -11,6 +13,10 @@ def _path(*a): class TestModuleDocString(util.F2PyTest): sources = [_path('src', 'module_data', 'module_data_docstring.f90')] + @pytest.mark.skipif(sys.platform=='win32', + reason='Fails with MinGW64 Gfortran (Issue #9673)') + @pytest.mark.xfail(IS_PYPY, + reason="PyPy cannot modify tp_doc after PyType_Ready") def test_module_docstring(self): expected = "i : 'i'-scalar\nx : 'i'-array(4)\na : 'f'-array(2,3)\nb : 'f'-array(-1,-1), not allocated\x00\nfoo()\n\nWrapper for ``foo``.\n\n" assert_equal(self.module.mod.__doc__, expected) -- cgit v1.2.1 From d267252186be8cfe1f4c7bc743d4b4523620bb42 Mon Sep 17 00:00:00 2001 From: MelissaWM Date: Sat, 26 Sep 2020 14:12:09 -0300 Subject: Added textwrap.dedent to test. --- numpy/f2py/tests/test_module_doc.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'numpy/f2py/tests/test_module_doc.py') diff --git a/numpy/f2py/tests/test_module_doc.py b/numpy/f2py/tests/test_module_doc.py index 9360b04a9..4b9555cee 100644 --- a/numpy/f2py/tests/test_module_doc.py +++ b/numpy/f2py/tests/test_module_doc.py @@ -1,6 +1,7 @@ import os import sys import pytest +import textwrap from . import util from numpy.testing import assert_equal, IS_PYPY @@ -18,5 +19,12 @@ class TestModuleDocString(util.F2PyTest): @pytest.mark.xfail(IS_PYPY, reason="PyPy cannot modify tp_doc after PyType_Ready") def test_module_docstring(self): - expected = "i : 'i'-scalar\nx : 'i'-array(4)\na : 'f'-array(2,3)\nb : 'f'-array(-1,-1), not allocated\x00\nfoo()\n\nWrapper for ``foo``.\n\n" - assert_equal(self.module.mod.__doc__, expected) + assert_equal(self.module.mod.__doc__, + textwrap.dedent('''\ + i : 'i'-scalar + x : 'i'-array(4) + a : 'f'-array(2,3) + b : 'f'-array(-1,-1), not allocated\x00 + foo()\n + Wrapper for ``foo``.\n\n''') + ) -- cgit v1.2.1