Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: ignore several NaN warnings for new dtypes #186

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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