[Checkins] SVN: Acquisition/trunk/src/Acquisition/tests.py Add slicing tests that demonstrate the 64-bit problem

Martijn Pieters mj at zopatista.com
Sun Aug 9 10:36:10 EDT 2009


Log message for revision 102617:
  Add slicing tests that demonstrate the 64-bit problem

Changed:
  U   Acquisition/trunk/src/Acquisition/tests.py

-=-
Modified: Acquisition/trunk/src/Acquisition/tests.py
===================================================================
--- Acquisition/trunk/src/Acquisition/tests.py	2009-08-09 13:46:21 UTC (rev 102616)
+++ Acquisition/trunk/src/Acquisition/tests.py	2009-08-09 14:36:09 UTC (rev 102617)
@@ -1686,6 +1686,7 @@
 def test_proxying():
     """Make sure that recent python slots are proxied.
 
+    >>> import sys
     >>> import Acquisition
     >>> class Impl(Acquisition.Implicit):
     ...     pass
@@ -1702,6 +1703,9 @@
     ...     def __iter__(self):
     ...         print 'iterating...'
     ...         return iter((42,))
+    ...     def __getslice__(self, start, end):
+    ...         print 'slicing...'
+    ...         return (start, end)
 
     The naked class behaves like this:
 
@@ -1715,6 +1719,12 @@
     >>> list(c)
     iterating...
     [42]
+    >>> c[5:10]
+    slicing...
+    (5, 10)
+    >>> c[5:] == (5, sys.maxint)
+    slicing...
+    True
 
     Let's put c in the context of i:
 
@@ -1732,6 +1742,12 @@
     >>> list(i.c)
     iterating...
     [42]
+    >>> i.c[5:10]
+    slicing...
+    (5, 10)
+    >>> i.c[5:] == (5, sys.maxint)
+    slicing...
+    True
 
     Let's let's test the same again with an explicit wrapper:
 
@@ -1751,6 +1767,9 @@
     ...     def __iter__(self):
     ...         print 'iterating...'
     ...         return iter((42,))
+    ...     def __getslice__(self, start, end):
+    ...         print 'slicing...'
+    ...         return (start, end)
 
     The naked class behaves like this:
 
@@ -1764,6 +1783,12 @@
     >>> list(c)
     iterating...
     [42]
+    >>> c[5:10]
+    slicing...
+    (5, 10)
+    >>> c[5:] == (5, sys.maxint)
+    slicing...
+    True
 
     Let's put c in the context of i:
 
@@ -1781,6 +1806,12 @@
     >>> list(i.c)
     iterating...
     [42]
+    >>> i.c[5:10]
+    slicing...
+    (5, 10)
+    >>> i.c[5:] == (5, sys.maxint)
+    slicing...
+    True
 
     Finally let's check that https://bugs.launchpad.net/zope2/+bug/360761
     has been fixed:



More information about the Checkins mailing list