Update tokenizer to adhere to PEP492 magic

This commit is contained in:
Claude
2016-02-09 21:07:18 +01:00
parent bf5acb4c7a
commit 65187930bd
2 changed files with 74 additions and 18 deletions

View File

@@ -46,8 +46,8 @@ class GrammarTest(TestCase):
class TestMatrixMultiplication(GrammarTest):
@pytest.mark.skipif('sys.version_info[:2] < (3, 5)')
def test_matrix_multiplication_operator(self):
parse("a @ b")
parse("a @= b")
parse("a @ b", "3.5")
parse("a @= b", "3.5")
class TestYieldFrom(GrammarTest):
@@ -62,7 +62,7 @@ class TestAsyncAwait(GrammarTest):
def test_await_expr(self):
parse("""async def foo():
await x
""")
""", "3.5")
parse("""async def foo():
@@ -71,46 +71,51 @@ class TestAsyncAwait(GrammarTest):
def foo(): pass
await x
""")
""", "3.5")
parse("""async def foo(): return await a""")
parse("""async def foo(): return await a""", "3.5")
parse("""def foo():
def foo(): pass
async def foo(): await x
""")
""", "3.5")
self.invalid_syntax("await x")
self.invalid_syntax("await x", version="3.5")
self.invalid_syntax("""def foo():
await x""")
await x""", version="3.5")
self.invalid_syntax("""def foo():
def foo(): pass
async def foo(): pass
await x
""")
""", version="3.5")
self.invalid_syntax("""async def foo():
def foo():
await x
""", version="3.5")
@pytest.mark.skipif('sys.version_info[:2] < (3, 5)')
def test_async_var(self):
parse("""async = 1""")
parse("""await = 1""")
parse("""def async(): pass""")
parse("""async = 1""", "3.5")
parse("""await = 1""", "3.5")
parse("""def async(): pass""", "3.5")
@pytest.mark.skipif('sys.version_info[:2] < (3, 5)')
def test_async_with(self):
parse("""async def foo():
async for a in b: pass""")
async for a in b: pass""", "3.5")
self.invalid_syntax("""def foo():
async for a in b: pass""")
async for a in b: pass""", version="3.5")
@pytest.mark.skipif('sys.version_info[:2] < (3, 5)')
def test_async_for(self):
parse("""async def foo():
async with a: pass""")
async with a: pass""", "3.5")
self.invalid_syntax("""def foo():
async with a: pass""")
async with a: pass""", version="3.5")
class TestRaiseChanges(GrammarTest):