mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
gh-71339: Use new assertion methods in tests (GH-129046)
This commit is contained in:
parent
bb244fd33d
commit
2602d8ae98
117 changed files with 407 additions and 445 deletions
|
@ -553,9 +553,9 @@ class CmdLineTest(unittest.TestCase):
|
|||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||
text = stderr.decode('ascii').split('\n')
|
||||
self.assertEqual(len(text), 5)
|
||||
self.assertTrue(text[0].startswith('Traceback'))
|
||||
self.assertTrue(text[1].startswith(' File '))
|
||||
self.assertTrue(text[3].startswith('NameError'))
|
||||
self.assertStartsWith(text[0], 'Traceback')
|
||||
self.assertStartsWith(text[1], ' File ')
|
||||
self.assertStartsWith(text[3], 'NameError')
|
||||
|
||||
def test_non_ascii(self):
|
||||
# Apple platforms deny the creation of a file with an invalid UTF-8 name.
|
||||
|
@ -708,9 +708,8 @@ class CmdLineTest(unittest.TestCase):
|
|||
exitcode, stdout, stderr = assert_python_failure(script_name)
|
||||
text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read()
|
||||
# It used to crash in https://github.com/python/cpython/issues/111132
|
||||
self.assertTrue(text.endswith(
|
||||
'SyntaxError: nonlocal declaration not allowed at module level\n',
|
||||
), text)
|
||||
self.assertEndsWith(text,
|
||||
'SyntaxError: nonlocal declaration not allowed at module level\n')
|
||||
|
||||
def test_consistent_sys_path_for_direct_execution(self):
|
||||
# This test case ensures that the following all give the same
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue