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

Method test_random_files

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected