From d6575834513f9675c751910983917d736f6eac06 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 30 Dec 2008 12:57:41 +0100 Subject: [PATCH] Py3 test case fix --- tests/run/set.pyx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/run/set.pyx b/tests/run/set.pyx index 24e853ee..ab145137 100644 --- a/tests/run/set.pyx +++ b/tests/run/set.pyx @@ -2,12 +2,12 @@ __doc__ = u""" >>> type(test_set_literal()) is _set True >>> sorted(test_set_literal()) -['a', 'b', 1] +[u'a', u'b', 1] >>> type(test_set_add()) is _set True >>> sorted(test_set_add()) -['a', 1] +[u'a', 1] >>> type(test_set_list_comp()) is _set True @@ -27,21 +27,25 @@ True >>> type(test_set_discard()) is _set True >>> sorted(test_set_discard()) -['12', 233] +[u'12', 233] """ +import sys +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u"u'", u"'").replace(u'u"', u'"') + # Py2.3 doesn't have the 'set' builtin type, but Cython does :) _set = set def test_set_literal(): - cdef set s1 = {1,'a',1,'b','a'} + cdef set s1 = {1,u'a',1,u'b',u'a'} return s1 def test_set_add(): cdef set s1 s1 = set([1]) s1.add(1) - s1.add('a') + s1.add(u'a') s1.add(1) return s1 @@ -59,17 +63,17 @@ def test_set_list_comp(): def test_set_pop(): cdef set s1 s1 = set() - s1.add('2') + s1.add(u'2') two = s1.pop() return s1 def test_set_discard(): cdef set s1 s1 = set() - s1.add('12') + s1.add(u'12') s1.add(3) s1.add(233) - s1.discard('3') + s1.discard(u'3') s1.discard(3) return s1 -- 2.26.2