Skip to content

Commit 0888577

Browse files
committed
TST: Add one for numpygh-26466
Closes numpygh-26466 Since that is also related to comment parsing in F77
1 parent 53e64c3 commit 0888577

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

numpy/f2py/tests/src/regression/f77comments.f

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ SUBROUTINE TESTSUB(
1111

1212
RETURN
1313
END SUBROUTINE TESTSUB
14+
15+
SUBROUTINE TESTSUB2(OUTPUT)
16+
IMPLICIT NONE
17+
INTEGER, PARAMETER :: N = 10 ! Array dimension
18+
REAL, INTENT(OUT) :: OUTPUT(N)
19+
INTEGER :: I
20+
21+
DO I = 1, N
22+
OUTPUT(I) = I * 2.0
23+
END DO
24+
25+
RETURN
26+
END

numpy/f2py/tests/test_regression.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33

44
import numpy as np
5+
import numpy.testing as npt
56

67
from . import util
78

@@ -89,6 +90,13 @@ def test_gh26148(self):
8990
assert(res[0] == 8)
9091
assert(res[1] == 15)
9192

93+
@pytest.mark.slow
94+
def test_gh26466(self):
95+
# Check that comments after PARAMETER directions are stripped
96+
expected = np.arange(1, 11, dtype=np.float32)*2
97+
res=self.module.testsub2()
98+
npt.assert_allclose(expected, res)
99+
92100
class TestF90Contiuation(util.F2PyTest):
93101
# Check that comments are stripped from F90 continuation lines
94102
sources = [util.getpath("tests", "src", "regression", "f90continuation.f90")]

0 commit comments

Comments
 (0)