summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests
diff options
context:
space:
mode:
authorDamien Caliste <dcaliste@free.fr>2020-03-27 14:35:42 +0100
committerDamien Caliste <dcaliste@free.fr>2021-10-01 16:13:22 +0200
commitf2eccaac3d08c71eb936e18b4f6a5a656b2763d6 (patch)
tree48ad5c8680b4e31e3c83225d386247d221882008 /numpy/f2py/tests
parentacb0e9eb57674288ef18bf39908026bc4f42c4a4 (diff)
downloadnumpy-f2eccaac3d08c71eb936e18b4f6a5a656b2763d6.tar.gz
BUG: avoid infinite recurrence on dependencies in crackfortran
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r--numpy/f2py/tests/test_crackfortran.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/f2py/tests/test_crackfortran.py b/numpy/f2py/tests/test_crackfortran.py
index b1503c1e0..039e085b4 100644
--- a/numpy/f2py/tests/test_crackfortran.py
+++ b/numpy/f2py/tests/test_crackfortran.py
@@ -264,3 +264,20 @@ class TestDimSpec(util.F2PyTest):
# the same sized array
sz1, _ = get_arr_size(n1)
assert sz == sz1, (n, n1, sz, sz1)
+
+
+class TestModuleDeclaration():
+ def test_dependencies(self, tmp_path):
+ f_path = tmp_path / "mod.f90"
+ with f_path.open('w') as ff:
+ ff.write(textwrap.dedent("""\
+ module foo
+ type bar
+ character(len = 4) :: text
+ end type bar
+ type(bar), parameter :: abar = bar('abar')
+ end module foo
+ """))
+ mod = crackfortran.crackfortran([str(f_path)])
+ assert len(mod) == 1
+ assert mod[0]['vars']['abar']['='] == "bar('abar')"