10000 BUG: Fix `fortranname` for functions by HaoZeke · Pull Request #27731 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix fortranname for functions #27731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
TST: Add some for fortranname
Co-authored-by: KybernetikJo <KybernetikJo@users.noreply.github.com>
  • Loading branch information
HaoZeke and KybernetikJo committed Nov 11, 2024
commit 6934cbec472c9c401736ae1d2c4ba5a6fdfa8922
5 changes: 5 additions & 0 deletions numpy/f2py/tests/src/routines/funcfortranname.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
REAL*8 FUNCTION FUNCFORTRANNAME(A,B)
REAL*8 A, B
FUNCFORTRANNAME = A + B
RETURN
END FUNCTION
11 changes: 11 additions & 0 deletions numpy/f2py/tests/src/routines/funcfortranname.pyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
python module funcfortranname ! in
interface ! in :funcfortranname
function funcfortranname_default(a,b) ! in :funcfortranname:funcfortranname.f
fortranname funcfortranname
real*8 :: a
real*8 :: b
real*8 :: funcfortranname_default
real*8, intent(out) :: funcfortranname
end function funcfortranname_default
end interface
end python module funcfortranname
4 changes: 4 additions & 0 deletions numpy/f2py/tests/src/routines/subrout.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SUBROUTINE SUBROUT(A,B,C)
REAL*8 A, B, C
C = A + B
END SUBROUTINE
10 changes: 10 additions & 0 deletions numpy/f2py/tests/src/routines/subrout.pyf
D2E0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
python module subrout ! in
interface ! in :subrout
subroutine subrout_default(a,b,c) ! in :subrout:subrout.f
fortranname subrout
real*8 :: a
real*8 :: b
real*8, intent(out) :: c
end subroutine subrout_default
end interface
end python module subrout
28 changes: 28 additions & 0 deletions numpy/f2py/tests/test_routines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest
from . import util


@pytest.mark.slow
class TestRenamedFunc(util.F2PyTest):
sources = [
util.getpath("tests", "src", "routines", "funcfortranname.f"),
util.getpath("tests", "src", "routines", "funcfortranname.pyf"),
]
module_name = "funcfortranname"

def test_renamed_function(self):
assert dir(self.module)
assert self.module.funcfortranname_default(200, 12) == 212


@pytest.mark.slow
class TestRenamedSubroutine(util.F2PyTest):
sources = [
util.getpath("tests", "src", "routines", "subrout.f"),
util.getpath("tests", "src", "routines", "subrout.pyf"),
]
module_name = "subrout"

def test_renamed_subroutine(self):
assert dir(self.module)
assert self.module.subrout_default(200, 12) == 212
0