elastic/elasticsearch-py

Test failures against NumPy 2.0.0rc1

mgorny opened this issue · 0 comments

Elasticsearch version (bin/elasticsearch --version):
n/a

elasticsearch-py version (elasticsearch.__versionstr__):
8.13.1, tested with main @ f32878e as well

Please make sure the major version matches the Elasticsearch server you are running.

Description of the problem including expected versus actual behavior:
When using NumPy 2.0.0rc1, some of the tests fail:

======================================================= short test summary info =======================================================
FAILED test_elasticsearch/test_serializer.py::test_serializes_numpy_bool[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_numpy_floats[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_numpy_floats[OrjsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_numpy_datetime[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_numpy_ndarray[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_series[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_series[OrjsonSerializer] - elastic_transport.SerializationError: Unable to serialize to JSON: {'d': 0    a
1    b
2    c
3    d
dtype: object} (type: dict)
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_na[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_na[OrjsonSerializer] - elastic_transport.SerializationError: Unable to serialize to JSON: {'d': <NA>} (type: dict)
FAILED test_elasticsearch/test_serializer.py::test_raises_serialization_error_pandas_nat[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_category[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
FAILED test_elasticsearch/test_serializer.py::test_serializes_pandas_category[OrjsonSerializer] - elastic_transport.SerializationError: Unable to serialize to JSON: {'d': ['a', 'c', 'b', 'a']
Categories (3, object): ['a', 'b', 'c']} (type: dict)
FAILED test_elasticsearch/test_serializer.py::test_json_raises_serialization_error_on_dump_error[JsonSerializer] - AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
====================================== 13 failed, 245 passed, 140 skipped, 30 warnings in 8.74s =======================================

Full log with tracebacks (200k): test-log.txt

Steps to reproduce:

nox -s test-3.11
. .nox/test-3-11/bin/activate
pip install -U --pre numpy
python -m pytest