mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 13:24:39 +08:00
Fix diff parser: Also check async with
This commit is contained in:
@@ -136,6 +136,8 @@ def _suite_or_file_input_is_valid(pgen_grammar, stack):
|
||||
|
||||
|
||||
def _is_flow_node(node):
|
||||
if node.type == 'async_stmt':
|
||||
node = node.children[1]
|
||||
try:
|
||||
value = node.children[0].value
|
||||
except AttributeError:
|
||||
|
||||
@@ -921,8 +921,9 @@ def test_many_nested_ifs(differ):
|
||||
differ.parse(code1, parsers=1, copies=1)
|
||||
|
||||
|
||||
def test_with_and_funcdef_in_call(differ):
|
||||
code1 = dedent('''\
|
||||
@pytest.mark.parametrize('prefix', ['', 'async '])
|
||||
def test_with_and_funcdef_in_call(differ, prefix):
|
||||
code1 = prefix + dedent('''\
|
||||
with x:
|
||||
la = C(
|
||||
a=1,
|
||||
@@ -931,15 +932,7 @@ def test_with_and_funcdef_in_call(differ):
|
||||
)
|
||||
''')
|
||||
|
||||
code2 = dedent('''\
|
||||
with x:
|
||||
la = C(
|
||||
a=1,
|
||||
def y(self, args):
|
||||
b=2,
|
||||
c=3,
|
||||
)
|
||||
''')
|
||||
code2 = insert_line_into_code(code1, 3, 'def y(self, args):\n')
|
||||
|
||||
differ.initialize(code1)
|
||||
differ.parse(code2, parsers=3, copies=0, expect_error_leaves=True)
|
||||
|
||||
Reference in New Issue
Block a user