From 8bfd3ed63ed67fa6e15b244a642061967e5665db Mon Sep 17 00:00:00 2001
From: Stefan Behnel <scoder@users.berlios.de>
Date: Thu, 15 May 2008 00:45:39 +0200
Subject: [PATCH] lots of test fixes for Py3

---
 tests/run/kostyrka2.pyx   |  6 +++++-
 tests/run/multass.pyx     |  6 +++++-
 tests/run/powop.pyx       |  4 ++++
 tests/run/r_addint.pyx    | 14 +++++++++-----
 tests/run/r_barbieri1.pyx |  2 +-
 tests/run/r_bowden1.pyx   |  8 ++++++--
 tests/run/r_huss3.pyx     |  2 +-
 7 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/tests/run/kostyrka2.pyx b/tests/run/kostyrka2.pyx
index b89758e30..e3c67e935 100644
--- a/tests/run/kostyrka2.pyx
+++ b/tests/run/kostyrka2.pyx
@@ -1,8 +1,12 @@
 __doc__ = u"""
     >>> x = X()
     >>> x.slots
-    ['']
+    [b'']
 """
 
+import sys
+if sys.version_info[0] < 3:
+    __doc__ = __doc__.replace(u" b'", u" '")
+
 class X:
         slots = ["", ]
diff --git a/tests/run/multass.pyx b/tests/run/multass.pyx
index cbc50a01f..fb23494d6 100644
--- a/tests/run/multass.pyx
+++ b/tests/run/multass.pyx
@@ -4,11 +4,15 @@ __doc__ = u"""
     >>> g()
     (1, 1, 2, 2, 3, 3)
     >>> h()
-    (1, 'test', 3, 1, 'test', 3)
+    (1, b'test', 3, 1, b'test', 3)
     >>> j()
     (2, 1, 4, 2, 6, 3)
 """
 
+import sys
+if sys.version_info[0] < 3:
+    __doc__ = __doc__.replace(u" b'", u" '")
+
 def f():
     cdef object obj1a, obj2a, obj3a, obj1b, obj2b, obj3b
     obj1b, obj2b, obj3b = 1, 2, 3
diff --git a/tests/run/powop.pyx b/tests/run/powop.pyx
index 9882e9380..d3765a952 100644
--- a/tests/run/powop.pyx
+++ b/tests/run/powop.pyx
@@ -15,6 +15,10 @@ __doc__ = u"""
     True
 """
 
+import sys
+if sys.version_info[0] >= 3:
+    __doc__ = __doc__.replace(u"2L", u"2")
+
 def f(obj2, obj3):
     cdef float flt1, flt2, flt3
     flt2, flt3 = obj2, obj3
diff --git a/tests/run/r_addint.pyx b/tests/run/r_addint.pyx
index c828a3559..2d2f30954 100644
--- a/tests/run/r_addint.pyx
+++ b/tests/run/r_addint.pyx
@@ -1,14 +1,18 @@
 __doc__ = u"""
     >>> def test(a, b):
-    ...     print a, b, add(a, b)
+    ...     print((a, b, add(a, b)))
 
     >>> test(1, 2)
-    1 2 3
+    (1, 2, 3)
     >>> test(17.3, 88.6)
-    17.3 88.6 105.9
-    >>> test("eggs", "spam")
-    eggs spam eggsspam
+    (17.3, 88.6, 105.9)
+    >>> test(u"eggs", u"spam")
+    (u'eggs', u'spam', u'eggsspam')
 """
 
+import sys
+if sys.version_info[0] >= 3:
+    __doc__ = __doc__.replace(u" u'", u" '")
+
 def add(x, y):
     return x + y
diff --git a/tests/run/r_barbieri1.pyx b/tests/run/r_barbieri1.pyx
index 614c82706..46815df33 100644
--- a/tests/run/r_barbieri1.pyx
+++ b/tests/run/r_barbieri1.pyx
@@ -8,7 +8,7 @@ __doc__ = u"""
 
 import sys
 if sys.version_info[0] >= 3:
-    __doc__ = __doc__.replace(u"Exception, e'", u"Exception as e")
+    __doc__ = __doc__.replace(u"Exception, e", u"Exception as e")
 
 cdef class A:
     def __cinit__(self):
diff --git a/tests/run/r_bowden1.pyx b/tests/run/r_bowden1.pyx
index e205ad10e..14851684f 100644
--- a/tests/run/r_bowden1.pyx
+++ b/tests/run/r_bowden1.pyx
@@ -1,10 +1,14 @@
 __doc__ = u"""
 >>> f(100)
-101
+101L
 >>> g(3000000000)
-3000000001
+3000000001L
 """
 
+import sys
+if sys.version_info[0] >= 3:
+    __doc__ = __doc__.replace(u"L", u"")
+
 def f(x):
     cdef unsigned long long ull
     ull = x
diff --git a/tests/run/r_huss3.pyx b/tests/run/r_huss3.pyx
index 9aff68217..cb78d0515 100644
--- a/tests/run/r_huss3.pyx
+++ b/tests/run/r_huss3.pyx
@@ -12,7 +12,7 @@ ValueError:
 
 import sys
 if sys.version_info[0] >= 3:
-    __doc__ = __doc__.replace(u"Exception, e'", u"Exception as e")
+    __doc__ = __doc__.replace(u"Exception, e", u"Exception as e")
 
 def bar():
     try:
-- 
2.30.9