Permalink
Browse files

fix pickle test in Python 3

  • Loading branch information...
1 parent ded26a8 commit 9560cbeceff33113b1fed16cebaf68538030a09a @robertwb robertwb committed May 23, 2012
Showing with 16 additions and 6 deletions.
  1. +16 −6 tests/run/reduce_pickle.pyx
@@ -1,10 +1,23 @@
+import sys
+
+if sys.version_info[0] < 3:
+ __doc__ = """
+ >>> import cPickle
+ >>> a = A(5); a
+ A(5)
+ >>> cPickle.loads(cPickle.dumps(a))
+ A(5)
+
+ >>> b = B(0, 1); b
+ B(x=0, y=1)
+ >>> cPickle.loads(cPickle.dumps(b))
+ B(x=0, y=1)
+ """
+
cdef class A:
"""
>>> a = A(3); a
A(3)
- >>> import cPickle
- >>> cPickle.loads(cPickle.dumps(a))
- A(3)
>>> import pickle
>>> pickle.loads(pickle.dumps(a))
A(3)
@@ -25,9 +38,6 @@ cdef class B:
"""
>>> b = B(x=37, y=389); b
B(x=37, y=389)
- >>> import cPickle
- >>> cPickle.loads(cPickle.dumps(b))
- B(x=37, y=389)
>>> import pickle
>>> pickle.loads(pickle.dumps(b))
B(x=37, y=389)

0 comments on commit 9560cbe

Please sign in to comment.