Skip to content

Commit d18c703

Browse files
committed
MAINT: Refactor tests a bit
1 parent a60de40 commit d18c703

File tree

9 files changed

+36
-40
lines changed

9 files changed

+36
-40
lines changed

.gitattributes

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ numpy/version.py linguist-generated
5454
# F2py
5555
./doc/source/f2py/*.pyf text
5656
./doc/source/f2py/*.dat text
57-
./numpy/f2py/tests/src/module_data/mod.mod binary
5857

5958
# Documents
6059
*.md text diff=markdown

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ GTAGS
4141
*.o.d
4242
*.py[ocd]
4343
*.so
44+
*.mod
4445

4546
# Packages #
4647
############
-412 Bytes
Binary file not shown.

numpy/f2py/tests/test_module_doc.py

-28
This file was deleted.

numpy/f2py/tests/test_modules.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pytest
2+
import textwrap
3+
4+
from . import util
5+
from numpy.testing import IS_PYPY
6+
7+
8+
@pytest.mark.slow
9+
class TestModuleDocString(util.F2PyTest):
10+
sources = [util.getpath("tests", "src", "modules", "module_data_docstring.f90")]
11+
12+
@pytest.mark.xfail(IS_PYPY, reason="PyPy cannot modify tp_doc after PyType_Ready")
13+
def test_module_docstring(self):
14+
assert self.module.mod.__doc__ == textwrap.dedent(
15+
"""\
16+
i : 'i'-scalar
17+
x : 'i'-array(4)
18+
a : 'f'-array(2,3)
19+
b : 'f'-array(-1,-1), not allocated\x00
20+
foo()\n
21+
Wrapper for ``foo``.\n\n"""
22+
)
23+
24+
25+
@pytest.mark.slow
26+
class TestModuleAndSubroutine(util.F2PyTest):
27+
module_name = "example"
28+
sources = [
29+
util.getpath("tests", "src", "modules", "gh25337", "data.f90"),
30+
util.getpath("tests", "src", "modules", "gh25337", "use_data.f90"),
31+
]
32+
33+
def test_gh25337(self):
34+
self.module.data.set_shift(3)
35+
assert "data" in dir(self.module)

numpy/f2py/tests/test_regression.py

-11
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,6 @@ def test_include_path():
6666
assert fname in fnames_in_dir
6767

6868

69-
class TestModuleAndSubroutine(util.F2PyTest):
70-
module_name = "example"
71-
sources = [util.getpath("tests", "src", "regression", "gh25337", "data.f90"),
72-
util.getpath("tests", "src", "regression", "gh25337", "use_data.f90")]
73-
74-
@pytest.mark.slow
75-
def test_gh25337(self):
76-
self.module.data.set_shift(3)
77-
assert "data" in dir(self.module)
78-
79-
8069
class TestIncludeFiles(util.F2PyTest):
8170
sources = [util.getpath("tests", "src", "regression", "incfile.f90")]
8271
options = [f"-I{util.getpath('tests', 'src', 'regression')}",

0 commit comments

Comments
 (0)