mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)
This commit is contained in:
parent
8c813faf86
commit
1110c5bc82
18 changed files with 40 additions and 25 deletions
|
@ -132,7 +132,9 @@ class PyCompileTestsBase:
|
|||
os.chmod(self.directory, mode.st_mode)
|
||||
|
||||
def test_bad_coding(self):
|
||||
bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
|
||||
bad_coding = os.path.join(os.path.dirname(__file__),
|
||||
'tokenizedata',
|
||||
'bad_coding2.py')
|
||||
with support.captured_stderr():
|
||||
self.assertIsNone(py_compile.compile(bad_coding, doraise=False))
|
||||
self.assertFalse(os.path.exists(
|
||||
|
@ -195,7 +197,9 @@ class PyCompileTestsBase:
|
|||
self.assertEqual(flags, 0b1)
|
||||
|
||||
def test_quiet(self):
|
||||
bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
|
||||
bad_coding = os.path.join(os.path.dirname(__file__),
|
||||
'tokenizedata',
|
||||
'bad_coding2.py')
|
||||
with support.captured_stderr() as stderr:
|
||||
self.assertIsNone(py_compile.compile(bad_coding, doraise=False, quiet=2))
|
||||
self.assertIsNone(py_compile.compile(bad_coding, doraise=True, quiet=2))
|
||||
|
@ -260,14 +264,18 @@ class PyCompileCLITestCase(unittest.TestCase):
|
|||
self.assertTrue(os.path.exists(self.cache_path))
|
||||
|
||||
def test_bad_syntax(self):
|
||||
bad_syntax = os.path.join(os.path.dirname(__file__), 'badsyntax_3131.py')
|
||||
bad_syntax = os.path.join(os.path.dirname(__file__),
|
||||
'tokenizedata',
|
||||
'badsyntax_3131.py')
|
||||
rc, stdout, stderr = self.pycompilecmd_failure(bad_syntax)
|
||||
self.assertEqual(rc, 1)
|
||||
self.assertEqual(stdout, b'')
|
||||
self.assertIn(b'SyntaxError', stderr)
|
||||
|
||||
def test_bad_syntax_with_quiet(self):
|
||||
bad_syntax = os.path.join(os.path.dirname(__file__), 'badsyntax_3131.py')
|
||||
bad_syntax = os.path.join(os.path.dirname(__file__),
|
||||
'tokenizedata',
|
||||
'badsyntax_3131.py')
|
||||
rc, stdout, stderr = self.pycompilecmd_failure('-q', bad_syntax)
|
||||
self.assertEqual(rc, 1)
|
||||
self.assertEqual(stdout, b'')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue