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

Method test_underscore_literals

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

Source from the content-addressed store, hash-verified

105 self.assertRaises(SyntaxError, eval, "0 if 1Else 0")
106
107 def test_underscore_literals(self):
108 for lit in VALID_UNDERSCORE_LITERALS:
109 self.assertEqual(eval(lit), eval(lit.replace('_', '')))
110 for lit in INVALID_UNDERSCORE_LITERALS:
111 self.assertRaises(SyntaxError, eval, lit)
112 # Sanity check: no literal begins with an underscore
113 self.assertRaises(NameError, eval, "_0")
114
115 @unittest.expectedFailure # TODO: RUSTPYTHON
116 def test_bad_numerical_literals(self):

Callers

nothing calls this directly

Calls 4

evalFunction · 0.50
assertEqualMethod · 0.45
replaceMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected