[pypy-commit] pypy py3k: 2to3

pjenvey noreply at buildbot.pypy.org
Tue Mar 13 00:47:19 CET 2012


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r53394:e9c4247d5440
Date: 2012-03-12 16:35 -0700
http://bitbucket.org/pypy/pypy/changeset/e9c4247d5440/

Log:	2to3

diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -118,7 +118,7 @@
         C = type('C', (object,), {'x': lambda: 42})
         unbound_meth = C.x
         raises(TypeError, unbound_meth)
-        assert unbound_meth.im_func() == 42
+        assert unbound_meth.__func__() == 42
         raises(TypeError, type)
         raises(TypeError, type, 'test', (object,))
         raises(TypeError, type, 'test', (object,), {}, 42)
@@ -220,7 +220,7 @@
 
         try:
             D.__bases__ = ()
-        except TypeError, msg:
+        except TypeError as msg:
             if str(msg) == "a new-style class can't have only classic bases":
                 assert 0, "wrong error message for .__bases__ = ()"
         else:
@@ -278,7 +278,7 @@
                 return super(WorkOnce, self).__new__(WorkOnce, name, bases, ns)
             def mro(instance):
                 if instance.flag > 0:
-                    raise RuntimeError, "bozo"
+                    raise RuntimeError("bozo")
                 else:
                     instance.flag += 1
                     return type.mro(instance)
@@ -345,7 +345,7 @@
         except TypeError:
             pass
         else:
-            raise TestFailed, "didn't catch MRO conflict"
+            raise TestFailed("didn't catch MRO conflict")
 
     def test_mutable_bases_versus_nonheap_types(self):
         class A(int):
@@ -479,7 +479,7 @@
         except TypeError:
             pass
         else:
-            raise AssertionError, "this multiple inheritance should fail"
+            raise AssertionError("this multiple inheritance should fail")
 
     def test_outer_metaclass(self):
         class OuterMetaClass(type):
@@ -503,7 +503,7 @@
             pass
 
         g = {'__metaclass__': __metaclass__}
-        exec "class HasImplicitMetaclass: pass\n" in g
+        exec("class HasImplicitMetaclass: pass\n", g)
 
         HasImplicitMetaclass = g['HasImplicitMetaclass']
         assert type(HasImplicitMetaclass) == __metaclass__
@@ -549,7 +549,7 @@
         try:
             assert NoDoc.__doc__ == None
         except AttributeError:
-            raise AssertionError, "__doc__ missing!"
+            raise AssertionError("__doc__ missing!")
 
     def test_explicitdoc(self):
         class ExplicitDoc(object):
@@ -576,7 +576,7 @@
             #       we always raise AttributeError.
             pass
         else:
-            raise AssertionError, '__doc__ should not be writable'
+            raise AssertionError('__doc__ should not be writable')
 
         assert ImmutableDoc.__doc__ == 'foo'
 
@@ -693,7 +693,7 @@
             __slots__ = "abc"
 
         class B(object):
-            __slots__ = u"abc"
+            __slots__ = "abc"
 
         a = A()
         a.abc = "awesome"
@@ -980,12 +980,12 @@
 
     def test_module(self):
         def f(): pass
-        assert object.__module__ == '__builtin__'
-        assert int.__module__ == '__builtin__'
-        assert type.__module__ == '__builtin__'
-        assert type(f).__module__ == '__builtin__'
+        assert object.__module__ == 'builtins'
+        assert int.__module__ == 'builtins'
+        assert type.__module__ == 'builtins'
+        assert type(f).__module__ == 'builtins'
         d = {'__name__': 'yay'}
-        exec """class A(object):\n  pass\n""" in d
+        exec("""class A(object):\n  pass\n""", d)
         A = d['A']
         assert A.__module__ == 'yay'
 


More information about the pypy-commit mailing list