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

Method is_valid_id

Lib/idlelib/idle_test/test_hyperparser.py:204–214  ·  view source on GitHub ↗
(candidate)

Source from the content-addressed store, hash-verified

202
203 def test_eat_identifier(self):
204 def is_valid_id(candidate):
205 result = HyperParser._eat_identifier(candidate, 0, len(candidate))
206 if result == len(candidate):
207 return True
208 elif result == 0:
209 return False
210 else:
211 err_msg = "Unexpected result: {} (expected 0 or {}".format(
212 result, len(candidate)
213 )
214 raise Exception(err_msg)
215
216 # invalid first character which is valid elsewhere in an identifier
217 self.assertFalse(is_valid_id('2notid'))

Callers

nothing calls this directly

Calls 2

_eat_identifierMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected