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

Method test_precision

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

Source from the content-addressed store, hash-verified

470 self.assertIs(text.format(), text)
471
472 def test_precision(self):
473 f = 1.2
474 self.assertEqual(format(f, ".0f"), "1")
475 self.assertEqual(format(f, ".3f"), "1.200")
476 with self.assertRaises(ValueError) as cm:
477 format(f, ".%sf" % (sys.maxsize + 1))
478
479 c = complex(f)
480 self.assertEqual(format(c, ".0f"), "1+0j")
481 self.assertEqual(format(c, ".3f"), "1.200+0.000j")
482 with self.assertRaises(ValueError) as cm:
483 format(c, ".%sf" % (sys.maxsize + 1))
484
485 @support.cpython_only
486 def test_precision_c_limits(self):

Callers

nothing calls this directly

Calls 3

formatFunction · 0.50
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected