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

Method test_Fraction

numpy/polynomial/tests/test_polynomial.py:136–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

134class TestFraction:
135
136 def test_Fraction(self):
137 # assert we can use Polynomials with coefficients of object dtype
138 f = Fraction(2, 3)
139 one = Fraction(1, 1)
140 zero = Fraction(0, 1)
141 p = poly.Polynomial([f, f], domain=[zero, one], window=[zero, one])
142
143 x = 2 * p + p ** 2
144 assert_equal(x.coef, np.array([Fraction(16, 9), Fraction(20, 9),
145 Fraction(4, 9)], dtype=object))
146 assert_equal(p.domain, [zero, one])
147 assert_equal(p.coef.dtype, np.dtypes.ObjectDType())
148 assert_(isinstance(p(f), Fraction))
149 assert_equal(p(f), Fraction(10, 9))
150 p_deriv = poly.Polynomial([Fraction(2, 3)], domain=[zero, one],
151 window=[zero, one])
152 assert_equal(p.deriv(), p_deriv)
153
154class TestEvaluation:
155 # coefficients of 1 + 2*x + 3*x**2

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
assert_Function · 0.90
derivMethod · 0.45

Tested by

no test coverage detected