Skip to content

Commit 6934cbe

Browse files
HaoZekeKybernetikJo
andcommitted
TST: Add some for fortranname
Co-authored-by: KybernetikJo <[email protected]>
1 parent 7c0e2e4 commit 6934cbe

File tree

5 files changed

+58
-0
lines changed

5 files changed

+58
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REAL*8 FUNCTION FUNCFORTRANNAME(A,B)
2+
REAL*8 A, B
3+
FUNCFORTRANNAME = A + B
4+
RETURN
5+
END FUNCTION
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
python module funcfortranname ! in
2+
interface ! in :funcfortranname
3+
function funcfortranname_default(a,b) ! in :funcfortranname:funcfortranname.f
4+
fortranname funcfortranname
5+
real*8 :: a
6+
real*8 :: b
7+
real*8 :: funcfortranname_default
8+
real*8, intent(out) :: funcfortranname
9+
end function funcfortranname_default
10+
end interface
11+
end python module funcfortranname
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SUBROUTINE SUBROUT(A,B,C)
2+
REAL*8 A, B, C
3+
C = A + B
4+
END SUBROUTINE
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
python module subrout ! in
2+
interface ! in :subrout
3+
subroutine subrout_default(a,b,c) ! in :subrout:subrout.f
4+
fortranname subrout
5+
real*8 :: a
6+
real*8 :: b
7+
real*8, intent(out) :: c
8+
end subroutine subrout_default
9+
end interface
10+
end python module subrout

numpy/f2py/tests/test_routines.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from . import util
3+
4+
5+
@pytest.mark.slow
6+
class TestRenamedFunc(util.F2PyTest):
7+
sources = [
8+
util.getpath("tests", "src", "routines", "funcfortranname.f"),
9+
util.getpath("tests", "src", "routines", "funcfortranname.pyf"),
10+
]
11+
module_name = "funcfortranname"
12+
13+
def test_renamed_function(self):
14+
assert dir(self.module)
15+
assert self.module.funcfortranname_default(200, 12) == 212
16+
17+
18+
@pytest.mark.slow
19+
class TestRenamedSubroutine(util.F2PyTest):
20+
sources = [
21+
util.getpath("tests", "src", "routines", "subrout.f"),
22+
util.getpath("tests", "src", "routines", "subrout.pyf"),
23+
]
24+
module_name = "subrout"
25+
26+
def test_renamed_subroutine(self):
27+
assert dir(self.module)
28+
assert self.module.subrout_default(200, 12) == 212

0 commit comments

Comments
 (0)