summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests/test_regression.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2021-06-19 18:03:04 +0200
committerRalf Gommers <ralf.gommers@gmail.com>2021-06-19 18:11:41 +0200
commitb42e4eec3c542e51f2da616913bad98f76328458 (patch)
treee8f2042c796c48a57966c41bafc87cd0f1f8f1c1 /numpy/f2py/tests/test_regression.py
parent7169c625bbdc019385f4e5f484684d690dfe02a1 (diff)
downloadnumpy-b42e4eec3c542e51f2da616913bad98f76328458.tar.gz
ENH: add `numpy.f2py.get_include` function
This is useful for similar reasons as `numpy.get_include`, see https://github.com/numpy/numpy/issues/14960#issuecomment-846460159
Diffstat (limited to 'numpy/f2py/tests/test_regression.py')
-rw-r--r--numpy/f2py/tests/test_regression.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/numpy/f2py/tests/test_regression.py b/numpy/f2py/tests/test_regression.py
index a1b772069..b91499e4a 100644
--- a/numpy/f2py/tests/test_regression.py
+++ b/numpy/f2py/tests/test_regression.py
@@ -25,23 +25,31 @@ class TestIntentInOut(util.F2PyTest):
x = np.arange(3, dtype=np.float32)
self.module.foo(x)
assert_equal(x, [3, 1, 2])
-
+
class TestNumpyVersionAttribute(util.F2PyTest):
# Check that th attribute __f2py_numpy_version__ is present
# in the compiled module and that has the value np.__version__.
sources = [_path('src', 'regression', 'inout.f90')]
-
+
@pytest.mark.slow
def test_numpy_version_attribute(self):
-
+
# Check that self.module has an attribute named "__f2py_numpy_version__"
- assert_(hasattr(self.module, "__f2py_numpy_version__"),
+ assert_(hasattr(self.module, "__f2py_numpy_version__"),
msg="Fortran module does not have __f2py_numpy_version__")
-
+
# Check that the attribute __f2py_numpy_version__ is a string
assert_(isinstance(self.module.__f2py_numpy_version__, str),
msg="__f2py_numpy_version__ is not a string")
-
+
# Check that __f2py_numpy_version__ has the value numpy.__version__
assert_string_equal(np.__version__, self.module.__f2py_numpy_version__)
+
+
+def test_include_path():
+ incdir = np.f2py.get_include()
+ fnames_in_dir = os.listdir(incdir)
+ for fname in ('fortranobject.c', 'fortranobject.h'):
+ assert fname in fnames_in_dir
+