Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
16d562ee
Commit
16d562ee
authored
Oct 26, 2005
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for handling generator expressions.
parent
ac521c5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
lib/python/RestrictedPython/tests/before_and_after24.py
lib/python/RestrictedPython/tests/before_and_after24.py
+41
-0
No files found.
lib/python/RestrictedPython/tests/before_and_after24.py
0 → 100644
View file @
16d562ee
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
#
##############################################################################
"""Restricted Python transformation examples
This module contains pairs of functions. Each pair has a before and an
after function. The after function shows the source code equivalent
of the before function after it has been modified by the restricted
compiler.
These examples are actually used in the testRestrictions.py
checkBeforeAndAfter() unit tests, which verifies that the restricted compiler
actually produces the same output as would be output by the normal compiler
for the after function.
$Id$
"""
def
simple_generator_expression_before
():
x
=
(
y
**
2
for
y
in
whatever
if
y
>
3
)
def
simple_generator_expression_after
():
x
=
(
y
**
2
for
y
in
_getiter_
(
whatever
)
if
y
>
3
)
def
nested_generator_expression_before
():
x
=
(
x
**
2
+
y
**
2
for
x
in
whatever1
if
x
>=
0
for
y
in
whatever2
if
y
>=
x
)
def
nested_generator_expression_after
():
x
=
(
x
**
2
+
y
**
2
for
x
in
_getiter_
(
whatever1
)
if
x
>=
0
for
y
in
_getiter_
(
whatever2
)
if
y
>=
x
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment