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

Method check_line_extraction

Lib/test/test_tokenize.py:2039–2048  ·  view source on GitHub ↗
(self, f)

Source from the content-addressed store, hash-verified

2037 self.assertEqual(code_without_bom, untokenized_code)
2038
2039 def check_line_extraction(self, f):
2040 if isinstance(f, str):
2041 code = f.encode('utf-8')
2042 else:
2043 code = f.read()
2044 readline = iter(code.splitlines(keepends=True)).__next__
2045 for tok in tokenize.tokenize(readline):
2046 if tok.type in {tokenize.ENCODING, tokenize.ENDMARKER}:
2047 continue
2048 self.assertEqual(tok.string, tok.line[tok.start[1]: tok.end[1]])
2049
2050 def test_roundtrip(self):
2051 # There are some standard formatting practices that are easy to get right.

Callers 1

test_random_filesMethod · 0.95

Calls 6

isinstanceFunction · 0.85
iterFunction · 0.85
encodeMethod · 0.45
readMethod · 0.45
splitlinesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected