Skip to content

Commit

Permalink
Test relative as-import.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Feb 3, 2017
1 parent 65e7e19 commit bd6135f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/RestrictedPython/tests/security_in_syntax26.py
Expand Up @@ -4,10 +4,6 @@



def relative_import_as_bad_name():
from .x import y as _leading_underscore


def except_as_bad_name():
try:
1 / 0
Expand Down
7 changes: 7 additions & 0 deletions tests/test_transformer.py
Expand Up @@ -1371,6 +1371,13 @@ def test_transformer__RestrictingNodeTransformer__visit_Import__8(compile):
assert result.errors == (import_errmsg % '_m',)


@pytest.mark.parametrize(*compile)
def test_transformer__RestrictingNodeTransformer__visit_Import__9(compile):
"""It denies relative from importing as something starting with `_`."""
result = compile('from .x import y as _leading_underscore')
assert result.errors == (import_errmsg % '_leading_underscore',)


@pytest.mark.parametrize(*compile)
def test_transformer__RestrictingNodeTransformer__visit_ClassDef(compile):
result = compile('class Good: pass')
Expand Down

0 comments on commit bd6135f

Please sign in to comment.