summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests
diff options
context:
space:
mode:
authorbobeldering <eldering@jive.eu>2018-03-04 21:09:46 +0100
committerCharles Harris <charlesr.harris@gmail.com>2018-03-04 13:09:46 -0700
commita016167e0a44ace62a246e3d251bd41ff4aa0282 (patch)
tree92f57c4068bce544ca95b64e4e57bea1ea5fbdcb /numpy/f2py/tests
parent2d44de214d63c5fc610392d1e18fa93615b12c1a (diff)
downloadnumpy-a016167e0a44ace62a246e3d251bd41ff4aa0282.tar.gz
BUG: F2py mishandles quoted control characters (#10676)
* BUG: improve parsing of quoted control characters in numpy.f2py. See #10634. Fixes a couple of cases where quoted control characters are parsed as if they are unquoted. The control characters considered are "()!;". * TST: quoted characters parsing by numpy.f2py. Basic test of parsing quoted Fortran control characters. See #10634. * BUG: add missing space character when reconstructing fortran line. The missing space caused a line starting with "!f2py" to be considered a continuation line.
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r--numpy/f2py/tests/test_quoted_character.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/numpy/f2py/tests/test_quoted_character.py b/numpy/f2py/tests/test_quoted_character.py
new file mode 100644
index 000000000..4770c11c4
--- /dev/null
+++ b/numpy/f2py/tests/test_quoted_character.py
@@ -0,0 +1,32 @@
+from __future__ import division, absolute_import, print_function
+
+from . import util
+
+from numpy.testing import run_module_suite, assert_equal, dec
+
+import sys
+
+class TestQuotedCharacter(util.F2PyTest):
+ code = """
+ SUBROUTINE FOO(OUT1, OUT2, OUT3, OUT4, OUT5, OUT6)
+ CHARACTER SINGLE, DOUBLE, SEMICOL, EXCLA, OPENPAR, CLOSEPAR
+ PARAMETER (SINGLE="'", DOUBLE='"', SEMICOL=';', EXCLA="!",
+ 1 OPENPAR="(", CLOSEPAR=")")
+ CHARACTER OUT1, OUT2, OUT3, OUT4, OUT5, OUT6
+Cf2py intent(out) OUT1, OUT2, OUT3, OUT4, OUT5, OUT6
+ OUT1 = SINGLE
+ OUT2 = DOUBLE
+ OUT3 = SEMICOL
+ OUT4 = EXCLA
+ OUT5 = OPENPAR
+ OUT6 = CLOSEPAR
+ RETURN
+ END
+ """
+
+ @dec.knownfailureif(sys.platform=='win32', msg='Fails with MinGW64 Gfortran (Issue #9673)')
+ def test_quoted_character(self):
+ assert_equal(self.module.foo(), (b"'", b'"', b';', b'!', b'(', b')'))
+
+if __name__ == "__main__":
+ run_module_suite()