tests/hamcrest_unit_test/number/iscloseto_test.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/hamcrest_unit_test/number/iscloseto_test.py b/tests/hamcrest_unit_test/number/iscloseto_test.py index f83964f..8fb7b46 100644 --- a/tests/hamcrest_unit_test/number/iscloseto_test.py +++ b/tests/hamcrest_unit_test/number/iscloseto_test.py @@ -57,12 +57,19 @@ try: import numpy as np NUMPY_AVAILABLE = True + NUMPY_AVAILABLE_OLDER_1_24 = ( + tuple(map(int, np.__version__.split(".", maxsplit=2)[:2])) < (1, 24) + ) except ImportError: NUMPY_AVAILABLE = False + NUMPY_AVAILABLE_OLDER_1_24 = False class IsNumericTest(unittest.TestCase): - @unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy") + @unittest.skipUnless( + NUMPY_AVAILABLE_OLDER_1_24, + "https://github.com/hamcrest/PyHamcrest/issues/228", + ) def test_numpy_numeric_type_int(self): self.assertTrue(isnumeric(np.int(1)), "Platform integer (normally either int32 or int64)") @@ -100,7 +107,10 @@ class IsNumericTest(unittest.TestCase): def test_numpy_numeric_type_uint64(self): self.assertTrue(isnumeric(np.uint64(1)), "Unsigned integer (0 to 18446744073709551615)") - @unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy") + @unittest.skipUnless( + NUMPY_AVAILABLE_OLDER_1_24, + "https://github.com/hamcrest/PyHamcrest/issues/228", + ) def test_numpy_numeric_type_float(self): self.assertTrue(isnumeric(np.float(1)), "Shorthand for float64.") @@ -125,7 +135,10 @@ class IsNumericTest(unittest.TestCase): "Double precision float: sign bit, 11 bits exponent, 52 bits mantissa", ) - @unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy") + @unittest.skipUnless( + NUMPY_AVAILABLE_OLDER_1_24, + "https://github.com/hamcrest/PyHamcrest/issues/228", + ) def test_numpy_numeric_type_complex(self): self.assertTrue(isnumeric(np.complex(1)), "Shorthand for complex128.")