summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests
diff options
context:
space:
mode:
authorDamien Caliste <dcaliste@free.fr>2020-03-18 16:36:32 +0100
committerRohit Goswami <rog32@hi.is>2022-06-05 15:38:01 +0000
commit5108f78f3e0491ec4b0f284edce8e9fe7bb10e0e (patch)
treeba914dca86d984427c82689e15dd91575c2aaaf2 /numpy/f2py/tests
parente5fcb9d52c1b9d3c9caf067849ad1bba128c7e17 (diff)
downloadnumpy-5108f78f3e0491ec4b0f284edce8e9fe7bb10e0e.tar.gz
ENH: complete the 'vars' list of a module
Add to the 'vars' list of a module missing subroutines or functions listed in the 'body' that have not been explicitely declared 'public' or 'private'.
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r--numpy/f2py/tests/src/crackfortran/pubprivmod.f9010
-rw-r--r--numpy/f2py/tests/test_crackfortran.py9
2 files changed, 19 insertions, 0 deletions
diff --git a/numpy/f2py/tests/src/crackfortran/pubprivmod.f90 b/numpy/f2py/tests/src/crackfortran/pubprivmod.f90
new file mode 100644
index 000000000..46bef7cb9
--- /dev/null
+++ b/numpy/f2py/tests/src/crackfortran/pubprivmod.f90
@@ -0,0 +1,10 @@
+module foo
+ public
+ integer, private :: a
+ integer :: b
+contains
+ subroutine setA(v)
+ integer, intent(in) :: v
+ a = v
+ end subroutine setA
+end module foo
diff --git a/numpy/f2py/tests/test_crackfortran.py b/numpy/f2py/tests/test_crackfortran.py
index ea618bf33..5a83ee7da 100644
--- a/numpy/f2py/tests/test_crackfortran.py
+++ b/numpy/f2py/tests/test_crackfortran.py
@@ -73,6 +73,15 @@ class TestModuleProcedure():
assert mod["body"][3]["implementedby"] == \
["get_int", "get_real"]
+ def test_notPublicPrivate(self, tmp_path):
+ fpath = util.getpath("tests", "src", "crackfortran", "pubprivmod.f90")
+ mod = crackfortran.crackfortran([str(fpath)])
+ assert len(mod) == 1
+ mod = mod[0]
+ assert mod['vars']['a']['attrspec'] == ['private', ]
+ assert mod['vars']['b']['attrspec'] == ['public', ]
+ assert mod['vars']['seta']['attrspec'] == ['public', ]
+
class TestExternal(util.F2PyTest):
# issue gh-17859: add external attribute support