parso
parso copied to clipboard
Multiple test/test_python_errors.py failures with Python 3.10
Full pytest output follows:
============================= test session starts ==============================
platform linux -- Python 3.10.0b3, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/parso, configfile: pytest.ini, testpaths: parso, test
plugins: case-1.5.3, xprocess-0.17.1, mock-3.6.1, expect-1.1.0, forked-1.3.0, asyncio-0.15.1, freezegun-0.4.2, timeout-1.4.2, datadir-1.3.1, metadata-1.8.0, snapshottest-0.5.1, rerunfailures-10.0, subtests-0.5.0, localserver-0.5.0, betamax-0.8.1, pyfakefs-4.5.0, httpbin-1.0.0, django-4.4.0, flaky-3.7.0, hypothesis-6.14.0, shutil-1.7.0, virtualenv-1.7.0, pkgcore-0.12.1, xdist-2.3.0, cov-2.12.1, Faker-8.8.2
collected 1351 items
parso/__init__.py . [ 0%]
parso/tree.py . [ 0%]
parso/python/tree.py . [ 0%]
test/test_cache.py ......... [ 0%]
test/test_diff_parser.py ............................................... [ 4%]
................................... [ 6%]
test/test_dump_tree.py .......... [ 7%]
test/test_error_recovery.py ............. [ 8%]
test/test_file_python_errors.py ..... [ 9%]
test/test_fstring.py ................................................... [ 12%]
.................. [ 14%]
test/test_get_code.py ............. [ 15%]
test/test_grammar.py . [ 15%]
test/test_load_grammar.py ........... [ 15%]
test/test_normalizer_issues_files.py ............................. [ 18%]
test/test_old_fast_parser.py ............... [ 19%]
test/test_param_splitting.py ....... [ 19%]
test/test_parser.py .................................................... [ 23%]
........................................................................ [ 28%]
.................. [ 30%]
test/test_parser_tree.py ............................................... [ 33%]
................................ [ 36%]
test/test_pep8.py ... [ 36%]
test/test_pgen2.py ..................................................... [ 40%]
........................................................................ [ 45%]
........................................................................ [ 50%]
........................................................................ [ 56%]
.. [ 56%]
test/test_prefix.py ...................... [ 58%]
test/test_python_errors.py ......................................FF..... [ 61%]
...F........FFF....FFF..F.FFFFFFFFFFFFF.FFFF...F......F......FF......... [ 66%]
..F...............F....FFF.......F.......FFFF.......FF.................. [ 72%]
.....F....................F.......................FF.................... [ 77%]
........F............................................................... [ 82%]
....................................................................... [ 87%]
test/test_tokenize.py .................................................. [ 91%]
........................................................................ [ 96%]
...... [ 97%]
test/test_utils.py ................................... [100%]
=================================== FAILURES ===================================
____________________ test_python_exception_matches[{} += 1] ____________________
code = '{} += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'dict display' is an illegal expression for augmented assignment" in ["SyntaxError: 'dict literal' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[{a:b} += 1] ___________________
code = '{a:b} += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'dict display' is an illegal expression for augmented assignment" in ["SyntaxError: 'dict literal' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[... += 1] ____________________
code = '... += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'Ellipsis' is an illegal expression for augmented assignment" in ["SyntaxError: 'ellipsis' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[a + b += 1] ___________________
code = 'a + b += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'operator' is an illegal expression for augmented assignment" in ["SyntaxError: 'expression' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[+a += 1] ____________________
code = '+a += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'operator' is an illegal expression for augmented assignment" in ["SyntaxError: 'expression' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
_________________ test_python_exception_matches[a and b += 1] __________________
code = 'a and b += 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: 'operator' is an illegal expression for augmented assignment" in ["SyntaxError: 'expression' is an illegal expression for augmented assignment"]
test/test_python_errors.py:41: AssertionError
______________ test_python_exception_matches[[x for x in y] = 1] _______________
code = '[x for x in y] = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to list comprehension' in ["SyntaxError: cannot assign to list comprehension here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
______________ test_python_exception_matches[{x for x in y} = 1] _______________
code = '{x for x in y} = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to set comprehension' in ["SyntaxError: cannot assign to set comprehension here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
_____________ test_python_exception_matches[{x:x for x in y} = 1] ______________
code = '{x:x for x in y} = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to dict comprehension' in ["SyntaxError: cannot assign to dict comprehension here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[... = 1] ____________________
code = '... = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to Ellipsis' in ["SyntaxError: cannot assign to ellipsis here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[{a, b} = 1] ___________________
code = '{a, b} = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to set display' in ["SyntaxError: cannot assign to set display here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[{a: b} = 1] ___________________
code = '{a: b} = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to dict display' in ["SyntaxError: cannot assign to dict literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
_____________________ test_python_exception_matches[1 = 1] _____________________
code = '1 = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches["" = 1] _____________________
code = '"" = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[b"" = 10] ____________________
code = 'b"" = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[b"" = 11] ____________________
code = 'b"" = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches["" "" = 1] ___________________
code = '"" "" = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[1 | 1 = 3] ___________________
code = '1 | 1 = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to operator' in ["SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[1**1 = 3] ____________________
code = '1**1 = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to operator' in ["SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[~ 1 = 3] ____________________
code = '~ 1 = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to operator' in ["SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[not 1 = 3] ___________________
code = 'not 1 = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot assign to operator' in ['SyntaxError: cannot assign to expression']
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[1 and 1 = 3] __________________
code = '1 and 1 = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot assign to operator' in ['SyntaxError: cannot assign to expression']
test/test_python_errors.py:41: AssertionError
___________ test_python_exception_matches[def foo(): (yield 1) = 3] ____________
code = 'def foo(): (yield 1) = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to yield expression' in ["SyntaxError: cannot assign to yield expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
_________ test_python_exception_matches[async def foo(): await x = 3] __________
code = 'async def foo(): await x = 3'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to await expression' in ["SyntaxError: cannot assign to await expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
______________ test_python_exception_matches[(a if a else a) = a] ______________
code = '(a if a else a) = a'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to conditional expression' in ["SyntaxError: cannot assign to conditional expression here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[a, 1 = x] ____________________
code = 'a, 1 = x'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to literal' in ["SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[foo() = 1] ___________________
code = 'foo() = 1'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: cannot assign to function call' in ["SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?"]
test/test_python_errors.py:41: AssertionError
____________ test_python_exception_matches[for (not 1) in []: pass] ____________
code = 'for (not 1) in []: pass'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot assign to operator' in ['SyntaxError: cannot assign to expression']
test/test_python_errors.py:41: AssertionError
_____________________ test_python_exception_matches[u"\\"] _____________________
code = 'u"\\"'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOL while scanning string literal' in ['SyntaxError: unterminated string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
_____________________ test_python_exception_matches[b"\\"] _____________________
code = 'b"\\"'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOL while scanning string literal' in ['SyntaxError: unterminated string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[b"\xe4"] ____________________
code = 'b"ä"'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: bytes can only contain ASCII literal characters.' in ['SyntaxError: bytes can only contain ASCII literal characters']
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[del x + y] ___________________
code = 'del x + y'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot delete operator' in ['SyntaxError: cannot delete expression']
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[del {}] _____________________
code = 'del {}'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot delete dict display' in ['SyntaxError: cannot delete dict literal']
test/test_python_errors.py:41: AssertionError
_____________________ test_python_exception_matches[(*x)] ______________________
code = '(*x)'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: can't use starred expression here" in ['SyntaxError: cannot use starred expression here']
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[((*x))] _____________________
code = '((*x))'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: can't use starred expression here" in ['SyntaxError: cannot use starred expression here']
test/test_python_errors.py:41: AssertionError
___________________ test_python_exception_matches[1 + (*x)] ____________________
code = '1 + (*x)'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: can't use starred expression here" in ['SyntaxError: cannot use starred expression here']
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[f"{*x}"] ____________________
code = 'f"{*x}"'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert "SyntaxError: f-string: can't use starred expression here" in ['SyntaxError: f-string: cannot use starred expression here']
test/test_python_errors.py:41: AssertionError
______________________ test_python_exception_matches["""] ______________________
code = '"""'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOF while scanning triple-quoted string literal' in ['SyntaxError: unterminated triple-quoted string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
_______________________ test_python_exception_matches["] _______________________
code = '"'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOL while scanning string literal' in ['SyntaxError: unterminated string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
______________________ test_python_exception_matches['''] ______________________
code = "'''"
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOF while scanning triple-quoted string literal' in ['SyntaxError: unterminated triple-quoted string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
_______________________ test_python_exception_matches['] _______________________
code = "'"
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: EOL while scanning string literal' in ['SyntaxError: unterminated string literal (detected at line 1)']
test/test_python_errors.py:41: AssertionError
__________________ test_python_exception_matches[if 1:\nfoo] ___________________
code = 'if 1:\nfoo'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'IndentationError: expected an indented block' in ["IndentationError: expected an indented block after 'if' statement on line 1"]
test/test_python_errors.py:41: AssertionError
___ test_python_exception_matches[if 1: blubb\nif 1:\npass\nTrue and False] ____
code = 'if 1: blubb\nif 1:\npass\nTrue and False'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'IndentationError: expected an indented block' in ["IndentationError: expected an indented block after 'if' statement on line 2"]
test/test_python_errors.py:41: AssertionError
____________________ test_python_exception_matches[del ...] ____________________
code = 'del ...'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot delete Ellipsis' in ['SyntaxError: cannot delete ellipsis']
test/test_python_errors.py:41: AssertionError
_____ test_python_exception_matches[class X(base for base in bases): pass] _____
code = 'class X(base for base in bases): pass'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E assert 'SyntaxError: invalid syntax' in ["SyntaxError: expected ':'"]
test/test_python_errors.py:41: AssertionError
______________ test_python_exception_matches[({a: b} := {1: 2})] _______________
code = '({a: b} := {1: 2})'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot use assignment expressions with dict display' in ['SyntaxError: cannot use assignment expressions with dict literal']
test/test_python_errors.py:41: AssertionError
_________________ test_python_exception_matches[(a + b := 1)] __________________
code = '(a + b := 1)'
@pytest.mark.parametrize('code', FAILING_EXAMPLES)
def test_python_exception_matches(code):
wanted, line_nr = _get_actual_exception(code)
errors = _get_error_list(code)
actual = None
if errors:
error, = errors
actual = error.message
> assert actual in wanted
E AssertionError: assert 'SyntaxError: cannot use assignment expressions with operator' in ['SyntaxError: cannot use assignment expressions with expression']
test/test_python_errors.py:41: AssertionError
_____________________ test_default_except_error_postition ______________________
def test_default_except_error_postition():
# For this error the position seemed to be one line off, but that doesn't
# really matter.
code = 'try: pass\nexcept: pass\nexcept X: pass'
wanted, line_nr = _get_actual_exception(code)
error, = _get_error_list(code)
assert error.message in wanted
> assert line_nr != error.start_pos[0]
E assert 2 != 2
test/test_python_errors.py:149: AssertionError
=========================== short test summary info ============================
FAILED test/test_python_errors.py::test_python_exception_matches[{} += 1] - a...
FAILED test/test_python_errors.py::test_python_exception_matches[{a:b} += 1]
FAILED test/test_python_errors.py::test_python_exception_matches[... += 1] - ...
FAILED test/test_python_errors.py::test_python_exception_matches[a + b += 1]
FAILED test/test_python_errors.py::test_python_exception_matches[+a += 1] - a...
FAILED test/test_python_errors.py::test_python_exception_matches[a and b += 1]
FAILED test/test_python_errors.py::test_python_exception_matches[[x for x in y] = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[{x for x in y} = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[{x:x for x in y} = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[... = 1] - a...
FAILED test/test_python_errors.py::test_python_exception_matches[{a, b} = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[{a: b} = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[1 = 1] - ass...
FAILED test/test_python_errors.py::test_python_exception_matches["" = 1] - as...
FAILED test/test_python_errors.py::test_python_exception_matches[b"" = 10] - ...
FAILED test/test_python_errors.py::test_python_exception_matches[b"" = 11] - ...
FAILED test/test_python_errors.py::test_python_exception_matches["" "" = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[1 | 1 = 3]
FAILED test/test_python_errors.py::test_python_exception_matches[1**1 = 3] - ...
FAILED test/test_python_errors.py::test_python_exception_matches[~ 1 = 3] - a...
FAILED test/test_python_errors.py::test_python_exception_matches[not 1 = 3]
FAILED test/test_python_errors.py::test_python_exception_matches[1 and 1 = 3]
FAILED test/test_python_errors.py::test_python_exception_matches[def foo(): (yield 1) = 3]
FAILED test/test_python_errors.py::test_python_exception_matches[async def foo(): await x = 3]
FAILED test/test_python_errors.py::test_python_exception_matches[(a if a else a) = a]
FAILED test/test_python_errors.py::test_python_exception_matches[a, 1 = x] - ...
FAILED test/test_python_errors.py::test_python_exception_matches[foo() = 1]
FAILED test/test_python_errors.py::test_python_exception_matches[for (not 1) in []: pass]
FAILED test/test_python_errors.py::test_python_exception_matches[u"\\"] - Ass...
FAILED test/test_python_errors.py::test_python_exception_matches[b"\\"] - Ass...
FAILED test/test_python_errors.py::test_python_exception_matches[b"\xe4"] - A...
FAILED test/test_python_errors.py::test_python_exception_matches[del x + y]
FAILED test/test_python_errors.py::test_python_exception_matches[del {}] - As...
FAILED test/test_python_errors.py::test_python_exception_matches[(*x)] - asse...
FAILED test/test_python_errors.py::test_python_exception_matches[((*x))] - as...
FAILED test/test_python_errors.py::test_python_exception_matches[1 + (*x)] - ...
FAILED test/test_python_errors.py::test_python_exception_matches[f"{*x}"] - a...
FAILED test/test_python_errors.py::test_python_exception_matches["""] - Asser...
FAILED test/test_python_errors.py::test_python_exception_matches["] - Asserti...
FAILED test/test_python_errors.py::test_python_exception_matches['''] - Asser...
FAILED test/test_python_errors.py::test_python_exception_matches['] - Asserti...
FAILED test/test_python_errors.py::test_python_exception_matches[if 1:\nfoo]
FAILED test/test_python_errors.py::test_python_exception_matches[if 1: blubb\nif 1:\npass\nTrue and False]
FAILED test/test_python_errors.py::test_python_exception_matches[del ...] - A...
FAILED test/test_python_errors.py::test_python_exception_matches[class X(base for base in bases): pass]
FAILED test/test_python_errors.py::test_python_exception_matches[({a: b} := {1: 2})]
FAILED test/test_python_errors.py::test_python_exception_matches[(a + b := 1)]
FAILED test/test_python_errors.py::test_default_except_error_postition - asse...
======================= 48 failed, 1303 passed in 12.04s =======================
The main issue for Python 3.10 is #138
We should still be able to fix the test errors in 3.10 and get that running without actually implementing support for match.