Unverified Kaydet (Commit) c559f6d5 authored tarafından Berker Peksag's avatar Berker Peksag Kaydeden (comit) GitHub

Update test_code_gen.py

üst 3382de74
...@@ -166,33 +166,18 @@ class CodegenTestCase(unittest.TestCase, Comparisons): ...@@ -166,33 +166,18 @@ class CodegenTestCase(unittest.TestCase, Comparisons):
@unittest.skipUnless(sys.version_info >= (3, 8, 0, "alpha", 4), @unittest.skipUnless(sys.version_info >= (3, 8, 0, "alpha", 4),
"positional only arguments introduced in Python 3.8") "positional only arguments introduced in Python 3.8")
def test_pos_only_arguments(self): def test_positional_only_arguments(self):
source = """ source = """
def test(a, b, /, c, *, d, **kwargs): def test(a, b, /, c, *, d, **kwargs):
pass pass
def test(a=3, b=4, /, c=7): def test(a=3, b=4, /, c=7):
pass pass
def test(a, b=4, /, c=8, d=9): def test(a, b=4, /, c=8, d=9):
pass pass
""" """
self.assertSrcRoundtrips(source) self.assertSrcRoundtrips(source)
with self.assertRaises(SyntaxError):
invalid_source = """
def test(p1, p2=None, /, p_or_kw, *, kw):
pass
def test(p1=None, p2, /, p_or_kw=None, *, kw):
pass
def test(p1=None, p2, /):
pass
"""
self.assertSrcRoundtrips(invalid_source)
def test_pass_arguments_node(self): def test_pass_arguments_node(self):
source = canonical(""" source = canonical("""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment