增加环绕侦察场景适配

This commit is contained in:
2026-01-08 15:44:38 +08:00
parent 3eba1f962b
commit 10c5bb5a8a
5441 changed files with 40219 additions and 379695 deletions

View File

@@ -223,7 +223,7 @@ PyMODINIT_FUNC PyInit_test_array_from_pyobj_ext(void) {
on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call");
#endif
#if Py_GIL_DISABLED
#ifdef Py_GIL_DISABLED
// signal whether this module supports running with the GIL disabled
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
#endif

View File

@@ -147,9 +147,9 @@ _cast_dict['CHARACTER'] = ['CHARACTER']
# and several tests fail as the alignment flag can be randomly true or false
# when numpy gains an aligned allocator the tests could be enabled again
#
# Furthermore, on macOS ARM64, LONGDOUBLE is an alias for DOUBLE.
# Furthermore, on macOS ARM64 and AIX, LONGDOUBLE is an alias for DOUBLE.
if ((np.intp().dtype.itemsize != 4 or np.clongdouble().dtype.alignment <= 8)
and sys.platform != "win32"
and sys.platform not in ["win32", "aix"]
and (platform.system(), platform.processor()) != ("Darwin", "arm")):
_type_names.extend(["LONGDOUBLE", "CDOUBLE", "CLONGDOUBLE"])
_cast_dict["LONGDOUBLE"] = _cast_dict["LONG"] + [

View File

@@ -60,5 +60,7 @@ class TestDocAdvanced(util.F2PyTest):
ftype.data.x[1] = 45
assert_array_equal(ftype.data.x,
np.array([1, 45, 3], dtype=np.float32))
# gh-26718 Cleanup for repeated test runs
ftype.data.a = 0
# TODO: implement test methods for other example Fortran codes

View File

@@ -673,6 +673,25 @@ def test_inclheader(capfd, hello_world_f90, monkeypatch):
assert "#include <stdbool.h>" in ocmr
assert "#include <stdio.h>" in ocmr
@pytest.mark.skipif((platform.system() != 'Linux'), reason='Compiler required')
def test_cli_obj(capfd, hello_world_f90, monkeypatch):
"""Ensures that the extra object can be specified when using meson backend
"""
ipath = Path(hello_world_f90)
mname = "blah"
odir = "tttmp"
obj = "extra.o"
monkeypatch.setattr(sys, "argv",
f'f2py --backend meson --build-dir {odir} -m {mname} -c {obj} {ipath}'.split())
with util.switchdir(ipath.parent):
Path(obj).touch()
compiler_check_f2pycli()
with Path(f"{odir}/meson.build").open() as mesonbuild:
mbld = mesonbuild.read()
assert "objects:" in mbld
assert f"'''{obj}'''" in mbld
def test_inclpath():
"""Add to the include directories

View File

@@ -5,13 +5,12 @@ import pytest
from numpy.f2py.crackfortran import (
_selected_int_kind_func as selected_int_kind,
)
from numpy.f2py.crackfortran import (
_selected_real_kind_func as selected_real_kind,
)
from . import util
IS_PPC_OR_AIX = platform.machine().lower().startswith("ppc") or platform.system() == 'AIX'
class TestKind(util.F2PyTest):
sources = [util.getpath("tests", "src", "kind", "foo.f90")]
@@ -39,7 +38,7 @@ class TestKind(util.F2PyTest):
i
), f"selectedrealkind({i}): expected {selected_real_kind(i)!r} but got {selectedrealkind(i)!r}"
@pytest.mark.xfail(platform.machine().lower().startswith("ppc"),
@pytest.mark.xfail(IS_PPC_OR_AIX,
reason="Some PowerPC may not support full IEEE 754 precision")
def test_quad_precision(self):
"""

View File

@@ -158,7 +158,7 @@ def test_gh26623():
@pytest.mark.slow
@pytest.mark.skipif(platform.system() not in ['Linux', 'Darwin'], reason='Unsupported on this platform for now')
@pytest.mark.skipif(platform.system() == "Windows", reason='Unsupported on this platform for now')
def test_gh25784():
# Compile dubious file using passed flags
try:
@@ -167,7 +167,7 @@ def test_gh25784():
options=[
# Meson will collect and dedup these to pass to fortran_args:
"--f77flags='-ffixed-form -O2'",
"--f90flags=\"-ffixed-form -Og\"",
"--f90flags=\"-ffixed-form -g\"",
],
module_name="Blah",
)

View File

@@ -29,8 +29,8 @@ class TestReturnInteger(util.F2PyTest):
pytest.raises(IndexError, t, [])
pytest.raises(IndexError, t, ())
pytest.raises(Exception, t, t)
pytest.raises(Exception, t, {})
pytest.raises(TypeError, t, t)
pytest.raises(TypeError, t, {})
if tname in ["t8", "s8"]:
pytest.raises(OverflowError, t, 100000000000000000000000)

View File

@@ -39,8 +39,8 @@ class TestReturnReal(util.F2PyTest):
pytest.raises(IndexError, t, [])
pytest.raises(IndexError, t, ())
pytest.raises(Exception, t, t)
pytest.raises(Exception, t, {})
pytest.raises(TypeError, t, t)
pytest.raises(TypeError, t, {})
try:
r = t(10**400)

View File

@@ -493,3 +493,8 @@ class TestSymbolic(util.F2PyTest):
assert (y(x) + x).polynomial_atoms() == {y(x), x}
assert (y(x) * x[y]).polynomial_atoms() == {y(x), x[y]}
assert (y(x)**x).polynomial_atoms() == {y(x)}
def test_unmatched_parenthesis_gh30268(self):
#gh - 30268
with pytest.raises(ValueError, match=r"Mismatch of \(\) parenthesis"):
Expr.parse("DATA (A, I=1, N", language=Language.Fortran)