(Poly)
| 214 | |
| 215 | |
| 216 | def test_add(Poly): |
| 217 | # This checks commutation, not numerical correctness |
| 218 | c1 = list(random((4,)) + .5) |
| 219 | c2 = list(random((3,)) + .5) |
| 220 | p1 = Poly(c1) |
| 221 | p2 = Poly(c2) |
| 222 | p3 = p1 + p2 |
| 223 | assert_poly_almost_equal(p2 + p1, p3) |
| 224 | assert_poly_almost_equal(p1 + c2, p3) |
| 225 | assert_poly_almost_equal(c2 + p1, p3) |
| 226 | assert_poly_almost_equal(p1 + tuple(c2), p3) |
| 227 | assert_poly_almost_equal(tuple(c2) + p1, p3) |
| 228 | assert_poly_almost_equal(p1 + np.array(c2), p3) |
| 229 | assert_poly_almost_equal(np.array(c2) + p1, p3) |
| 230 | assert_raises(TypeError, op.add, p1, Poly([0], domain=Poly.domain + 1)) |
| 231 | assert_raises(TypeError, op.add, p1, Poly([0], window=Poly.window + 1)) |
| 232 | if Poly is Polynomial: |
| 233 | assert_raises(TypeError, op.add, p1, Chebyshev([0])) |
| 234 | else: |
| 235 | assert_raises(TypeError, op.add, p1, Polynomial([0])) |
| 236 | |
| 237 | |
| 238 | def test_sub(Poly): |
nothing calls this directly
no test coverage detected
searching dependent graphs…