Lines Matching refs:code
42 # code, print out a table with tokens. The ENDMARKER, ENCODING and
1519 The source code in f is tokenized to both 5- and 2-tuples.
1520 Both sequences are converted back to source code via
1525 reproduce code that does not contain a backslash continuation
1528 # Get source code and original tokenizations
1530 code = f.encode('utf-8')
1532 code = f.read()
1534 readline = iter(code.splitlines(keepends=True)).__next__
1581 # Some error-handling code
1642 def roundtrip(self, code):
1643 if isinstance(code, str):
1644 code = code.encode('utf-8')
1645 return untokenize(tokenize(BytesIO(code).readline)).decode('utf-8')
1652 code = "if False:\n\tx=3\n\tx=3\n"
1653 codelines = self.roundtrip(code).split('\n')
1655 self.check_roundtrip(code)
2541 code = dedent("""
2549 self.check_tokenize(code, """\
2577 self.assertEqual(get_tokens(code), get_tokens(code_no_cont))
2579 code = dedent("""
2586 self.check_tokenize(code, """\
2598 self.assertEqual(get_tokens(code), get_tokens(code_no_cont))
2600 code = dedent("""
2610 self.check_tokenize(code, """\
2633 self.assertEqual(get_tokens(code), get_tokens(code_no_cont))