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

Method test_objects

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

Source from the content-addressed store, hash-verified

238 assert_almost_equal(np.sqrt(cov.mean()), 0.25)
239
240 def test_objects(self):
241 from decimal import Decimal
242 p = np.poly1d([Decimal('4.0'), Decimal('3.0'), Decimal('2.0')])
243 p2 = p * Decimal('1.333333333333333')
244 assert_(p2[1] == Decimal("3.9999999999999990"))
245 p2 = p.deriv()
246 assert_(p2[1] == Decimal('8.0'))
247 p2 = p.integ()
248 assert_(p2[3] == Decimal("1.333333333333333333333333333"))
249 assert_(p2[2] == Decimal('1.5'))
250 assert_(np.issubdtype(p2.coeffs.dtype, np.object_))
251 p = np.poly([Decimal(1), Decimal(2)])
252 assert_equal(np.poly([Decimal(1), Decimal(2)]),
253 [1, Decimal(-3), Decimal(2)])
254
255 def test_complex(self):
256 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