MCPcopy Index your code
hub / github.com/RustPython/RustPython / testCos

Method testCos

Lib/test/test_math.py:478–490  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

476 self.assertEqual(abs(math.copysign(2., NAN)), 2.)
477
478 def testCos(self):
479 self.assertRaises(TypeError, math.cos)
480 self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0, abs_tol=math.ulp(1))
481 self.ftest('cos(0)', math.cos(0), 1)
482 self.ftest('cos(pi/2)', math.cos(math.pi/2), 0, abs_tol=math.ulp(1))
483 self.ftest('cos(pi)', math.cos(math.pi), -1)
484 try:
485 self.assertTrue(math.isnan(math.cos(INF)))
486 self.assertTrue(math.isnan(math.cos(NINF)))
487 except ValueError:
488 self.assertRaises(ValueError, math.cos, INF)
489 self.assertRaises(ValueError, math.cos, NINF)
490 self.assertTrue(math.isnan(math.cos(NAN)))
491
492 @unittest.skipIf(sys.platform == 'win32' and platform.machine() in ('ARM', 'ARM64'),
493 "Windows UCRT is off by 2 ULP this test requires accuracy within 1 ULP")

Callers

nothing calls this directly

Calls 3

ftestMethod · 0.95
assertTrueMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected