def test_poly1d_numpy_poly1d_variable(self, xp, dtype): array = testing.shaped_arange((5, ), numpy, dtype) a = numpy.poly1d(array, variable='z') with cupyx.allow_synchronize(False): out = xp.poly1d(a, variable=self.variable) assert out.variable == (self.variable or 'z') return out
def test_poly1d_zero_size(self, xp, dtype): a = testing.shaped_arange((0, ), xp, dtype) with cupyx.allow_synchronize(False): out = xp.poly1d(a, variable=self.variable) assert out.variable == (self.variable or 'x') return out
def test_poly1d_list(self, xp): with cupyx.allow_synchronize(False): out = xp.poly1d([1, 2, 3, 4], variable=self.variable) assert out.variable == (self.variable or 'x') return out
def test_poly1d_setitem_leading_zeros(self, xp, dtype): a = xp.array([0, 0, 0, 2, 3, 0], dtype) b = xp.poly1d(a) with cupyx.allow_synchronize(False): b[1] = 10 return b
def test_poly1d_numpy_array(self, xp, dtype): a = numpy.arange(5, dtype=dtype) with cupyx.allow_synchronize(False): out = xp.poly1d(a, variable=self.variable) assert out.variable == (self.variable or 'x') return out
def test_poly1d_setitem(self, xp, dtype): a = testing.shaped_arange((10, ), xp, dtype) b = xp.poly1d(a) with cupyx.allow_synchronize(False): b[100] = 20 return b
def test_poly1d_getitem4(self, xp, dtype): a = xp.array([0, 0, 1, 2, 3, 0], dtype) with cupyx.allow_synchronize(False): return xp.poly1d(a)[2]
def test_poly1d_getitem3(self, xp, dtype): a = testing.shaped_arange((10, ), xp, dtype) with cupyx.allow_synchronize(False): return xp.poly1d(a)[100]
def test_disallowed(self): a = cupy.array([2, 3]) with cupyx.allow_synchronize(False): with pytest.raises(cupyx.DeviceSynchronized): a.get()
def test_nested_allowed(self): a = cupy.array([2, 3]) with cupyx.allow_synchronize(False): with cupyx.allow_synchronize(True): a.get()