[Checkins] SVN: Acquisition/trunk/src/Acquisition/tests.py add extra tests for the modified version of `PyObject_GetIter` used for iteration support (see https://bugs.launchpad.net/zope2/+bug/360761)
Andreas Zeidler
az at zitc.de
Thu Oct 29 05:18:54 EDT 2009
Log message for revision 105351:
add extra tests for the modified version of `PyObject_GetIter` used for iteration support (see https://bugs.launchpad.net/zope2/+bug/360761)
Changed:
U Acquisition/trunk/src/Acquisition/tests.py
-=-
Modified: Acquisition/trunk/src/Acquisition/tests.py
===================================================================
--- Acquisition/trunk/src/Acquisition/tests.py 2009-10-29 09:18:46 UTC (rev 105350)
+++ Acquisition/trunk/src/Acquisition/tests.py 2009-10-29 09:18:53 UTC (rev 105351)
@@ -1863,6 +1863,30 @@
>>> list(i.c)
[0, 1, 2, 3, 4]
+ Finally let's make sure errors are still correctly raised after having
+ to use a modified version of `PyObject_GetIter` for iterator support::
+
+ >>> class C(Acquisition.Implicit):
+ ... pass
+ >>> c = C()
+ >>> i = Impl()
+ >>> i.c = c
+ >>> list(i.c)
+ Traceback (most recent call last):
+ ...
+ TypeError: iteration over non-sequence
+
+ >>> class C(Acquisition.Implicit):
+ ... def __iter__(self):
+ ... return [42]
+ >>> c = C()
+ >>> i = Impl()
+ >>> i.c = c
+ >>> list(i.c)
+ Traceback (most recent call last):
+ ...
+ TypeError: iter() returned non-iterator of type 'list'
+
"""
class Location(object):
More information about the checkins
mailing list