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

Method test_random_files

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

Source from the content-addressed store, hash-verified

2174 self.check_roundtrip("'' ''")
2175
2176 def test_random_files(self):
2177 # Test roundtrip on random python modules.
2178 # pass the '-ucpu' option to process the full directory.
2179
2180 import glob, random
2181 tempdir = os.path.dirname(__file__) or os.curdir
2182 testfiles = glob.glob(os.path.join(glob.escape(tempdir), "test*.py"))
2183
2184 if not support.is_resource_enabled("cpu"):
2185 testfiles = random.sample(testfiles, 10)
2186
2187 for testfile in testfiles:
2188 if support.verbose >= 2:
2189 print('tokenize', testfile)
2190 with open(testfile, 'rb') as f:
2191 with self.subTest(file=testfile):
2192 self.check_roundtrip(f)
2193 self.check_line_extraction(f)
2194
2195
2196 def roundtrip(self, code):

Callers

nothing calls this directly

Calls 9

check_roundtripMethod · 0.95
check_line_extractionMethod · 0.95
escapeMethod · 0.80
sampleMethod · 0.80
subTestMethod · 0.80
printFunction · 0.50
openFunction · 0.50
globMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected