Skip to content

Commit fc39bd8

Browse files
committed
NumPy 2.1 support: Update numpy types
bool8, float_, and longfloat were removed in NumPy 2.1
1 parent e4a3fa4 commit fc39bd8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

hug/output_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def register_json_converter(function):
142142
def numpy_listable(item):
143143
return item.tolist()
144144

145-
@json_convert(str, numpy.unicode_)
145+
@json_convert(str, numpy.str_)
146146
def numpy_stringable(item):
147147
return str(item)
148148

tests/test_output_format.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def test_json_converter_numpy_types():
375375

376376
# Some type names are merely shorthands.
377377
# The following shorthands for built-in types are excluded: numpy.bool, numpy.int, numpy.float.
378-
np_bool_types = [numpy.bool_, numpy.bool8]
378+
np_bool_types = [numpy.bool_, numpy.bool_]
379379
np_int_types = [
380380
numpy.int_,
381381
numpy.byte,
@@ -398,14 +398,13 @@ def test_json_converter_numpy_types():
398398
numpy.ushort,
399399
]
400400
np_float_types = [
401-
numpy.float_,
402401
numpy.float32,
403402
numpy.float64,
404403
numpy.half,
405404
numpy.single,
406-
numpy.longfloat,
405+
numpy.longdouble,
407406
]
408-
np_unicode_types = [numpy.unicode_]
407+
np_unicode_types = [numpy.str_]
409408
np_bytes_types = [numpy.bytes_]
410409

411410
for np_type in np_bool_types:

0 commit comments

Comments
 (0)