summaryrefslogtreecommitdiff
path: root/numpy/f2py/tests/test_character.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py/tests/test_character.py')
-rw-r--r--numpy/f2py/tests/test_character.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/numpy/f2py/tests/test_character.py b/numpy/f2py/tests/test_character.py
index b54b4d981..0bb0f4290 100644
--- a/numpy/f2py/tests/test_character.py
+++ b/numpy/f2py/tests/test_character.py
@@ -457,9 +457,10 @@ class TestMiscCharacter(util.F2PyTest):
character(len=*), intent(in) :: x(:)
!f2py intent(out) x
integer :: i
- do i=1, size(x)
- print*, "x(",i,")=", x(i)
- end do
+ ! Uncomment for debug printing:
+ !do i=1, size(x)
+ ! print*, "x(",i,")=", x(i)
+ !end do
end subroutine {fprefix}_gh4519
pure function {fprefix}_gh3425(x) result (y)
@@ -568,3 +569,25 @@ class TestMiscCharacter(util.F2PyTest):
assert_equal(len(a), 2)
assert_raises(Exception, lambda: f(b'c'))
+
+
+class TestStringScalarArr(util.F2PyTest):
+ sources = [util.getpath("tests", "src", "string", "scalar_string.f90")]
+
+ @pytest.mark.slow
+ def test_char(self):
+ for out in (self.module.string_test.string,
+ self.module.string_test.string77):
+ expected = ()
+ assert out.shape == expected
+ expected = '|S8'
+ assert out.dtype == expected
+
+ @pytest.mark.slow
+ def test_char_arr(self):
+ for out in (self.module.string_test.strarr,
+ self.module.string_test.strarr77):
+ expected = (5,7)
+ assert out.shape == expected
+ expected = '|S12'
+ assert out.dtype == expected