MCPcopy Index your code
hub / github.com/python/cpython / testCos

Method testCos

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

Source from the content-addressed store, hash-verified

458 self.assertTrue(math.signbit(-arg))
459
460 def testCos(self):
461 self.assertRaises(TypeError, math.cos)
462 self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0, abs_tol=math.ulp(1))
463 self.ftest('cos(0)', math.cos(0), 1)
464 self.ftest('cos(pi/2)', math.cos(math.pi/2), 0, abs_tol=math.ulp(1))
465 self.ftest('cos(pi)', math.cos(math.pi), -1)
466 try:
467 self.assertTrue(math.isnan(math.cos(INF)))
468 self.assertTrue(math.isnan(math.cos(NINF)))
469 except ValueError:
470 self.assertRaises(ValueError, math.cos, INF)
471 self.assertRaises(ValueError, math.cos, NINF)
472 self.assertTrue(math.isnan(math.cos(NAN)))
473
474 @unittest.skipIf(sys.platform == 'win32' and platform.machine() in ('ARM', 'ARM64'),
475 "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