(Poly)
| 303 | |
| 304 | |
| 305 | def test_truediv(Poly): |
| 306 | # true division is valid only if the denominator is a Number and |
| 307 | # not a python bool. |
| 308 | p1 = Poly([1,2,3]) |
| 309 | p2 = p1 * 5 |
| 310 | |
| 311 | for stype in np.ScalarType: |
| 312 | if not issubclass(stype, Number) or issubclass(stype, bool): |
| 313 | continue |
| 314 | s = stype(5) |
| 315 | assert_poly_almost_equal(op.truediv(p2, s), p1) |
| 316 | assert_raises(TypeError, op.truediv, s, p2) |
| 317 | for stype in (int, float): |
| 318 | s = stype(5) |
| 319 | assert_poly_almost_equal(op.truediv(p2, s), p1) |
| 320 | assert_raises(TypeError, op.truediv, s, p2) |
| 321 | for stype in [complex]: |
| 322 | s = stype(5, 0) |
| 323 | assert_poly_almost_equal(op.truediv(p2, s), p1) |
| 324 | assert_raises(TypeError, op.truediv, s, p2) |
| 325 | for s in [tuple(), list(), dict(), bool(), np.array([1])]: |
| 326 | assert_raises(TypeError, op.truediv, p2, s) |
| 327 | assert_raises(TypeError, op.truediv, s, p2) |
| 328 | for ptype in classes: |
| 329 | assert_raises(TypeError, op.truediv, p2, ptype(1)) |
| 330 | |
| 331 | |
| 332 | def test_mod(Poly): |
nothing calls this directly
no test coverage detected