From 517573ac4a58604c0757e9f721dc4aca8c4775a1 Mon Sep 17 00:00:00 2001 From: Jake VanderPlas Date: Thu, 12 Sep 2024 11:53:39 -0700 Subject: [PATCH] Tests: ignore several NaN warnings for new dtypes --- ml_dtypes/tests/custom_float_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ml_dtypes/tests/custom_float_test.py b/ml_dtypes/tests/custom_float_test.py index 36c5d8a4..a69c09a4 100644 --- a/ml_dtypes/tests/custom_float_test.py +++ b/ml_dtypes/tests/custom_float_test.py @@ -238,6 +238,7 @@ class CustomFloatTest(parameterized.TestCase): def testModuleName(self, float_type): self.assertEqual(float_type.__module__, "ml_dtypes") + @ignore_warning(category=RuntimeWarning, message="invalid value encountered") def testPickleable(self, float_type): # https://github.com/google/jax/discussions/8505 x = np.arange(10, dtype=float_type) @@ -869,6 +870,7 @@ def testBinaryUfunc(self, float_type): float_type=float_type, ) + @ignore_warning(category=RuntimeWarning, message="invalid value encountered") def testBinaryPredicateUfunc(self, float_type): for op in BINARY_PREDICATE_UFUNCS: with self.subTest(op.__name__): @@ -894,6 +896,7 @@ def testPredicateUfunc(self, float_type): vals = vals.astype(float_type) np.testing.assert_equal(op(vals), op(vals.astype(np.float32))) + @ignore_warning(category=RuntimeWarning, message="invalid value encountered") def testDivmod(self, float_type): rng = np.random.RandomState(seed=42) x = rng.randn(3, 7).astype(float_type) @@ -959,6 +962,7 @@ def testFloordivCornerCases(self, float_type): float_type=float_type, ) + @ignore_warning(category=RuntimeWarning, message="invalid value encountered") def testModf(self, float_type): rng = np.random.RandomState(seed=42) x = rng.randn(3, 7).astype(float_type) @@ -991,6 +995,7 @@ def testLdexp(self, float_type): float_type=float_type, ) + @ignore_warning(category=RuntimeWarning, message="invalid value encountered") def testFrexp(self, float_type): rng = np.random.RandomState(seed=42) x = rng.randn(3, 7).astype(float_type)