(self)
| 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): |
nothing calls this directly
no test coverage detected