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

Method test_g_format_has_no_trailing_zeros

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

Source from the content-addressed store, hash-verified

650 format(c, ".%sf" % (INT_MAX + 1))
651
652 def test_g_format_has_no_trailing_zeros(self):
653 # regression test for bugs.python.org/issue40780
654 self.assertEqual("%.3g" % 1505.0, "1.5e+03")
655 self.assertEqual("%#.3g" % 1505.0, "1.50e+03")
656
657 self.assertEqual(format(1505.0, ".3g"), "1.5e+03")
658 self.assertEqual(format(1505.0, "#.3g"), "1.50e+03")
659
660 self.assertEqual(format(12300050.0, ".6g"), "1.23e+07")
661 self.assertEqual(format(12300050.0, "#.6g"), "1.23000e+07")
662
663 def test_with_two_commas_in_format_specifier(self):
664 error_msg = re.escape("Cannot specify ',' with ','.")

Callers

nothing calls this directly

Calls 2

formatFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected