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

Function test_conversion

numpy/polynomial/tests/test_classes.py:56–70  ·  view source on GitHub ↗
(Poly1, Poly2)

Source from the content-addressed store, hash-verified

54
55
56def test_conversion(Poly1, Poly2):
57 x = np.linspace(0, 1, 10)
58 coef = random((3,))
59
60 d1 = Poly1.domain + random((2,))*.25
61 w1 = Poly1.window + random((2,))*.25
62 p1 = Poly1(coef, domain=d1, window=w1)
63
64 d2 = Poly2.domain + random((2,))*.25
65 w2 = Poly2.window + random((2,))*.25
66 p2 = p1.convert(kind=Poly2, domain=d2, window=w2)
67
68 assert_almost_equal(p2.domain, d2)
69 assert_almost_equal(p2.window, w2)
70 assert_almost_equal(p2(x), p1(x))
71
72
73def test_cast(Poly1, Poly2):

Callers

nothing calls this directly

Calls 3

assert_almost_equalFunction · 0.90
linspaceMethod · 0.80
convertMethod · 0.80

Tested by

no test coverage detected