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

Method test_objects

numpy/lib/tests/test_polynomial.py:210–223  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

208 assert_almost_equal(np.sqrt(cov.mean()), 0.25)
209
210 def test_objects(self):
211 from decimal import Decimal
212 p = np.poly1d([Decimal('4.0'), Decimal('3.0'), Decimal('2.0')])
213 p2 = p * Decimal('1.333333333333333')
214 assert_(p2[1] == Decimal("3.9999999999999990"))
215 p2 = p.deriv()
216 assert_(p2[1] == Decimal('8.0'))
217 p2 = p.integ()
218 assert_(p2[3] == Decimal("1.333333333333333333333333333"))
219 assert_(p2[2] == Decimal('1.5'))
220 assert_(np.issubdtype(p2.coeffs.dtype, np.object_))
221 p = np.poly([Decimal(1), Decimal(2)])
222 assert_equal(np.poly([Decimal(1), Decimal(2)]),
223 [1, Decimal(-3), Decimal(2)])
224
225 def test_complex(self):
226 p = np.poly1d([3j, 2j, 1j])

Callers

nothing calls this directly

Calls 4

assert_Function · 0.90
assert_equalFunction · 0.90
derivMethod · 0.45
integMethod · 0.45

Tested by

no test coverage detected