MCPcopy Index your code
hub / github.com/numpy/numpy / test_floordiv

Function test_floordiv

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

Source from the content-addressed store, hash-verified

281
282
283def test_floordiv(Poly):
284 c1 = list(random((4,)) + .5)
285 c2 = list(random((3,)) + .5)
286 c3 = list(random((2,)) + .5)
287 p1 = Poly(c1)
288 p2 = Poly(c2)
289 p3 = Poly(c3)
290 p4 = p1 * p2 + p3
291 c4 = list(p4.coef)
292 assert_poly_almost_equal(p4 // p2, p1)
293 assert_poly_almost_equal(p4 // c2, p1)
294 assert_poly_almost_equal(c4 // p2, p1)
295 assert_poly_almost_equal(p4 // tuple(c2), p1)
296 assert_poly_almost_equal(tuple(c4) // p2, p1)
297 assert_poly_almost_equal(p4 // np.array(c2), p1)
298 assert_poly_almost_equal(np.array(c4) // p2, p1)
299 assert_poly_almost_equal(2 // p2, Poly([0]))
300 assert_poly_almost_equal(p2 // 2, 0.5 * p2)
301 assert_raises(
302 TypeError, op.floordiv, p1, Poly([0], domain=Poly.domain + 1))
303 assert_raises(
304 TypeError, op.floordiv, p1, Poly([0], window=Poly.window + 1))
305 if Poly is Polynomial:
306 assert_raises(TypeError, op.floordiv, p1, Chebyshev([0]))
307 else:
308 assert_raises(TypeError, op.floordiv, p1, Polynomial([0]))
309
310
311def 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…