Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions src/RestrictedPython/tests/testCompile.py

This file was deleted.

44 changes: 44 additions & 0 deletions tests/legacy/test_compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################

from RestrictedPython._compat import IS_PY2
from RestrictedPython._compat import IS_PY3

import pytest

if IS_PY2:
from RestrictedPython.RCompile import _niceParse
import compiler

pytestmark = pytest.mark.skipif(
IS_PY3,
reason="legacy tests against old implementation")


source = u"u'Ä väry nice säntänce with umlauts.'"


def test_unicode_source_exec():
assert isinstance(_niceParse(source, "test.py", "exec"),
compiler.ast.Module)


def test_unicode_source_single():
assert isinstance(_niceParse(source, "test.py", "single"),
compiler.ast.Module)


def test_unicode_source_eval():
assert isinstance(_niceParse(source, "test.py", "eval"),
compiler.ast.Expression)