Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r48029:f01df61615da
Date: 2011-10-13 22:38 +0200
http://bitbucket.org/pypy/pypy/changeset/f01df61615da/

Log:    Fix most of the tests for the exception module

diff --git a/pypy/module/exceptions/interp_exceptions.py 
b/pypy/module/exceptions/interp_exceptions.py
--- a/pypy/module/exceptions/interp_exceptions.py
+++ b/pypy/module/exceptions/interp_exceptions.py
@@ -288,7 +288,7 @@
         space.realunicode_w(w_object)
         space.int_w(w_start)
         space.int_w(w_end)
-        space.realstr_w(w_reason)
+        space.str_w(w_reason)
         # assign attributes
         self.w_object = w_object
         self.w_start = w_start
@@ -720,11 +720,11 @@
 
     def descr_init(self, space, w_encoding, w_object, w_start, w_end, 
w_reason):
         # typechecking
-        space.realstr_w(w_encoding)
+        space.str_w(w_encoding)
         space.realunicode_w(w_object)
         space.int_w(w_start)
         space.int_w(w_end)
-        space.realstr_w(w_reason)
+        space.str_w(w_reason)
         # assign attributes
         self.w_encoding = w_encoding
         self.w_object = w_object
diff --git a/pypy/module/exceptions/test/test_exc.py 
b/pypy/module/exceptions/test/test_exc.py
--- a/pypy/module/exceptions/test/test_exc.py
+++ b/pypy/module/exceptions/test/test_exc.py
@@ -34,14 +34,6 @@
         del x.message
         assert not hasattr(x, "message")
 
-    def test_unicode_message(self):
-        assert unicode(Exception(u"\xe1")) == u"\xe1"
-        class E(BaseException):
-            def __str__(self):
-                return u"\xe1"
-        e = E()
-        assert unicode(e) == u"\xe1"
-
     def test_kwargs(self):
         from exceptions import Exception
         class X(Exception):
@@ -152,13 +144,13 @@
 
     def test_unicode_decode_error(self):
         from exceptions import UnicodeDecodeError
-        ud = UnicodeDecodeError("x", "y", 1, 5, "bah")
+        ud = UnicodeDecodeError("x", b"y", 1, 5, "bah")
         assert ud.encoding == 'x'
-        assert ud.object == 'y'
+        assert ud.object == b'y'
         assert ud.start == 1
         assert ud.end == 5
         assert ud.reason == 'bah'
-        assert ud.args == ('x', 'y', 1, 5, 'bah')
+        assert ud.args == ('x', b'y', 1, 5, 'bah')
         assert ud.message == ''
         ud.object = 'z9'
         assert ud.object == 'z9'
@@ -183,8 +175,7 @@
         assert str(ue) == "'x' codec can't encode character u'\\x39' in 
position 1: bah"
         ue.object = []
         assert ue.object == []
-        raises(TypeError, UnicodeEncodeError, "x", "y", 1, 5, "bah")
-        raises(TypeError, UnicodeEncodeError, u"x", u"y", 1, 5, "bah")
+        raises(TypeError, UnicodeEncodeError, "x", b"y", 1, 5, "bah")
 
     def test_multiple_inheritance(self):
         from exceptions import LookupError, ValueError, Exception, IOError
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to