Skip to content

Commit

Permalink
add test_coerced_usm_types_floor_divide
Browse files Browse the repository at this point in the history
  • Loading branch information
vtavana committed Aug 23, 2023
1 parent aac66a6 commit 2a07141
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_usm_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ def test_coerced_usm_types_remainder(usm_type_x, usm_type_y):
y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
y = y.T + 1

z = 100 % y
z = y % 7
z = x % y

# inplace remainder
Expand All @@ -94,6 +96,27 @@ def test_coerced_usm_types_remainder(usm_type_x, usm_type_y):
assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])


@pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
@pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
def test_coerced_usm_types_floor_divide(usm_type_x, usm_type_y):
x = dp.arange(100, usm_type=usm_type_x).reshape(10, 10)
y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
x = x + 1.5
y = y.T + 0.5

z = 3.4 // y
z = y // 2.7
z = x // y

# inplace floor_divide
z //= y
z //= 2.5

assert x.usm_type == usm_type_x
assert y.usm_type == usm_type_y
assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])


@pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
@pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
def test_coerced_usm_types_power(usm_type_x, usm_type_y):
Expand Down

0 comments on commit 2a07141

Please sign in to comment.