Log message for revision 39646: Added tests for handling generator expressions.
Changed: A Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py -=- Copied: Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py (from rev 39505, Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after.py) =================================================================== --- Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after.py 2005-10-18 17:17:55 UTC (rev 39505) +++ Zope/branches/Zope-2_8-branch/lib/python/RestrictedPython/tests/before_and_after24.py 2005-10-26 17:12:37 UTC (rev 39646) @@ -0,0 +1,41 @@ +############################################################################## +# +# 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) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins