diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2007-05-18 16:44:43 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2007-05-18 16:44:43 +0000 |
commit | 0683bce893de37d134fe94cb6a19bc90c3ab26e7 (patch) | |
tree | fc931a36f21e79abdeb8aea1c02798bcec1402ef /numpy/f2py/lib/tests/test_module_module.py | |
parent | b3caec68294618d217bdb26872b3c9d235c6ade6 (diff) | |
download | numpy-0683bce893de37d134fe94cb6a19bc90c3ab26e7.tar.gz |
g3 f2py: impl. compiling Fortran codes online (function numpy.f2py.lib.compile), clean up testing.
Diffstat (limited to 'numpy/f2py/lib/tests/test_module_module.py')
-rw-r--r-- | numpy/f2py/lib/tests/test_module_module.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/numpy/f2py/lib/tests/test_module_module.py b/numpy/f2py/lib/tests/test_module_module.py new file mode 100644 index 000000000..4d242ed54 --- /dev/null +++ b/numpy/f2py/lib/tests/test_module_module.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +""" +Tests for module with scalar derived types and subprograms. + +----- +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. See http://scipy.org. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +Author: Pearu Peterson <pearu@cens.ioc.ee> +Created: Oct 2006 +----- +""" + +import os +import sys +from numpy.testing import * + +set_package_path() +from lib.main import build_extension, compile +restore_path() + +fortran_code = ''' +module test_module_module_ext2 + type rat + integer n,d + end type rat + contains + subroutine foo2() + print*,"In foo2" + end subroutine foo2 +end module +module test_module_module_ext + contains + subroutine foo + use test_module_module_ext2 + print*,"In foo" + call foo2 + end subroutine foo + subroutine bar(a) + use test_module_module_ext2 + type(rat) a + print*,"In bar,a=",a + end subroutine bar +end module test_module_module_ext +''' + +m,m2 = compile(fortran_code, modulenames=['test_module_module_ext', + 'test_module_module_ext2', + ]) + +from numpy import * + +class test_m(NumpyTestCase): + + def check_foo_simple(self, level=1): + foo = m.foo + foo() + +if __name__ == "__main__": + NumpyTest().run() |