diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2021-12-05 16:30:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-05 16:30:05 -0700 |
commit | d14d2c359fcbd499b73d254f0c20dd1a884ff9a3 (patch) | |
tree | 81edd1df081824acf385c12acafae65c1c381a9e /numpy/f2py/tests/test_parameter.py | |
parent | 1bef412560293e67f9cf8c4e7b20a904c46ce41d (diff) | |
parent | 90e20e58eda7547678c6d2a4c121b0317de9c74d (diff) | |
download | numpy-d14d2c359fcbd499b73d254f0c20dd1a884ff9a3.tar.gz |
Merge pull request #20479 from HaoZeke/f2pyTestPath
TST,STY: Clean up F2PY tests for pathlib.Path
Diffstat (limited to 'numpy/f2py/tests/test_parameter.py')
-rw-r--r-- | numpy/f2py/tests/test_parameter.py | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/numpy/f2py/tests/test_parameter.py b/numpy/f2py/tests/test_parameter.py index b61827169..4ea102e84 100644 --- a/numpy/f2py/tests/test_parameter.py +++ b/numpy/f2py/tests/test_parameter.py @@ -7,17 +7,14 @@ from numpy.testing import assert_raises, assert_equal from . import util -def _path(*a): - return os.path.join(*((os.path.dirname(__file__),) + a)) - - class TestParameters(util.F2PyTest): # Check that intent(in out) translates as intent(inout) - 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'), - _path('src', 'parameter', 'constant_non_compound.f90'), + sources = [ + util.getpath("tests", "src", "parameter", "constant_real.f90"), + util.getpath("tests", "src", "parameter", "constant_integer.f90"), + util.getpath("tests", "src", "parameter", "constant_both.f90"), + util.getpath("tests", "src", "parameter", "constant_compound.f90"), + util.getpath("tests", "src", "parameter", "constant_non_compound.f90"), ] @pytest.mark.slow @@ -29,7 +26,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.float32) self.module.foo_single(x) - assert_equal(x, [0 + 1 + 2*3, 1, 2]) + assert_equal(x, [0 + 1 + 2 * 3, 1, 2]) @pytest.mark.slow def test_constant_real_double(self): @@ -40,7 +37,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.float64) self.module.foo_double(x) - assert_equal(x, [0 + 1 + 2*3, 1, 2]) + assert_equal(x, [0 + 1 + 2 * 3, 1, 2]) @pytest.mark.slow def test_constant_compound_int(self): @@ -51,14 +48,14 @@ class TestParameters(util.F2PyTest): # 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]) + assert_equal(x, [0 + 1 + 2 * 6, 1, 2]) @pytest.mark.slow def test_constant_non_compound_int(self): # check values x = np.arange(4, dtype=np.int32) self.module.foo_non_compound_int(x) - assert_equal(x, [0 + 1 + 2 + 3*4, 1, 2, 3]) + assert_equal(x, [0 + 1 + 2 + 3 * 4, 1, 2, 3]) @pytest.mark.slow def test_constant_integer_int(self): @@ -69,7 +66,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.int32) self.module.foo_int(x) - assert_equal(x, [0 + 1 + 2*3, 1, 2]) + assert_equal(x, [0 + 1 + 2 * 3, 1, 2]) @pytest.mark.slow def test_constant_integer_long(self): @@ -80,7 +77,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.int64) self.module.foo_long(x) - assert_equal(x, [0 + 1 + 2*3, 1, 2]) + assert_equal(x, [0 + 1 + 2 * 3, 1, 2]) @pytest.mark.slow def test_constant_both(self): @@ -91,7 +88,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.float64) self.module.foo(x) - assert_equal(x, [0 + 1*3*3 + 2*3*3, 1*3, 2*3]) + assert_equal(x, [0 + 1 * 3 * 3 + 2 * 3 * 3, 1 * 3, 2 * 3]) @pytest.mark.slow def test_constant_no(self): @@ -102,7 +99,7 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.float64) self.module.foo_no(x) - assert_equal(x, [0 + 1*3*3 + 2*3*3, 1*3, 2*3]) + assert_equal(x, [0 + 1 * 3 * 3 + 2 * 3 * 3, 1 * 3, 2 * 3]) @pytest.mark.slow def test_constant_sum(self): @@ -113,4 +110,4 @@ class TestParameters(util.F2PyTest): # check values with contiguous array x = np.arange(3, dtype=np.float64) self.module.foo_sum(x) - assert_equal(x, [0 + 1*3*3 + 2*3*3, 1*3, 2*3]) + assert_equal(x, [0 + 1 * 3 * 3 + 2 * 3 * 3, 1 * 3, 2 * 3]) |