Package: python-hug

Version: 2.6.0-7

Severity: normal

Tags: patch





Dear Maintainer,



I will submit a patch to fix this error-- 
https://ci.debian.net/packages/p/python-hug/unstable/amd64/

Debian Continuous Integration - 
python-hug/unstable/amd64<https://ci.debian.net/packages/p/python-hug/unstable/amd64/>
Debian Continuous Integration Results
ci.debian.net


tests/test_output_format.py:379:

AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?

As you may know, `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated 
NumPy 1.24)
And in numpy version higher than 2.0, np.bool8 has been removed. So the case 
has always failed due to the installed numpy version by default is 2.2.4.

I added if clause to tell the numpy version. Please see the patch.



Thanks for your reply!



Yours sincerely,

xiaozhan


From b929866d189b975e78249c40c175aefc9f5bf96d Mon Sep 17 00:00:00 2001
From: Xiaozhan Li <xiaozhan.li...@windriver.com>
Date: Wed, 16 Apr 2025 08:28:29 +0000
Subject: [PATCH] Remove not supported bool type for new numpy version

"np.bool8" is a deprecated alias for "np.bool_" since NumPy 1.24
and "np.bool8" has been removed since Numpy 2.x version. So I added
if clause to tell currently installed Numpy version.

Signed-off-by: Xiaozhan Li <xiaozhan.li...@windriver.com>
---
 tests/test_output_format.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/test_output_format.py b/tests/test_output_format.py
index b28e05a..7af00ba 100644
--- a/tests/test_output_format.py
+++ b/tests/test_output_format.py
@@ -375,7 +375,10 @@ def test_json_converter_numpy_types():
 
     # Some type names are merely shorthands.
     # The following shorthands for built-in types are excluded: numpy.bool, numpy.int, numpy.float.
-    np_bool_types = [numpy.bool_, numpy.bool8]
+    if '1.24' <= numpy.__version__ < '2':
+        np_bool_types = [numpy.bool_, numpy.bool8]
+    if numpy.__version__ >= '2':
+        np_bool_types = [numpy.bool_]
     np_int_types = [
         numpy.int_,
         numpy.byte,
-- 
2.47.1

Reply via email to