[pypy-commit] pypy py3k: adapt the syntax to py3k, and kill some outdated tests about the 'raise Type, args' form which is no longer valid

antocuni noreply at buildbot.pypy.org
Fri Feb 10 14:49:48 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52351:6928fe527941
Date: 2012-02-10 10:50 +0100
http://bitbucket.org/pypy/pypy/changeset/6928fe527941/

Log:	adapt the syntax to py3k, and kill some outdated tests about the
	'raise Type, args' form which is no longer valid

diff --git a/pypy/interpreter/test/test_raise.py b/pypy/interpreter/test/test_raise.py
--- a/pypy/interpreter/test/test_raise.py
+++ b/pypy/interpreter/test/test_raise.py
@@ -9,43 +9,23 @@
     def test_control_flow(self):
         try:
             raise Exception
-            raise AssertionError, "exception failed to raise"
+            raise AssertionError("exception failed to raise")
         except:
             pass
         else:
-            raise AssertionError, "exception executing else clause!"
+            raise AssertionError("exception executing else clause!")
 
-    def test_1arg(self):
+    def test_args(self):
         try:
-            raise SystemError, 1
-        except Exception, e:
-            assert e.args[0] == 1
-
-    def test_2args(self):
-        try:
-            raise SystemError, (1, 2)
-        except Exception, e:
-            assert e.args[0] == 1
-            assert e.args[1] == 2
-
-    def test_instancearg(self):
-        try:
-            raise SystemError, SystemError(1, 2)
-        except Exception, e:
-            assert e.args[0] == 1
-            assert e.args[1] == 2
-
-    def test_more_precise_instancearg(self):
-        try:
-            raise Exception, SystemError(1, 2)
-        except SystemError, e:
+            raise SystemError(1, 2)
+        except Exception as e:
             assert e.args[0] == 1
             assert e.args[1] == 2
 
     def test_builtin_exc(self):
         try:
             [][0]
-        except IndexError, e:
+        except IndexError as e:
             assert isinstance(e, IndexError)
 
     def test_raise_cls(self):
@@ -68,7 +48,7 @@
         except TypeError:
             pass
         else:
-            raise AssertionError, "shouldn't be able to raise 1"
+            raise AssertionError("shouldn't be able to raise 1")
 
     def test_raise_three_args(self):
         import sys


More information about the pypy-commit mailing list