summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-xnumpy/f2py/crackfortran.py3
-rw-r--r--numpy/f2py/tests/test_crackfortran.py39
2 files changed, 41 insertions, 1 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 2aaf5d7c6..2db4a47e8 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -558,7 +558,8 @@ groupbegins90 = groupbegins77 + \
r'|module(?!\s*procedure)|python\s*module|interface|type(?!\s*\()'
beginpattern90 = re.compile(
beforethisafter % ('', groupbegins90, groupbegins90, '.*'), re.I), 'begin'
-groupends = r'end|endprogram|endblockdata|endmodule|endpythonmodule|endinterface'
+groupends = (r'end|endprogram|endblockdata|endmodule|endpythonmodule|'
+ r'endinterface|endsubroutine|endfunction')
endpattern = re.compile(
beforethisafter % ('', groupends, groupends, r'[\w\s]*'), re.I), 'end'
# endifs='end\s*(if|do|where|select|while|forall)'
diff --git a/numpy/f2py/tests/test_crackfortran.py b/numpy/f2py/tests/test_crackfortran.py
new file mode 100644
index 000000000..8af1b4d80
--- /dev/null
+++ b/numpy/f2py/tests/test_crackfortran.py
@@ -0,0 +1,39 @@
+from __future__ import division, absolute_import, print_function
+
+import pytest
+
+import numpy as np
+from numpy.testing import assert_array_equal
+from . import util
+
+
+class TestNoSpace(util.F2PyTest):
+ code = """
+ subroutine subb(k)
+ real(8), intent(inout) :: k(:)
+ k=k+1
+ endsubroutine
+
+ subroutine subc(w,k)
+ real(8), intent(in) :: w(:)
+ real(8), intent(out) :: k(size(w))
+ k=w+1
+ endsubroutine
+
+ function t0(value)
+ character value
+ character t0
+ t0 = value
+ endfunction
+
+ """
+
+ def test_module(self):
+ k = np.array([1, 2, 3], dtype = np.float)
+ w = np.array([1, 2, 3], dtype = np.float)
+ self.module.subb(k)
+ assert_array_equal(k, w + 1)
+ self.module.subc([w, k])
+ assert_array_equal(k, w + 1)
+ assert self.module.t0(23) == b'2'
+