Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Python3_update' into remove_six
- Loading branch information
Showing
5 changed files
with
46 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from RestrictedPython._compat import IS_PY2 | ||
import RestrictedPython | ||
|
||
# Define the arguments for @pytest.mark.parametrize to be able to test both the | ||
# old and the new implementation to be equal: | ||
compile = ('compile', [RestrictedPython.compile.compile_restricted_exec]) | ||
if IS_PY2: | ||
from RestrictedPython import RCompile | ||
compile[1].append(RCompile.compile_restricted_exec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from . import compile | ||
from RestrictedPython._compat import IS_PY2 | ||
import pytest | ||
|
||
|
||
EXEC_STATEMENT = """\ | ||
def no_exec(): | ||
exec 'q = 1' | ||
""" | ||
|
||
|
||
@pytest.mark.skipif( | ||
IS_PY2, | ||
reason="exec statement in Python 2 is handled by RestrictedPython ") | ||
@pytest.mark.parametrize(*compile) | ||
def test_compile__compile_restricted_exec__10(compile): | ||
"""It is a SyntaxError to use the `exec` statement. (Python 3 only)""" | ||
code, errors, warnings, used_names = compile(EXEC_STATEMENT) | ||
assert ( | ||
"Line 2: SyntaxError: Missing parentheses in call to 'exec' in on " | ||
"statement: exec 'q = 1'",) == errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters