MCPcopy Create free account
hub / github.com/numpy/numpy / test_floordiv

Function test_floordiv

numpy/polynomial/tests/test_classes.py:277–302  ·  view source on GitHub ↗
(Poly)

Source from the content-addressed store, hash-verified

275
276
277def test_floordiv(Poly):
278 c1 = list(random((4,)) + .5)
279 c2 = list(random((3,)) + .5)
280 c3 = list(random((2,)) + .5)
281 p1 = Poly(c1)
282 p2 = Poly(c2)
283 p3 = Poly(c3)
284 p4 = p1 * p2 + p3
285 c4 = list(p4.coef)
286 assert_poly_almost_equal(p4 // p2, p1)
287 assert_poly_almost_equal(p4 // c2, p1)
288 assert_poly_almost_equal(c4 // p2, p1)
289 assert_poly_almost_equal(p4 // tuple(c2), p1)
290 assert_poly_almost_equal(tuple(c4) // p2, p1)
291 assert_poly_almost_equal(p4 // np.array(c2), p1)
292 assert_poly_almost_equal(np.array(c4) // p2, p1)
293 assert_poly_almost_equal(2 // p2, Poly([0]))
294 assert_poly_almost_equal(p2 // 2, 0.5*p2)
295 assert_raises(
296 TypeError, op.floordiv, p1, Poly([0], domain=Poly.domain + 1))
297 assert_raises(
298 TypeError, op.floordiv, p1, Poly([0], window=Poly.window + 1))
299 if Poly is Polynomial:
300 assert_raises(TypeError, op.floordiv, p1, Chebyshev([0]))
301 else:
302 assert_raises(TypeError, op.floordiv, p1, Polynomial([0]))
303
304
305def test_truediv(Poly):

Callers

nothing calls this directly

Calls 5

assert_raisesFunction · 0.90
ChebyshevClass · 0.90
PolynomialClass · 0.90
PolyFunction · 0.85
assert_poly_almost_equalFunction · 0.85

Tested by

no test coverage detected