Skip to content

Commit

Permalink
started defining print tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Sep 22, 2016
1 parent 0b8181b commit 4a86f50
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_print.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from RestrictedPython import compile_restricted
from RestrictedPython import compile_restricted_exec
import pytest
import sys





ALLOWED_PRINT = """\
print 'Hello World!'
"""

ALLOWED_PRINT_WITH_NL = """\
print 'Hello World!',
"""

DISSALOWED_PRINT_WITH_CHEVRON = """\
print >> stream, 'Hello World!'
"""


def test_print__simple_print_statement():
code, err, warn, use = compile_restricted_exec(ALLOWED_PRINT, '<undefined>')
exec(code)
assert 'code' == code

0 comments on commit 4a86f50

Please sign in to comment.