Skip to content

Commit

Permalink
Update some test for better numpy > 2 compatability
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 677933336
Change-Id: I26449f885c8b507bbd812708ef0a623ef99dfb77
  • Loading branch information
laramiel authored and copybara-github committed Sep 23, 2024
1 parent dfb83cb commit c1658f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions python/tensorstore/tests/bfloat16_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,13 @@ def test_add():
assert math.isnan(float(bfloat16(3.5) + bfloat16(float("nan"))))

# Test type promotion against Numpy scalar values.
# See ml_dtypes.custom_float_test.py for comprehensive tests.
assert np.float32 == type(bfloat16(3.5) + np.float16(2.25))
assert np.float32 == type(np.float16(3.5) + bfloat16(2.25))
assert np.float32 == type(bfloat16(3.5) + np.float32(2.25))
assert np.float32 == type(np.float32(3.5) + bfloat16(2.25))
assert np.float64 == type(bfloat16(3.5) + np.float64(2.25))
assert np.float64 == type(np.float64(3.5) + bfloat16(2.25))
assert np.float64 == type(bfloat16(3.5) + float(2.25))
assert np.float64 == type(float(3.5) + bfloat16(2.25))
assert np.float32 == type(bfloat16(3.5) + np.array(2.25, np.float32))
assert np.float32 == type(np.array(3.5, np.float32) + bfloat16(2.25))

Expand Down
4 changes: 2 additions & 2 deletions python/tensorstore/tests/tensorstore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def test_array():

async def test_array_no_copy():
with pytest.raises(
ValueError, match=r"Unable to avoid copy while creating an array\."
ValueError, match=r"Unable to avoid copy while creating an array"
):
ts.array([1, 2, 3], copy=False)

Expand Down Expand Up @@ -157,7 +157,7 @@ async def test_array_no_write():

with pytest.raises(
ValueError,
match=r"Unable to avoid copy while creating an array from given array\.",
match=r"Unable to avoid copy while creating an array",
):
ts.array(x, write=True, copy=False)

Expand Down

0 comments on commit c1658f7

Please sign in to comment.