- {impl: c, python: "3.11", ext: numpy, postgres: "postgres:15"}
# Test with minimum dependencies versions
+ # WARNING: when bumping min version, make sure that the dependencies
+ # # in tests/constraints.txt are updated and that binary packages
+ # are available for such version.
- {impl: c, python: "3.8", ext: min, postgres: "postgres:15"}
# Test memory alignment
adapters.register_dumper("numpy.int32", NPInt32Dumper)
adapters.register_dumper("numpy.int64", NPInt64Dumper)
adapters.register_dumper("numpy.longlong", NPInt64Dumper)
+ adapters.register_dumper("numpy.bool", BoolDumper)
adapters.register_dumper("numpy.bool_", BoolDumper)
adapters.register_dumper("numpy.uint8", NPInt16Dumper)
adapters.register_dumper("numpy.uint16", NPInt32Dumper)
adapters.register_dumper("numpy.int32", NPInt32BinaryDumper)
adapters.register_dumper("numpy.int64", NPInt64BinaryDumper)
adapters.register_dumper("numpy.longlong", NPInt64BinaryDumper)
+ adapters.register_dumper("numpy.bool", BoolBinaryDumper)
adapters.register_dumper("numpy.bool_", BoolBinaryDumper)
adapters.register_dumper("numpy.uint8", NPInt16BinaryDumper)
adapters.register_dumper("numpy.uint16", NPInt32BinaryDumper)
tomli == 2.0.1
# Undeclared extras to "unblock" extra features
+
shapely == 1.7.0
+# Warning: binary package only available up to python < 3.9.
+# Bump to a higher version when min supported python version increases past it.
+numpy == 1.20.0
rv = set()
for cls in dumpers.keys():
if isinstance(cls, str):
+ if cls == "numpy.bool":
+ # An alias of numpy.bool_ for numpy > 2.
+ # Raises a warning in numpy > 1.20.
+ continue
try:
cls = deep_import(cls)
except ImportError:
from math import isnan
import pytest
+from packaging.version import parse as ver # noqa: F401 # used in skipif
+
from psycopg.adapt import PyFormat
from psycopg.pq import Format
pytestmark = [pytest.mark.numpy]
+skip_numpy2 = pytest.mark.skipif(
+ "ver(np.__version__) >= ver('2.0.0')", reason="not available since numpy >= 2"
+)
+
def test_classes_identities():
# Check if we know the class identities correctly. Maybe on different
"name, equiv",
[
("inf", "inf"),
- ("infty", "inf"),
- ("NINF", "-inf"),
+ pytest.param("infty", "inf", marks=skip_numpy2),
+ pytest.param("NINF", "-inf", marks=skip_numpy2),
("nan", "nan"),
- ("NaN", "nan"),
- ("NAN", "nan"),
- ("PZERO", "0.0"),
- ("NZERO", "-0.0"),
+ pytest.param("NaN", "nan", marks=skip_numpy2),
+ pytest.param("NAN", "nan", marks=skip_numpy2),
+ pytest.param("PZERO", "0.0", marks=skip_numpy2),
+ pytest.param("NZERO", "-0.0", marks=skip_numpy2),
],
)
def test_special_values(name, equiv):