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

Function test_cast

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

Source from the content-addressed store, hash-verified

71
72
73def test_cast(Poly1, Poly2):
74 x = np.linspace(0, 1, 10)
75 coef = random((3,))
76
77 d1 = Poly1.domain + random((2,))*.25
78 w1 = Poly1.window + random((2,))*.25
79 p1 = Poly1(coef, domain=d1, window=w1)
80
81 d2 = Poly2.domain + random((2,))*.25
82 w2 = Poly2.window + random((2,))*.25
83 p2 = Poly2.cast(p1, domain=d2, window=w2)
84
85 assert_almost_equal(p2.domain, d2)
86 assert_almost_equal(p2.window, w2)
87 assert_almost_equal(p2(x), p1(x))
88
89
90#

Callers

nothing calls this directly

Calls 3

assert_almost_equalFunction · 0.90
linspaceMethod · 0.80
castMethod · 0.45

Tested by

no test coverage detected