Skip to content

Commit 2a07141

Browse files
committed
add test_coerced_usm_types_floor_divide
1 parent aac66a6 commit 2a07141

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_usm_type.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def test_coerced_usm_types_remainder(usm_type_x, usm_type_y):
8383
y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
8484
y = y.T + 1
8585

86+
z = 100 % y
87+
z = y % 7
8688
z = x % y
8789

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

9698

99+
@pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
100+
@pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
101+
def test_coerced_usm_types_floor_divide(usm_type_x, usm_type_y):
102+
x = dp.arange(100, usm_type=usm_type_x).reshape(10, 10)
103+
y = dp.arange(100, usm_type=usm_type_y).reshape(10, 10)
104+
x = x + 1.5
105+
y = y.T + 0.5
106+
107+
z = 3.4 // y
108+
z = y // 2.7
109+
z = x // y
110+
111+
# inplace floor_divide
112+
z //= y
113+
z //= 2.5
114+
115+
assert x.usm_type == usm_type_x
116+
assert y.usm_type == usm_type_y
117+
assert z.usm_type == du.get_coerced_usm_type([usm_type_x, usm_type_y])
118+
119+
97120
@pytest.mark.parametrize("usm_type_x", list_of_usm_types, ids=list_of_usm_types)
98121
@pytest.mark.parametrize("usm_type_y", list_of_usm_types, ids=list_of_usm_types)
99122
def test_coerced_usm_types_power(usm_type_x, usm_type_y):

0 commit comments

Comments
 (0)