Skip to content

Commit

Permalink
Support numpy 2 in tests (#997)
Browse files Browse the repository at this point in the history
* Update tests for numpy 2

* Bump numpy in optional test requirements

* Skip tables (pytables) tests if ValueError on import

* Update changelog
  • Loading branch information
cbkerr authored Jul 31, 2024
1 parent 24035c6 commit 3da6261
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ The **signac** package follows `semantic versioning <https://semver.org/>`_.
Version 2
=========

[2.2.1] -- 2024-xx-xx
---------------------

Fixed
+++++

- Support for Numpy 2.0 in tests (#997).

[2.2.0] -- 2024-02-13
---------------------

Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-test-optional.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h5py==3.11.0; implementation_name=='cpython'
numpy==1.26.4
numpy==2.0.0
pandas==2.2.2; implementation_name=='cpython'
tables==3.9.2; implementation_name=='cpython' and platform_machine != "arm64" or platform_system != "Darwin"
8 changes: 5 additions & 3 deletions tests/test_h5store.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
PANDAS_AND_TABLES = True
except ImportError:
PANDAS_AND_TABLES = False
except ValueError:
PANDAS_AND_TABLES = False

try:
import numpy # noqa
Expand Down Expand Up @@ -147,9 +149,9 @@ class TestH5Store(TestH5StoreBase):
valid_types.update(
{
"numpy_int_array": numpy.array([-1, 0, 1], dtype=numpy.int_),
"numpy_float_array": numpy.array([-1.5, 0, 1.5], dtype=numpy.float_),
"numpy_float_array": numpy.array([-1.5, 0, 1.5], dtype=numpy.float64),
"numpy_complex_array": numpy.array(
[-1.5 + 3.14j, 0, 1.5 - 5.67j], dtype=numpy.complex_
[-1.5 + 3.14j, 0, 1.5 - 5.67j], dtype=numpy.complex128
),
# Note that NumPy's string type is handled kind of like a char
# array or bytes, not like Python str. numpy.unicode_ uses a
Expand All @@ -159,7 +161,7 @@ class TestH5Store(TestH5StoreBase):
b"abcde",
b"\x73\x69\x67\x6E\x61\x63\x00\xF0\x9F\x8E\xA8",
],
dtype=numpy.string_,
dtype=numpy.bytes_,
),
"numpy_void_array": numpy.array(
[
Expand Down

0 comments on commit 3da6261

Please sign in to comment.