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

Method test_prefixes

Lib/test/test_tokenize.py:3460–3476  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3458
3459
3460 def test_prefixes(self):
3461 # Get the list of defined string prefixes. I don't see an
3462 # obvious documented way of doing this, but probably the best
3463 # thing is to split apart tokenize.StringPrefix.
3464
3465 # Make sure StringPrefix begins and ends in parens. We're
3466 # assuming it's of the form "(a|b|ab)", if a, b, and cd are
3467 # valid string prefixes.
3468 self.assertEqual(tokenize.StringPrefix[0], '(')
3469 self.assertEqual(tokenize.StringPrefix[-1], ')')
3470
3471 # Then split apart everything else by '|'.
3472 defined_prefixes = set(tokenize.StringPrefix[1:-1].split('|'))
3473
3474 # Now compute the actual allowed string prefixes and compare
3475 # to what is defined in the tokenize module.
3476 self.assertEqual(defined_prefixes, self.determine_valid_prefixes())
3477
3478
3479if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

setFunction · 0.85
assertEqualMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected