Skip to content

Commit

Permalink
Tests: ignore several NaN warnings for new dtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Sep 12, 2024
1 parent d581b6f commit 517573a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ml_dtypes/tests/custom_float_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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__):
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 517573a

Please sign in to comment.