Skip to content

Commit

Permalink
Nicer (?) code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed May 2, 2017
1 parent 8f8bf37 commit 80f977d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
12 changes: 3 additions & 9 deletions tests/transformer/test_async.py
Expand Up @@ -70,9 +70,7 @@ def test_await(c_exec):
result = compile_restricted_exec(
AWAIT_EXAMPLE,
policy=RestrictingAsyncNodeTransformer)
assert result.errors == (
'Line 11: Await statements are not allowed.',
)
assert result.errors == ('Line 11: Await statements are not allowed.',)
assert result.code is None


Expand All @@ -89,9 +87,7 @@ def test_async_with(c_exec):
result = compile_restricted_exec(
ASYNC_WITH_EXAMPLE,
policy=RestrictingAsyncNodeTransformer)
assert result.errors == (
'Line 3: AsyncWith statements are not allowed.',
)
assert result.errors == ('Line 3: AsyncWith statements are not allowed.',)
assert result.code is None


Expand All @@ -108,7 +104,5 @@ def test_async_for(c_exec):
result = compile_restricted_exec(
ASYNC_FOR_EXAMPLE,
policy=RestrictingAsyncNodeTransformer)
assert result.errors == (
'Line 3: AsyncFor statements are not allowed.',
)
assert result.errors == ('Line 3: AsyncFor statements are not allowed.',)
assert result.code is None
4 changes: 1 addition & 3 deletions tests/transformer/test_global_local.py
Expand Up @@ -38,7 +38,5 @@ def inside():
@pytest.mark.parametrize(*c_exec)
def test_Nonlocal(c_exec):
result = c_exec(NONLOCAL_EXAMPLE)
assert result.errors == (
'Line 5: Nonlocal statements are not allowed.',
)
assert result.errors == ('Line 5: Nonlocal statements are not allowed.',)
assert result.code is None
14 changes: 2 additions & 12 deletions tests/transformer/test_yield.py
Expand Up @@ -14,12 +14,8 @@ def no_yield():
def test_yield(c_exec):
"""It prevents using the `yield` statement."""
result = c_exec(YIELD_EXAMPLE)
assert result.errors == ("Line 2: Yield statements are not allowed.",)
assert result.code is None
assert result.errors == (
"Line 2: Yield statements are not allowed.",
)
assert result.warnings == []
assert result.used_names == {}


# Modified Example from http://stackabuse.com/python-async-await-tutorial/
Expand All @@ -38,11 +34,5 @@ def get_json(client, url):
@pytest.mark.parametrize(*c_exec)
def test_yield_from(c_exec):
result = c_exec(YIELD_FORM_EXAMPLE)
assert result.errors == ('Line 6: YieldFrom statements are not allowed.',)
assert result.code is None
assert result.errors == (
'Line 6: YieldFrom statements are not allowed.',
)
assert result.warnings == []
assert result.used_names == {
'asyncio': True,
}

0 comments on commit 80f977d

Please sign in to comment.