Skip to content

Commit 1a87f91

Browse files
Fix "object does not support item assignment" part 1 (#960)
Co-authored-by: Alexander-Makaryev <[email protected]>
1 parent 02ca580 commit 1a87f91

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/test_arithmetic.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ class TestArithmetic(unittest.TestCase):
77

88
@testing.for_float_dtypes()
99
@testing.numpy_cupy_allclose()
10-
def test_modf(self, xp, dtype):
10+
def test_modf_part1(self, xp, dtype):
1111
a = xp.array([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5], dtype=dtype)
12-
b, c = xp.modf(a)
12+
b, _ = xp.modf(a)
1313

14-
d = xp.empty(2 * a.size, dtype=dtype)
15-
for i in range(a.size):
16-
d[i] = b[i]
17-
d[i + a.size] = c[i]
14+
return b
1815

19-
return d
16+
@testing.for_float_dtypes()
17+
@testing.numpy_cupy_allclose()
18+
def test_modf_part2(self, xp, dtype):
19+
a = xp.array([-2.5, -1.5, -0.5, 0, 0.5, 1.5, 2.5], dtype=dtype)
20+
_, c = xp.modf(a)
21+
22+
return c
2023

2124
@testing.for_float_dtypes()
2225
@testing.numpy_cupy_allclose()

0 commit comments

Comments
 (0)