mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 21:34:32 +08:00
Remove support for parsing Python 2
This commit is contained in:
@@ -8,13 +8,13 @@ from textwrap import dedent
|
||||
from parso import parse
|
||||
|
||||
|
||||
def assert_params(param_string, version=None, **wanted_dct):
|
||||
def assert_params(param_string, **wanted_dct):
|
||||
source = dedent('''
|
||||
def x(%s):
|
||||
pass
|
||||
''') % param_string
|
||||
|
||||
module = parse(source, version=version)
|
||||
module = parse(source)
|
||||
funcdef = next(module.iter_funcdefs())
|
||||
dct = dict((p.name.value, p.default and p.default.get_code())
|
||||
for p in funcdef.get_params())
|
||||
@@ -23,9 +23,9 @@ def assert_params(param_string, version=None, **wanted_dct):
|
||||
|
||||
|
||||
def test_split_params_with_separation_star():
|
||||
assert_params('x, y=1, *, z=3', x=None, y='1', z='3', version='3.5')
|
||||
assert_params('*, x', x=None, version='3.5')
|
||||
assert_params('*', version='3.5')
|
||||
assert_params('x, y=1, *, z=3', x=None, y='1', z='3')
|
||||
assert_params('*, x', x=None)
|
||||
assert_params('*')
|
||||
|
||||
|
||||
def test_split_params_with_stars():
|
||||
@@ -34,12 +34,12 @@ def test_split_params_with_stars():
|
||||
assert_params('*args, **kwargs', args=None, kwargs=None)
|
||||
|
||||
|
||||
def test_kw_only_no_kw(works_ge_py3):
|
||||
def test_kw_only_no_kw(works_in_py):
|
||||
"""
|
||||
Parsing this should be working. In CPython the parser also parses this and
|
||||
in a later step the AST complains.
|
||||
"""
|
||||
module = works_ge_py3.parse('def test(arg, *):\n pass')
|
||||
module = works_in_py.parse('def test(arg, *):\n pass')
|
||||
if module is not None:
|
||||
func = module.children[0]
|
||||
open_, p1, asterisk, close = func._get_param_nodes()
|
||||
|
||||
Reference in New Issue
Block a user