diff options
author | jutke <jutke@allstate.com> | 2017-01-20 09:55:13 -0600 |
---|---|---|
committer | jutke <jutke@allstate.com> | 2017-01-20 09:55:13 -0600 |
commit | 1e873ead0c0857f0bbdaab36764afa67cc39479e (patch) | |
tree | ad8a34961b940cdd59f6937d3c4f3cccd31782d7 /numpy/f2py/tests/test_parameter.py | |
parent | 892c54cda15163552fa2245b476aa765f2aa2061 (diff) | |
download | numpy-1e873ead0c0857f0bbdaab36764afa67cc39479e.tar.gz |
TST: adding tests for compound constant provided by @zerothi
This is a test code provided as a patch by @zerothi checking
the compound constant parsing.
Diffstat (limited to 'numpy/f2py/tests/test_parameter.py')
-rw-r--r-- | numpy/f2py/tests/test_parameter.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/f2py/tests/test_parameter.py b/numpy/f2py/tests/test_parameter.py index f0168b2d5..e7c6add51 100644 --- a/numpy/f2py/tests/test_parameter.py +++ b/numpy/f2py/tests/test_parameter.py @@ -18,6 +18,7 @@ class TestParameters(util.F2PyTest): sources = [_path('src', 'parameter', 'constant_real.f90'), _path('src', 'parameter', 'constant_integer.f90'), _path('src', 'parameter', 'constant_both.f90'), + _path('src', 'parameter', 'constant_compound.f90'), ] @dec.slow @@ -43,6 +44,17 @@ class TestParameters(util.F2PyTest): assert_equal(x, [0 + 1 + 2*3, 1, 2]) @dec.slow + def test_constant_compound_int(self): + # non-contiguous should raise error + x = np.arange(6, dtype=np.int32)[::2] + assert_raises(ValueError, self.module.foo_compound_int, x) + + # check values with contiguous array + x = np.arange(3, dtype=np.int32) + self.module.foo_compound_int(x) + assert_equal(x, [0 + 1 + 2*6, 1, 2]) + + @dec.slow def test_constant_integer_int(self): # non-contiguous should raise error x = np.arange(6, dtype=np.int32)[::2] |