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

Method test_underscore_literals

Lib/test/test_grammar.py:113–119  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

111 self.assertRaises(SyntaxError, eval, "0 if 1Else 0")
112
113 def test_underscore_literals(self):
114 for lit in VALID_UNDERSCORE_LITERALS:
115 self.assertEqual(eval(lit), eval(lit.replace('_', '')))
116 for lit in INVALID_UNDERSCORE_LITERALS:
117 self.assertRaises(SyntaxError, eval, lit)
118 # Sanity check: no literal begins with an underscore
119 self.assertRaises(NameError, eval, "_0")
120
121 def test_bad_numerical_literals(self):
122 check = self.check_syntax_error

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.45
replaceMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected