|
2 | 2 | import pytest
|
3 | 3 |
|
4 | 4 | import numpy as np
|
| 5 | +import numpy.testing as npt |
5 | 6 |
|
6 | 7 | from . import util
|
7 | 8 |
|
@@ -76,3 +77,34 @@ def test_gh25344(self):
|
76 | 77 | exp = 7.0
|
77 | 78 | res = self.module.add(3.0, 4.0)
|
78 | 79 | assert exp == res
|
| 80 | + |
| 81 | +class TestF77Comments(util.F2PyTest): |
| 82 | + # Check that comments are stripped from F77 continuation lines |
| 83 | + sources = [util.getpath("tests", "src", "regression", "f77comments.f")] |
| 84 | + |
| 85 | + @pytest.mark.slow |
| 86 | + def test_gh26148(self): |
| 87 | + x1 = np.array(3, dtype=np.int32) |
| 88 | + x2 = np.array(5, dtype=np.int32) |
| 89 | + res=self.module.testsub(x1, x2) |
| 90 | + assert(res[0] == 8) |
| 91 | + assert(res[1] == 15) |
| 92 | + |
| 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 | + |
| 100 | +class TestF90Contiuation(util.F2PyTest): |
| 101 | + # Check that comments are stripped from F90 continuation lines |
| 102 | + sources = [util.getpath("tests", "src", "regression", "f90continuation.f90")] |
| 103 | + |
| 104 | + @pytest.mark.slow |
| 105 | + def test_gh26148b(self): |
| 106 | + x1 = np.array(3, dtype=np.int32) |
| 107 | + x2 = np.array(5, dtype=np.int32) |
| 108 | + res=self.module.testsub(x1, x2) |
| 109 | + assert(res[0] == 8) |
| 110 | + assert(res[1] == 15) |
0 commit comments