[Python-3000-checkins] r57686 - in python/branches/py3k: Lib/test/leakers/test_gestalt.py Lib/test/pickletester.py Lib/test/test_binop.py Lib/test/test_capi.py Lib/test/test_cgi.py Lib/test/test_contains.py Lib/test/test_copy.py Lib/test/test_curses.py Lib/test/test_dbm.py Lib/test/test_descr.py Lib/test/test_descrtut.py Lib/test/test_dl.py Lib/test/test_doctest.py Lib/test/test_exception_variations.py Lib/test/test_extcall.py Lib/test/test_fork1.py Lib/test/test_format.py Lib/test/test_funcattrs.py Lib/test/test_gdbm.py Lib/test/test_importhooks.py Lib/test/test_iter.py Lib/test/test_largefile.py Lib/test/test_locale.py Lib/test/test_logging.py Lib/test/test_openpty.py Lib/test/test_pep277.py Lib/test/test_pkgimport.py Lib/test/test_poll.py Lib/test/test_posix.py Lib/test/test_pty.py Lib/test/test_queue.py Lib/test/test_re.py Lib/test/test_richcmp.py Lib/test/test_scope.py Lib/test/test_socket.py Lib/test/test_socketserver.py Lib/test/test_struct.py Lib/test/test_thread.py Lib/test/test_threadsignals.py Lib/test/test_trace.py Lib/test/test_traceback.py Lib/test/test_unicode_file.py Lib/test/test_univnewlines.py Lib/test/test_wait3.py Lib/test/test_wait4.py Lib/test/test_wave.py Lib/test/time_hashlib.py

collin.winter python-3000-checkins at python.org
Thu Aug 30 01:37:34 CEST 2007


Author: collin.winter
Date: Thu Aug 30 01:37:32 2007
New Revision: 57686

Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/test/leakers/test_gestalt.py
   python/branches/py3k/Lib/test/pickletester.py
   python/branches/py3k/Lib/test/test_binop.py
   python/branches/py3k/Lib/test/test_capi.py
   python/branches/py3k/Lib/test/test_cgi.py
   python/branches/py3k/Lib/test/test_contains.py
   python/branches/py3k/Lib/test/test_copy.py
   python/branches/py3k/Lib/test/test_curses.py
   python/branches/py3k/Lib/test/test_dbm.py
   python/branches/py3k/Lib/test/test_descr.py
   python/branches/py3k/Lib/test/test_descrtut.py
   python/branches/py3k/Lib/test/test_dl.py
   python/branches/py3k/Lib/test/test_doctest.py
   python/branches/py3k/Lib/test/test_exception_variations.py
   python/branches/py3k/Lib/test/test_extcall.py
   python/branches/py3k/Lib/test/test_fork1.py
   python/branches/py3k/Lib/test/test_format.py
   python/branches/py3k/Lib/test/test_funcattrs.py
   python/branches/py3k/Lib/test/test_gdbm.py
   python/branches/py3k/Lib/test/test_importhooks.py
   python/branches/py3k/Lib/test/test_iter.py
   python/branches/py3k/Lib/test/test_largefile.py
   python/branches/py3k/Lib/test/test_locale.py
   python/branches/py3k/Lib/test/test_logging.py
   python/branches/py3k/Lib/test/test_openpty.py
   python/branches/py3k/Lib/test/test_pep277.py
   python/branches/py3k/Lib/test/test_pkgimport.py
   python/branches/py3k/Lib/test/test_poll.py
   python/branches/py3k/Lib/test/test_posix.py
   python/branches/py3k/Lib/test/test_pty.py
   python/branches/py3k/Lib/test/test_queue.py
   python/branches/py3k/Lib/test/test_re.py
   python/branches/py3k/Lib/test/test_richcmp.py
   python/branches/py3k/Lib/test/test_scope.py
   python/branches/py3k/Lib/test/test_socket.py
   python/branches/py3k/Lib/test/test_socketserver.py
   python/branches/py3k/Lib/test/test_struct.py
   python/branches/py3k/Lib/test/test_thread.py
   python/branches/py3k/Lib/test/test_threadsignals.py
   python/branches/py3k/Lib/test/test_trace.py
   python/branches/py3k/Lib/test/test_traceback.py
   python/branches/py3k/Lib/test/test_unicode_file.py
   python/branches/py3k/Lib/test/test_univnewlines.py
   python/branches/py3k/Lib/test/test_wait3.py
   python/branches/py3k/Lib/test/test_wait4.py
   python/branches/py3k/Lib/test/test_wave.py
   python/branches/py3k/Lib/test/time_hashlib.py
Log:
Raise statement normalization in Lib/test/.


Modified: python/branches/py3k/Lib/test/leakers/test_gestalt.py
==============================================================================
--- python/branches/py3k/Lib/test/leakers/test_gestalt.py	(original)
+++ python/branches/py3k/Lib/test/leakers/test_gestalt.py	Thu Aug 30 01:37:32 2007
@@ -1,7 +1,7 @@
 import sys
 
 if sys.platform != 'darwin':
-    raise ValueError, "This test only leaks on Mac OS X"
+    raise ValueError("This test only leaks on Mac OS X")
 
 def leak():
     # taken from platform._mac_ver_lookup()

Modified: python/branches/py3k/Lib/test/pickletester.py
==============================================================================
--- python/branches/py3k/Lib/test/pickletester.py	(original)
+++ python/branches/py3k/Lib/test/pickletester.py	Thu Aug 30 01:37:32 2007
@@ -868,7 +868,7 @@
         self._proto = proto
         return REX_two, ()
     def __reduce__(self):
-        raise TestFailed, "This __reduce__ shouldn't be called"
+        raise TestFailed("This __reduce__ shouldn't be called")
 
 class REX_four(object):
     _proto = None

Modified: python/branches/py3k/Lib/test/test_binop.py
==============================================================================
--- python/branches/py3k/Lib/test/test_binop.py	(original)
+++ python/branches/py3k/Lib/test/test_binop.py	Thu Aug 30 01:37:32 2007
@@ -35,12 +35,12 @@
 
         The arguments must be ints or longs, and default to (0, 1)."""
         if not isint(num):
-            raise TypeError, "Rat numerator must be int or long (%r)" % num
+            raise TypeError("Rat numerator must be int or long (%r)" % num)
         if not isint(den):
-            raise TypeError, "Rat denominator must be int or long (%r)" % den
+            raise TypeError("Rat denominator must be int or long (%r)" % den)
         # But the zero is always on
         if den == 0:
-            raise ZeroDivisionError, "zero denominator"
+            raise ZeroDivisionError("zero denominator")
         g = gcd(den, num)
         self.__num = int(num//g)
         self.__den = int(den//g)
@@ -73,15 +73,15 @@
             try:
                 return int(self.__num)
             except OverflowError:
-                raise OverflowError, ("%s too large to convert to int" %
+                raise OverflowError("%s too large to convert to int" %
                                       repr(self))
-        raise ValueError, "can't convert %s to int" % repr(self)
+        raise ValueError("can't convert %s to int" % repr(self))
 
     def __long__(self):
         """Convert a Rat to an long; self.den must be 1."""
         if self.__den == 1:
             return int(self.__num)
-        raise ValueError, "can't convert %s to long" % repr(self)
+        raise ValueError("can't convert %s to long" % repr(self))
 
     def __add__(self, other):
         """Add two Rats, or a Rat and a number."""

Modified: python/branches/py3k/Lib/test/test_capi.py
==============================================================================
--- python/branches/py3k/Lib/test/test_capi.py	(original)
+++ python/branches/py3k/Lib/test/test_capi.py	Thu Aug 30 01:37:32 2007
@@ -12,10 +12,7 @@
             test = getattr(_testcapi, name)
             if test_support.verbose:
                 print("internal", name)
-            try:
-                test()
-            except _testcapi.error:
-                raise test_support.TestFailed, sys.exc_info()[1]
+            test()
 
     # some extra thread-state tests driven via _testcapi
     def TestThreadState():
@@ -35,8 +32,8 @@
         time.sleep(1)
         # Check our main thread is in the list exactly 3 times.
         if idents.count(thread.get_ident()) != 3:
-            raise test_support.TestFailed, \
-                  "Couldn't find main thread correctly in the list"
+            raise test_support.TestFailed(
+                        "Couldn't find main thread correctly in the list")
 
     try:
         _testcapi._test_thread_state

Modified: python/branches/py3k/Lib/test/test_cgi.py
==============================================================================
--- python/branches/py3k/Lib/test/test_cgi.py	(original)
+++ python/branches/py3k/Lib/test/test_cgi.py	Thu Aug 30 01:37:32 2007
@@ -47,7 +47,7 @@
         env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
         env['CONTENT_LENGTH'] = str(len(buf))
     else:
-        raise ValueError, "unknown method: %s" % method
+        raise ValueError("unknown method: %s" % method)
     try:
         return cgi.parse(fp, env, strict_parsing=1)
     except Exception as err:

Modified: python/branches/py3k/Lib/test/test_contains.py
==============================================================================
--- python/branches/py3k/Lib/test/test_contains.py	(original)
+++ python/branches/py3k/Lib/test/test_contains.py	Thu Aug 30 01:37:32 2007
@@ -17,7 +17,7 @@
 
 def check(ok, *args):
     if not ok:
-        raise TestFailed, " ".join(map(str, args))
+        raise TestFailed(" ".join(map(str, args)))
 
 a = base_set(1)
 b = set(1)
@@ -95,7 +95,7 @@
 
     def __cmp__(self, other):
         if other == 4:
-            raise RuntimeError, "gotcha"
+            raise RuntimeError("gotcha")
 
 try:
     check(Deviant2() not in a, "oops")

Modified: python/branches/py3k/Lib/test/test_copy.py
==============================================================================
--- python/branches/py3k/Lib/test/test_copy.py	(original)
+++ python/branches/py3k/Lib/test/test_copy.py	Thu Aug 30 01:37:32 2007
@@ -51,7 +51,7 @@
             def __reduce_ex__(self, proto):
                 return ""
             def __reduce__(self):
-                raise test_support.TestFailed, "shouldn't call this"
+                raise test_support.TestFailed("shouldn't call this")
         x = C()
         y = copy.copy(x)
         self.assert_(y is x)
@@ -68,7 +68,7 @@
         class C(object):
             def __getattribute__(self, name):
                 if name.startswith("__reduce"):
-                    raise AttributeError, name
+                    raise AttributeError(name)
                 return object.__getattribute__(self, name)
         x = C()
         self.assertRaises(copy.Error, copy.copy, x)
@@ -224,7 +224,7 @@
             def __reduce_ex__(self, proto):
                 return ""
             def __reduce__(self):
-                raise test_support.TestFailed, "shouldn't call this"
+                raise test_support.TestFailed("shouldn't call this")
         x = C()
         y = copy.deepcopy(x)
         self.assert_(y is x)
@@ -241,7 +241,7 @@
         class C(object):
             def __getattribute__(self, name):
                 if name.startswith("__reduce"):
-                    raise AttributeError, name
+                    raise AttributeError(name)
                 return object.__getattribute__(self, name)
         x = C()
         self.assertRaises(copy.Error, copy.deepcopy, x)
@@ -565,7 +565,7 @@
     def test_getstate_exc(self):
         class EvilState(object):
             def __getstate__(self):
-                raise ValueError, "ain't got no stickin' state"
+                raise ValueError("ain't got no stickin' state")
         self.assertRaises(ValueError, copy.copy, EvilState())
 
     def test_copy_function(self):

Modified: python/branches/py3k/Lib/test/test_curses.py
==============================================================================
--- python/branches/py3k/Lib/test/test_curses.py	(original)
+++ python/branches/py3k/Lib/test/test_curses.py	Thu Aug 30 01:37:32 2007
@@ -22,7 +22,7 @@
 # XXX: if newterm was supported we could use it instead of initscr and not exit
 term = os.environ.get('TERM')
 if not term or term == 'unknown':
-    raise TestSkipped, "$TERM=%r, calling initscr() may cause exit" % term
+    raise TestSkipped("$TERM=%r, calling initscr() may cause exit" % term)
 
 if sys.platform == "cygwin":
     raise TestSkipped("cygwin's curses mostly just hangs")
@@ -72,7 +72,7 @@
     except TypeError:
         pass
     else:
-        raise RuntimeError, "Expected win.border() to raise TypeError"
+        raise RuntimeError("Expected win.border() to raise TypeError")
 
     stdscr.clearok(1)
 
@@ -243,7 +243,7 @@
     # try to access userptr() before calling set_userptr() -- segfaults
     try:
         p.userptr()
-        raise RuntimeError, 'userptr should fail since not set'
+        raise RuntimeError('userptr should fail since not set')
     except curses.panel.error:
         pass
 
@@ -253,7 +253,7 @@
         curses.resizeterm(lines - 1, cols + 1)
 
         if curses.LINES != lines - 1 or curses.COLS != cols + 1:
-            raise RuntimeError, "Expected resizeterm to update LINES and COLS"
+            raise RuntimeError("Expected resizeterm to update LINES and COLS")
 
 def main(stdscr):
     curses.savetty()

Modified: python/branches/py3k/Lib/test/test_dbm.py
==============================================================================
--- python/branches/py3k/Lib/test/test_dbm.py	(original)
+++ python/branches/py3k/Lib/test/test_dbm.py	Thu Aug 30 01:37:32 2007
@@ -21,7 +21,7 @@
             # if we can't delete the file because of permissions,
             # nothing will work, so skip the test
             if errno == 1:
-                raise TestSkipped, 'unable to remove: ' + filename + suffix
+                raise TestSkipped('unable to remove: ' + filename + suffix)
 
 def test_keys():
     d = dbm.open(filename, 'c')

Modified: python/branches/py3k/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k/Lib/test/test_descr.py	(original)
+++ python/branches/py3k/Lib/test/test_descr.py	Thu Aug 30 01:37:32 2007
@@ -12,7 +12,7 @@
 
 def veris(a, b):
     if a is not b:
-        raise TestFailed, "%r is %r" % (a, b)
+        raise TestFailed("%r is %r" % (a, b))
 
 def testunop(a, res, expr="len(a)", meth="__len__"):
     if verbose: print("checking", expr)
@@ -430,7 +430,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "NotImplemented should have caused TypeError"
+        raise TestFailed("NotImplemented should have caused TypeError")
 
 def longs():
     if verbose: print("Testing long operations...")
@@ -775,7 +775,7 @@
     c = C()
     try: c()
     except TypeError: pass
-    else: raise TestFailed, "calling object w/o call method should raise TypeError"
+    else: raise TestFailed("calling object w/o call method should raise TypeError")
 
     # Testing code to find most derived baseclass
     class A(type):
@@ -897,13 +897,13 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "expected MRO order disagreement (F)"
+        raise TestFailed("expected MRO order disagreement (F)")
     try:
         class G(E, D): pass
     except TypeError:
         pass
     else:
-        raise TestFailed, "expected MRO order disagreement (G)"
+        raise TestFailed("expected MRO order disagreement (G)")
 
 
 # see thread python-dev/2002-October/029035.html
@@ -965,10 +965,10 @@
             callable(*args)
         except exc as msg:
             if not str(msg).startswith(expected):
-                raise TestFailed, "Message %r, expected %r" % (str(msg),
-                                                               expected)
+                raise TestFailed("Message %r, expected %r" % (str(msg),
+                                                               expected))
         else:
-            raise TestFailed, "Expected %s" % exc
+            raise TestFailed("Expected %s" % exc)
     class A(object): pass
     class B(A): pass
     class C(object): pass
@@ -1062,7 +1062,7 @@
     except AttributeError:
         pass
     else:
-        raise TestFailed, "Double underscored names not mangled"
+        raise TestFailed("Double underscored names not mangled")
 
     # Make sure slot names are proper identifiers
     try:
@@ -1071,35 +1071,35 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "[None] slots not caught"
+        raise TestFailed("[None] slots not caught")
     try:
         class C(object):
             __slots__ = ["foo bar"]
     except TypeError:
         pass
     else:
-        raise TestFailed, "['foo bar'] slots not caught"
+        raise TestFailed("['foo bar'] slots not caught")
     try:
         class C(object):
             __slots__ = ["foo\0bar"]
     except TypeError:
         pass
     else:
-        raise TestFailed, "['foo\\0bar'] slots not caught"
+        raise TestFailed("['foo\\0bar'] slots not caught")
     try:
         class C(object):
             __slots__ = ["1"]
     except TypeError:
         pass
     else:
-        raise TestFailed, "['1'] slots not caught"
+        raise TestFailed("['1'] slots not caught")
     try:
         class C(object):
             __slots__ = [""]
     except TypeError:
         pass
     else:
-        raise TestFailed, "[''] slots not caught"
+        raise TestFailed("[''] slots not caught")
     class C(object):
         __slots__ = ["a", "a_b", "_a", "A0123456789Z"]
     # XXX(nnorwitz): was there supposed to be something tested
@@ -1135,7 +1135,7 @@
     except (TypeError, UnicodeEncodeError):
         pass
     else:
-        raise TestFailed, "[unichr(128)] slots not caught"
+        raise TestFailed("[unichr(128)] slots not caught")
 
     # Test leaks
     class Counted(object):
@@ -1232,7 +1232,7 @@
     except AttributeError:
         pass
     else:
-        raise TestFailed, "shouldn't be allowed to set a.foo"
+        raise TestFailed("shouldn't be allowed to set a.foo")
 
     class C1(W, D):
         __slots__ = []
@@ -1434,7 +1434,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "classmethod should check for callability"
+        raise TestFailed("classmethod should check for callability")
 
     # Verify that classmethod() doesn't allow keyword args
     try:
@@ -1442,7 +1442,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "classmethod shouldn't accept keyword args"
+        raise TestFailed("classmethod shouldn't accept keyword args")
 
 def classmethods_in_c():
     if verbose: print("Testing C-based class methods...")
@@ -1595,7 +1595,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "devious mro() return not caught"
+        raise TestFailed("devious mro() return not caught")
 
     try:
         class _metaclass(type):
@@ -1606,7 +1606,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "non-class mro() return not caught"
+        raise TestFailed("non-class mro() return not caught")
 
     try:
         class _metaclass(type):
@@ -1617,7 +1617,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "non-sequence mro() return not caught"
+        raise TestFailed("non-sequence mro() return not caught")
 
 
 def overloading():
@@ -1956,7 +1956,7 @@
     except ZeroDivisionError:
         pass
     else:
-        raise TestFailed, "expected ZeroDivisionError from bad property"
+        raise TestFailed("expected ZeroDivisionError from bad property")
 
     class E(object):
         def getter(self):
@@ -2037,28 +2037,28 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't allow super(D, 42)"
+        raise TestFailed("shouldn't allow super(D, 42)")
 
     try:
         super(D, C())
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't allow super(D, C())"
+        raise TestFailed("shouldn't allow super(D, C())")
 
     try:
         super(D).__get__(12)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't allow super(D).__get__(12)"
+        raise TestFailed("shouldn't allow super(D).__get__(12)")
 
     try:
         super(D).__get__(C())
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't allow super(D).__get__(C())"
+        raise TestFailed("shouldn't allow super(D).__get__(C())")
 
     # Make sure data descriptors can be overridden and accessed via super
     # (new feature in Python 2.3)
@@ -2094,7 +2094,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "super shouldn't accept keyword args"
+        raise TestFailed("super shouldn't accept keyword args")
 
 def inherits():
     if verbose: print("Testing inheritance from basic types...")
@@ -2573,7 +2573,7 @@
             def __init__(self, value):
                 self.value = int(value)
             def __cmp__(self, other):
-                raise TestFailed, "shouldn't call __cmp__"
+                raise TestFailed("shouldn't call __cmp__")
             def __eq__(self, other):
                 if isinstance(other, C):
                     return self.value == other.value
@@ -2652,13 +2652,13 @@
         except TypeError:
             pass
         else:
-            raise TestFailed, "shouldn't allow %r.__class__ = %r" % (x, C)
+            raise TestFailed("shouldn't allow %r.__class__ = %r" % (x, C))
         try:
             delattr(x, "__class__")
         except TypeError:
             pass
         else:
-            raise TestFailed, "shouldn't allow del %r.__class__" % x
+            raise TestFailed("shouldn't allow del %r.__class__" % x)
     cant(C(), list)
     cant(list(), C)
     cant(C(), 1)
@@ -2726,7 +2726,7 @@
         except (AttributeError, TypeError):
             pass
         else:
-            raise TestFailed, "shouldn't allow %r.__dict__ = %r" % (x, dict)
+            raise TestFailed("shouldn't allow %r.__dict__ = %r" % (x, dict))
     cant(a, None)
     cant(a, [])
     cant(a, 1)
@@ -2744,14 +2744,14 @@
         except (AttributeError, TypeError):
             pass
         else:
-            raise TestFailed, "shouldn't allow del %r.__dict__" % x
+            raise TestFailed("shouldn't allow del %r.__dict__" % x)
         dict_descr = Base.__dict__["__dict__"]
         try:
             dict_descr.__set__(x, {})
         except (AttributeError, TypeError):
             pass
         else:
-            raise TestFailed, "dict_descr allowed access to %r's dict" % x
+            raise TestFailed("dict_descr allowed access to %r's dict" % x)
 
     # Classes don't allow __dict__ assignment and have readonly dicts
     class Meta1(type, Base):
@@ -2770,7 +2770,7 @@
         except TypeError:
             pass
         else:
-            raise TestFailed, "%r's __dict__ can be modified" % cls
+            raise TestFailed("%r's __dict__ can be modified" % cls)
 
     # Modules also disallow __dict__ assignment
     class Module1(types.ModuleType, Base):
@@ -2796,7 +2796,7 @@
         except (TypeError, AttributeError):
             pass
         else:
-            raise TestFaied, "%r's __dict__ can be deleted" % e
+            raise TestFaied("%r's __dict__ can be deleted" % e)
 
 
 def pickles():
@@ -2931,13 +2931,13 @@
         except TypeError:
             pass
         else:
-            raise TestFailed, "should fail: pickle C instance - %s" % base
+            raise TestFailed("should fail: pickle C instance - %s" % base)
         try:
             pickle.dumps(C(), 0)
         except TypeError:
             pass
         else:
-            raise TestFailed, "should fail: pickle D instance - %s" % base
+            raise TestFailed("should fail: pickle D instance - %s" % base)
         # Give C a nice generic __getstate__ and __setstate__
         class C(base):
             __slots__ = ['a']
@@ -3073,7 +3073,7 @@
     def __getattr__(self, name):
         if name in ("spam", "foo", "bar"):
             return "hello"
-        raise AttributeError, name
+        raise AttributeError(name)
     B.__getattr__ = __getattr__
     vereq(d.spam, "hello")
     vereq(d.foo, 24)
@@ -3089,7 +3089,7 @@
     except AttributeError:
         pass
     else:
-        raise TestFailed, "d.foo should be undefined now"
+        raise TestFailed("d.foo should be undefined now")
 
     # Test a nasty bug in recurse_down_subclasses()
     import gc
@@ -3200,7 +3200,7 @@
     d = D()
     try: del d[0]
     except TypeError: pass
-    else: raise TestFailed, "invalid del() didn't raise TypeError"
+    else: raise TestFailed("invalid del() didn't raise TypeError")
 
 def hashinherit():
     if verbose: print("Testing hash of mutable subclasses...")
@@ -3213,7 +3213,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "hash() of dict subclass should fail"
+        raise TestFailed("hash() of dict subclass should fail")
 
     class mylist(list):
         pass
@@ -3223,48 +3223,48 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "hash() of list subclass should fail"
+        raise TestFailed("hash() of list subclass should fail")
 
 def strops():
     try: 'a' + 5
     except TypeError: pass
-    else: raise TestFailed, "'' + 5 doesn't raise TypeError"
+    else: raise TestFailed("'' + 5 doesn't raise TypeError")
 
     try: ''.split('')
     except ValueError: pass
-    else: raise TestFailed, "''.split('') doesn't raise ValueError"
+    else: raise TestFailed("''.split('') doesn't raise ValueError")
 
     try: ''.join([0])
     except TypeError: pass
-    else: raise TestFailed, "''.join([0]) doesn't raise TypeError"
+    else: raise TestFailed("''.join([0]) doesn't raise TypeError")
 
     try: ''.rindex('5')
     except ValueError: pass
-    else: raise TestFailed, "''.rindex('5') doesn't raise ValueError"
+    else: raise TestFailed("''.rindex('5') doesn't raise ValueError")
 
     try: '%(n)s' % None
     except TypeError: pass
-    else: raise TestFailed, "'%(n)s' % None doesn't raise TypeError"
+    else: raise TestFailed("'%(n)s' % None doesn't raise TypeError")
 
     try: '%(n' % {}
     except ValueError: pass
-    else: raise TestFailed, "'%(n' % {} '' doesn't raise ValueError"
+    else: raise TestFailed("'%(n' % {} '' doesn't raise ValueError")
 
     try: '%*s' % ('abc')
     except TypeError: pass
-    else: raise TestFailed, "'%*s' % ('abc') doesn't raise TypeError"
+    else: raise TestFailed("'%*s' % ('abc') doesn't raise TypeError")
 
     try: '%*.*s' % ('abc', 5)
     except TypeError: pass
-    else: raise TestFailed, "'%*.*s' % ('abc', 5) doesn't raise TypeError"
+    else: raise TestFailed("'%*.*s' % ('abc', 5) doesn't raise TypeError")
 
     try: '%s' % (1, 2)
     except TypeError: pass
-    else: raise TestFailed, "'%s' % (1, 2) doesn't raise TypeError"
+    else: raise TestFailed("'%s' % (1, 2) doesn't raise TypeError")
 
     try: '%' % None
     except ValueError: pass
-    else: raise TestFailed, "'%' % None doesn't raise ValueError"
+    else: raise TestFailed("'%' % None doesn't raise ValueError")
 
     vereq('534253'.isdigit(), 1)
     vereq('534253x'.isdigit(), 0)
@@ -3595,14 +3595,14 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't turn list subclass into dict subclass"
+        raise TestFailed("shouldn't turn list subclass into dict subclass")
 
     try:
         list.__bases__ = (dict,)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't be able to assign to list.__bases__"
+        raise TestFailed("shouldn't be able to assign to list.__bases__")
 
     try:
         D.__bases__ = (C2, list)
@@ -3616,15 +3616,15 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't be able to delete .__bases__"
+        raise TestFailed("shouldn't be able to delete .__bases__")
 
     try:
         D.__bases__ = ()
     except TypeError as msg:
         if str(msg) == "a new-style class can't have only classic bases":
-            raise TestFailed, "wrong error message for .__bases__ = ()"
+            raise TestFailed("wrong error message for .__bases__ = ()")
     else:
-        raise TestFailed, "shouldn't be able to set .__bases__ to ()"
+        raise TestFailed("shouldn't be able to set .__bases__ to ()")
 
     try:
         D.__bases__ = (D,)
@@ -3632,21 +3632,21 @@
         pass
     else:
         # actually, we'll have crashed by here...
-        raise TestFailed, "shouldn't be able to create inheritance cycles"
+        raise TestFailed("shouldn't be able to create inheritance cycles")
 
     try:
         D.__bases__ = (C, C)
     except TypeError:
         pass
     else:
-        raise TestFailed, "didn't detect repeated base classes"
+        raise TestFailed("didn't detect repeated base classes")
 
     try:
         D.__bases__ = (E,)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't be able to create inheritance cycles"
+        raise TestFailed("shouldn't be able to create inheritance cycles")
 
 def test_mutable_bases_with_failing_mro():
     if verbose:
@@ -3657,7 +3657,7 @@
             return super(WorkOnce, self).__new__(WorkOnce, name, bases, ns)
         def mro(self):
             if self.flag > 0:
-                raise RuntimeError, "bozo"
+                raise RuntimeError("bozo")
             else:
                 self.flag += 1
                 return type.mro(self)
@@ -3701,7 +3701,7 @@
         vereq(E.__mro__, E_mro_before)
         vereq(D.__mro__, D_mro_before)
     else:
-        raise TestFailed, "exception not propagated"
+        raise TestFailed("exception not propagated")
 
 def test_mutable_bases_catch_mro_conflict():
     if verbose:
@@ -3726,7 +3726,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "didn't catch MRO conflict"
+        raise TestFailed("didn't catch MRO conflict")
 
 def mutable_names():
     if verbose:
@@ -3828,25 +3828,25 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't have allowed descr.__get__(None, None)"
+        raise TestFailed("shouldn't have allowed descr.__get__(None, None)")
     try:
         descr.__get__(42)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't have allowed descr.__get__(42)"
+        raise TestFailed("shouldn't have allowed descr.__get__(42)")
     try:
         descr.__get__(None, 42)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't have allowed descr.__get__(None, 42)"
+        raise TestFailed("shouldn't have allowed descr.__get__(None, 42)")
     try:
         descr.__get__(None, int)
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't have allowed descr.__get__(None, int)"
+        raise TestFailed("shouldn't have allowed descr.__get__(None, int)")
 
 def isinst_isclass():
     if verbose:
@@ -3920,13 +3920,13 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "Carlo Verre __setattr__ suceeded!"
+        raise TestFailed("Carlo Verre __setattr__ suceeded!")
     try:
         object.__delattr__(str, "lower")
     except TypeError:
         pass
     else:
-        raise TestFailed, "Carlo Verre __delattr__ succeeded!"
+        raise TestFailed("Carlo Verre __delattr__ succeeded!")
 
 def weakref_segfault():
     # SF 742911
@@ -4012,7 +4012,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "did not test __init__() for None return"
+        raise TestFailed("did not test __init__() for None return")
 
 def methodwrapper():
     # <type 'method-wrapper'> did not support any reflection before 2.5

Modified: python/branches/py3k/Lib/test/test_descrtut.py
==============================================================================
--- python/branches/py3k/Lib/test/test_descrtut.py	(original)
+++ python/branches/py3k/Lib/test/test_descrtut.py	Thu Aug 30 01:37:32 2007
@@ -313,7 +313,7 @@
     ...
     ...     def __set__(self, inst, value):
     ...         if self.__set is None:
-    ...             raise AttributeError, "this attribute is read-only"
+    ...             raise AttributeError("this attribute is read-only")
     ...         return self.__set(inst, value)
 
 Now let's define a class with an attribute x defined by a pair of methods,

Modified: python/branches/py3k/Lib/test/test_dl.py
==============================================================================
--- python/branches/py3k/Lib/test/test_dl.py	(original)
+++ python/branches/py3k/Lib/test/test_dl.py	Thu Aug 30 01:37:32 2007
@@ -31,4 +31,4 @@
             print('worked!')
         break
 else:
-    raise TestSkipped, 'Could not open any shared libraries'
+    raise TestSkipped('Could not open any shared libraries')

Modified: python/branches/py3k/Lib/test/test_doctest.py
==============================================================================
--- python/branches/py3k/Lib/test/test_doctest.py	(original)
+++ python/branches/py3k/Lib/test/test_doctest.py	Thu Aug 30 01:37:32 2007
@@ -811,7 +811,7 @@
 
     >>> def f(x):
     ...     r'''
-    ...     >>> raise ValueError, 'multi\nline\nmessage'
+    ...     >>> raise ValueError('multi\nline\nmessage')
     ...     Traceback (most recent call last):
     ...     ValueError: multi
     ...     line
@@ -826,7 +826,7 @@
 
     >>> def f(x):
     ...     r'''
-    ...     >>> raise ValueError, 'message'
+    ...     >>> raise ValueError('message')
     ...     Traceback (most recent call last):
     ...     ValueError: wrong message
     ...     '''
@@ -836,7 +836,7 @@
     **********************************************************************
     File ..., line 3, in f
     Failed example:
-        raise ValueError, 'message'
+        raise ValueError('message')
     Expected:
         Traceback (most recent call last):
         ValueError: wrong message
@@ -851,7 +851,7 @@
 
     >>> def f(x):
     ...     r'''
-    ...     >>> raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL
+    ...     >>> raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
     ...     Traceback (most recent call last):
     ...     ValueError: wrong message
     ...     '''
@@ -863,7 +863,7 @@
 
     >>> def f(x):
     ...     r'''
-    ...     >>> raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL
+    ...     >>> raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
     ...     Traceback (most recent call last):
     ...     TypeError: wrong type
     ...     '''
@@ -873,7 +873,7 @@
     **********************************************************************
     File ..., line 3, in f
     Failed example:
-        raise ValueError, 'message' #doctest: +IGNORE_EXCEPTION_DETAIL
+        raise ValueError('message') #doctest: +IGNORE_EXCEPTION_DETAIL
     Expected:
         Traceback (most recent call last):
         TypeError: wrong type

Modified: python/branches/py3k/Lib/test/test_exception_variations.py
==============================================================================
--- python/branches/py3k/Lib/test/test_exception_variations.py	(original)
+++ python/branches/py3k/Lib/test/test_exception_variations.py	Thu Aug 30 01:37:32 2007
@@ -9,7 +9,7 @@
         hit_finally = False
 
         try:
-            raise Exception, 'nyaa!'
+            raise Exception('nyaa!')
         except:
             hit_except = True
         else:
@@ -44,7 +44,7 @@
         hit_finally = False
 
         try:
-            raise Exception, 'yarr!'
+            raise Exception('yarr!')
         except:
             hit_except = True
         finally:
@@ -71,7 +71,7 @@
         hit_except = False
 
         try:
-            raise Exception, 'ahoy!'
+            raise Exception('ahoy!')
         except:
             hit_except = True
 
@@ -92,7 +92,7 @@
         hit_else = False
 
         try:
-            raise Exception, 'foo!'
+            raise Exception('foo!')
         except:
             hit_except = True
         else:
@@ -132,7 +132,7 @@
 
         try:
             try:
-                raise Exception, 'inner exception'
+                raise Exception('inner exception')
             except:
                 hit_inner_except = True
             finally:
@@ -159,7 +159,7 @@
             else:
                 hit_inner_else = True
 
-            raise Exception, 'outer exception'
+            raise Exception('outer exception')
         except:
             hit_except = True
         else:

Modified: python/branches/py3k/Lib/test/test_extcall.py
==============================================================================
--- python/branches/py3k/Lib/test/test_extcall.py	(original)
+++ python/branches/py3k/Lib/test/test_extcall.py	Thu Aug 30 01:37:32 2007
@@ -90,7 +90,7 @@
         if i < 3:
             return i
         else:
-            raise IndexError, i
+            raise IndexError(i)
 g(*Nothing())
 
 class Nothing:
@@ -253,7 +253,7 @@
 except TypeError:
     pass
 else:
-    raise TestFailed, 'expected TypeError; no exception raised'
+    raise TestFailed('expected TypeError; no exception raised')
 
 a, b, d, e, v, k = 'A', 'B', 'D', 'E', 'V', 'K'
 funcs = []

Modified: python/branches/py3k/Lib/test/test_fork1.py
==============================================================================
--- python/branches/py3k/Lib/test/test_fork1.py	(original)
+++ python/branches/py3k/Lib/test/test_fork1.py	Thu Aug 30 01:37:32 2007
@@ -9,7 +9,7 @@
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_fork1"
+    raise TestSkipped("os.fork not defined -- skipping test_fork1")
 
 class ForkTest(ForkWait):
     def wait_impl(self, cpid):

Modified: python/branches/py3k/Lib/test/test_format.py
==============================================================================
--- python/branches/py3k/Lib/test/test_format.py	(original)
+++ python/branches/py3k/Lib/test/test_format.py	Thu Aug 30 01:37:32 2007
@@ -216,7 +216,7 @@
         print('Unexpected exception')
         raise
     else:
-        raise TestFailed, 'did not get expected exception: %s' % excmsg
+        raise TestFailed('did not get expected exception: %s' % excmsg)
 
 test_exc('abc %a', 1, ValueError,
          "unsupported format character 'a' (0x61) at index 5")
@@ -241,4 +241,4 @@
     except MemoryError:
         pass
     else:
-        raise TestFailed, '"%*d"%(maxsize, -127) should fail'
+        raise TestFailed('"%*d"%(maxsize, -127) should fail')

Modified: python/branches/py3k/Lib/test/test_funcattrs.py
==============================================================================
--- python/branches/py3k/Lib/test/test_funcattrs.py	(original)
+++ python/branches/py3k/Lib/test/test_funcattrs.py	Thu Aug 30 01:37:32 2007
@@ -17,40 +17,40 @@
 try:
     b.publish
 except AttributeError: pass
-else: raise TestFailed, 'expected AttributeError'
+else: raise TestFailed('expected AttributeError')
 
 if b.__dict__ != {}:
-    raise TestFailed, 'expected unassigned func.__dict__ to be {}'
+    raise TestFailed('expected unassigned func.__dict__ to be {}')
 
 b.publish = 1
 if b.publish != 1:
-    raise TestFailed, 'function attribute not set to expected value'
+    raise TestFailed('function attribute not set to expected value')
 
 docstring = 'its docstring'
 b.__doc__ = docstring
 if b.__doc__ != docstring:
-    raise TestFailed, 'problem with setting __doc__ attribute'
+    raise TestFailed('problem with setting __doc__ attribute')
 
 if 'publish' not in dir(b):
-    raise TestFailed, 'attribute not in dir()'
+    raise TestFailed('attribute not in dir()')
 
 try:
     del b.__dict__
 except TypeError: pass
-else: raise TestFailed, 'del func.__dict__ expected TypeError'
+else: raise TestFailed('del func.__dict__ expected TypeError')
 
 b.publish = 1
 try:
     b.__dict__ = None
 except TypeError: pass
-else: raise TestFailed, 'func.__dict__ = None expected TypeError'
+else: raise TestFailed('func.__dict__ = None expected TypeError')
 
 d = {'hello': 'world'}
 b.__dict__ = d
 if b.__dict__ is not d:
-    raise TestFailed, 'func.__dict__ assignment to dictionary failed'
+    raise TestFailed('func.__dict__ assignment to dictionary failed')
 if b.hello != 'world':
-    raise TestFailed, 'attribute after func.__dict__ assignment failed'
+    raise TestFailed('attribute after func.__dict__ assignment failed')
 
 f1 = F()
 f2 = F()
@@ -58,45 +58,45 @@
 try:
     F.a.publish
 except AttributeError: pass
-else: raise TestFailed, 'expected AttributeError'
+else: raise TestFailed('expected AttributeError')
 
 try:
     f1.a.publish
 except AttributeError: pass
-else: raise TestFailed, 'expected AttributeError'
+else: raise TestFailed('expected AttributeError')
 
 # In Python 2.1 beta 1, we disallowed setting attributes on unbound methods
 # (it was already disallowed on bound methods).  See the PEP for details.
 try:
     F.a.publish = 1
 except (AttributeError, TypeError): pass
-else: raise TestFailed, 'expected AttributeError or TypeError'
+else: raise TestFailed('expected AttributeError or TypeError')
 
 # But setting it explicitly on the underlying function object is okay.
 F.a.im_func.publish = 1
 
 if F.a.publish != 1:
-    raise TestFailed, 'unbound method attribute not set to expected value'
+    raise TestFailed('unbound method attribute not set to expected value')
 
 if f1.a.publish != 1:
-    raise TestFailed, 'bound method attribute access did not work'
+    raise TestFailed('bound method attribute access did not work')
 
 if f2.a.publish != 1:
-    raise TestFailed, 'bound method attribute access did not work'
+    raise TestFailed('bound method attribute access did not work')
 
 if 'publish' not in dir(F.a):
-    raise TestFailed, 'attribute not in dir()'
+    raise TestFailed('attribute not in dir()')
 
 try:
     f1.a.publish = 0
 except (AttributeError, TypeError): pass
-else: raise TestFailed, 'expected AttributeError or TypeError'
+else: raise TestFailed('expected AttributeError or TypeError')
 
 # See the comment above about the change in semantics for Python 2.1b1
 try:
     F.a.myclass = F
 except (AttributeError, TypeError): pass
-else: raise TestFailed, 'expected AttributeError or TypeError'
+else: raise TestFailed('expected AttributeError or TypeError')
 
 F.a.im_func.myclass = F
 
@@ -107,18 +107,18 @@
 
 if f1.a.myclass is not f2.a.myclass or \
        f1.a.myclass is not F.a.myclass:
-    raise TestFailed, 'attributes were not the same'
+    raise TestFailed('attributes were not the same')
 
 # try setting __dict__
 try:
     F.a.__dict__ = (1, 2, 3)
 except (AttributeError, TypeError): pass
-else: raise TestFailed, 'expected TypeError or AttributeError'
+else: raise TestFailed('expected TypeError or AttributeError')
 
 F.a.im_func.__dict__ = {'one': 11, 'two': 22, 'three': 33}
 
 if f1.a.two != 22:
-    raise TestFailed, 'setting __dict__'
+    raise TestFailed('setting __dict__')
 
 from UserDict import UserDict
 d = UserDict({'four': 44, 'five': 55})
@@ -225,13 +225,13 @@
     except exception:
         pass
     else:
-        raise TestFailed, "shouldn't be able to set %s to %r" % (name, value)
+        raise TestFailed("shouldn't be able to set %s to %r" % (name, value))
     try:
         delattr(obj, name)
     except (AttributeError, TypeError):
         pass
     else:
-        raise TestFailed, "shouldn't be able to del %s" % name
+        raise TestFailed("shouldn't be able to del %s" % name)
 
 def test_func_closure():
     a = 12
@@ -298,7 +298,7 @@
     except TypeError:
         pass
     else:
-        raise TestFailed, "shouldn't be allowed to call g() w/o defaults"
+        raise TestFailed("shouldn't be allowed to call g() w/o defaults")
 
 def test_func_dict():
     def f(): pass

Modified: python/branches/py3k/Lib/test/test_gdbm.py
==============================================================================
--- python/branches/py3k/Lib/test/test_gdbm.py	(original)
+++ python/branches/py3k/Lib/test/test_gdbm.py	Thu Aug 30 01:37:32 2007
@@ -24,7 +24,7 @@
 except error:
     pass
 else:
-    raise TestFailed, "expected gdbm.error accessing closed database"
+    raise TestFailed("expected gdbm.error accessing closed database")
 g = gdbm.open(filename, 'r')
 g.close()
 g = gdbm.open(filename, 'w')
@@ -37,7 +37,7 @@
 except error:
     pass
 else:
-    raise TestFailed, "expected gdbm.error when passing invalid open flags"
+    raise TestFailed("expected gdbm.error when passing invalid open flags")
 
 try:
     import os

Modified: python/branches/py3k/Lib/test/test_importhooks.py
==============================================================================
--- python/branches/py3k/Lib/test/test_importhooks.py	(original)
+++ python/branches/py3k/Lib/test/test_importhooks.py	Thu Aug 30 01:37:32 2007
@@ -105,7 +105,7 @@
             return self
         return None
     def load_module(self, fullname):
-        raise ImportError, "I dare you"
+        raise ImportError("I dare you")
 
 
 class ImpWrapper:

Modified: python/branches/py3k/Lib/test/test_iter.py
==============================================================================
--- python/branches/py3k/Lib/test/test_iter.py	(original)
+++ python/branches/py3k/Lib/test/test_iter.py	Thu Aug 30 01:37:32 2007
@@ -825,7 +825,7 @@
             i = state[0]
             state[0] = i+1
             if i == 10:
-                raise AssertionError, "shouldn't have gotten this far"
+                raise AssertionError("shouldn't have gotten this far")
             return i
         b = iter(spam, 5)
         self.assertEqual(list(b), list(range(5)))

Modified: python/branches/py3k/Lib/test/test_largefile.py
==============================================================================
--- python/branches/py3k/Lib/test/test_largefile.py	(original)
+++ python/branches/py3k/Lib/test/test_largefile.py	Thu Aug 30 01:37:32 2007
@@ -44,8 +44,8 @@
     except (IOError, OverflowError):
         f.close()
         os.unlink(test_support.TESTFN)
-        raise test_support.TestSkipped, \
-              "filesystem does not have largefile support"
+        raise test_support.TestSkipped(
+                                "filesystem does not have largefile support")
     else:
         f.close()
 
@@ -56,8 +56,8 @@
     if got_this != expect_this:
         if test_support.verbose:
             print('no')
-        raise test_support.TestFailed, 'got %r, but expected %r' %\
-              (got_this, expect_this)
+        raise test_support.TestFailed('got %r, but expected %r'
+                                      % (got_this, expect_this))
     else:
         if test_support.verbose:
             print('yes')

Modified: python/branches/py3k/Lib/test/test_locale.py
==============================================================================
--- python/branches/py3k/Lib/test/test_locale.py	(original)
+++ python/branches/py3k/Lib/test/test_locale.py	Thu Aug 30 01:37:32 2007
@@ -3,7 +3,8 @@
 import sys
 
 if sys.platform == 'darwin':
-    raise TestSkipped("Locale support on MacOSX is minimal and cannot be tested")
+    raise TestSkipped(
+            "Locale support on MacOSX is minimal and cannot be tested")
 oldlocale = locale.setlocale(locale.LC_NUMERIC)
 
 if sys.platform.startswith("win"):
@@ -18,20 +19,22 @@
     except locale.Error:
         continue
 else:
-    raise ImportError, "test locale not supported (tried %s)"%(', '.join(tlocs))
+    raise ImportError(
+            "test locale not supported (tried %s)" % (', '.join(tlocs)))
 
 def testformat(formatstr, value, grouping = 0, output=None, func=locale.format):
     if verbose:
         if output:
-            print("%s %% %s =? %s ..." %\
-                (repr(formatstr), repr(value), repr(output)), end=' ')
+            print("%s %% %s =? %s ..." %
+                  (repr(formatstr), repr(value), repr(output)), end=' ')
         else:
-            print("%s %% %s works? ..." % (repr(formatstr), repr(value)), end=' ')
+            print("%s %% %s works? ..." % (repr(formatstr), repr(value)),
+                  end=' ')
     result = func(formatstr, value, grouping = grouping)
     if output and result != output:
         if verbose:
             print('no')
-        print("%s %% %s == %s != %s" %\
+        print("%s %% %s == %s != %s" %
               (repr(formatstr), repr(value), repr(result), repr(output)))
     else:
         if verbose:

Modified: python/branches/py3k/Lib/test/test_logging.py
==============================================================================
--- python/branches/py3k/Lib/test/test_logging.py	(original)
+++ python/branches/py3k/Lib/test/test_logging.py	Thu Aug 30 01:37:32 2007
@@ -595,7 +595,7 @@
         else:
             break
     else:
-        raise ImportError, "Could not find unused port"
+        raise ImportError("Could not find unused port")
 
 
     #Set up a handler such that all events are sent via a socket to the log

Modified: python/branches/py3k/Lib/test/test_openpty.py
==============================================================================
--- python/branches/py3k/Lib/test/test_openpty.py	(original)
+++ python/branches/py3k/Lib/test/test_openpty.py	Thu Aug 30 01:37:32 2007
@@ -4,7 +4,7 @@
 from test.test_support import run_unittest, TestSkipped
 
 if not hasattr(os, "openpty"):
-    raise TestSkipped, "No openpty() available."
+    raise TestSkipped("No openpty() available.")
 
 
 class OpenptyTest(unittest.TestCase):

Modified: python/branches/py3k/Lib/test/test_pep277.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pep277.py	(original)
+++ python/branches/py3k/Lib/test/test_pep277.py	Thu Aug 30 01:37:32 2007
@@ -3,7 +3,7 @@
 import sys, os, unittest
 from test import test_support
 if not os.path.supports_unicode_filenames:
-    raise test_support.TestSkipped, "test works only on NT+"
+    raise test_support.TestSkipped("test works only on NT+")
 
 filenames = [
     'abc',

Modified: python/branches/py3k/Lib/test/test_pkgimport.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pkgimport.py	(original)
+++ python/branches/py3k/Lib/test/test_pkgimport.py	Thu Aug 30 01:37:32 2007
@@ -51,7 +51,7 @@
         self.rewrite_file('for')
         try: __import__(self.module_name)
         except SyntaxError: pass
-        else: raise RuntimeError, 'Failed to induce SyntaxError'
+        else: raise RuntimeError('Failed to induce SyntaxError')
         self.assert_(self.module_name not in sys.modules and
                      not hasattr(sys.modules[self.package_name], 'foo'))
 
@@ -65,7 +65,7 @@
 
         try: __import__(self.module_name)
         except NameError: pass
-        else: raise RuntimeError, 'Failed to induce NameError.'
+        else: raise RuntimeError('Failed to induce NameError.')
 
         # ...now  change  the module  so  that  the NameError  doesn't
         # happen

Modified: python/branches/py3k/Lib/test/test_poll.py
==============================================================================
--- python/branches/py3k/Lib/test/test_poll.py	(original)
+++ python/branches/py3k/Lib/test/test_poll.py	Thu Aug 30 01:37:32 2007
@@ -6,7 +6,7 @@
 try:
     select.poll
 except AttributeError:
-    raise TestSkipped, "select.poll not defined -- skipping test_poll"
+    raise TestSkipped("select.poll not defined -- skipping test_poll")
 
 
 def find_ready_matching(ready, flag):
@@ -47,14 +47,14 @@
             ready = p.poll()
             ready_writers = find_ready_matching(ready, select.POLLOUT)
             if not ready_writers:
-                raise RuntimeError, "no pipes ready for writing"
+                raise RuntimeError("no pipes ready for writing")
             wr = random.choice(ready_writers)
             os.write(wr, MSG)
 
             ready = p.poll()
             ready_readers = find_ready_matching(ready, select.POLLIN)
             if not ready_readers:
-                raise RuntimeError, "no pipes ready for reading"
+                raise RuntimeError("no pipes ready for reading")
             rd = random.choice(ready_readers)
             buf = os.read(rd, MSG_LEN)
             self.assertEqual(len(buf), MSG_LEN)

Modified: python/branches/py3k/Lib/test/test_posix.py
==============================================================================
--- python/branches/py3k/Lib/test/test_posix.py	(original)
+++ python/branches/py3k/Lib/test/test_posix.py	Thu Aug 30 01:37:32 2007
@@ -5,7 +5,7 @@
 try:
     import posix
 except ImportError:
-    raise test_support.TestSkipped, "posix is not available"
+    raise test_support.TestSkipped("posix is not available")
 
 import time
 import os

Modified: python/branches/py3k/Lib/test/test_pty.py
==============================================================================
--- python/branches/py3k/Lib/test/test_pty.py	(original)
+++ python/branches/py3k/Lib/test/test_pty.py	Thu Aug 30 01:37:32 2007
@@ -69,7 +69,7 @@
             debug("Got slave_fd '%d'" % slave_fd)
         except OSError:
             # " An optional feature could not be imported " ... ?
-            raise TestSkipped, "Pseudo-terminals (seemingly) not functional."
+            raise TestSkipped("Pseudo-terminals (seemingly) not functional.")
 
         self.assertTrue(os.isatty(slave_fd), 'slave_fd is not a tty')
 

Modified: python/branches/py3k/Lib/test/test_queue.py
==============================================================================
--- python/branches/py3k/Lib/test/test_queue.py	(original)
+++ python/branches/py3k/Lib/test/test_queue.py	Thu Aug 30 01:37:32 2007
@@ -87,17 +87,17 @@
     def _put(self, item):
         if self.fail_next_put:
             self.fail_next_put = False
-            raise FailingQueueException, "You Lose"
+            raise FailingQueueException("You Lose")
         return Queue.Queue._put(self, item)
     def _get(self):
         if self.fail_next_get:
             self.fail_next_get = False
-            raise FailingQueueException, "You Lose"
+            raise FailingQueueException("You Lose")
         return Queue.Queue._get(self)
 
 def FailingQueueTest(q):
     if not q.empty():
-        raise RuntimeError, "Call this function with an empty queue"
+        raise RuntimeError("Call this function with an empty queue")
     for i in range(QUEUE_SIZE-1):
         q.put(i)
     # Test a failing non-blocking put.
@@ -178,7 +178,7 @@
 
 def SimpleQueueTest(q):
     if not q.empty():
-        raise RuntimeError, "Call this function with an empty queue"
+        raise RuntimeError("Call this function with an empty queue")
     # I guess we better check things actually queue correctly a little :)
     q.put(111)
     q.put(222)

Modified: python/branches/py3k/Lib/test/test_re.py
==============================================================================
--- python/branches/py3k/Lib/test/test_re.py	(original)
+++ python/branches/py3k/Lib/test/test_re.py	Thu Aug 30 01:37:32 2007
@@ -612,7 +612,7 @@
         elif len(t) == 3:
             pattern, s, outcome = t
         else:
-            raise ValueError, ('Test tuples should have 3 or 5 fields', t)
+            raise ValueError('Test tuples should have 3 or 5 fields', t)
 
         try:
             obj = re.compile(pattern)

Modified: python/branches/py3k/Lib/test/test_richcmp.py
==============================================================================
--- python/branches/py3k/Lib/test/test_richcmp.py	(original)
+++ python/branches/py3k/Lib/test/test_richcmp.py	Thu Aug 30 01:37:32 2007
@@ -29,7 +29,7 @@
         return self.x >= other
 
     def __cmp__(self, other):
-        raise test_support.TestFailed, "Number.__cmp__() should not be called"
+        raise test_support.TestFailed("Number.__cmp__() should not be called")
 
     def __repr__(self):
         return "Number(%r)" % (self.x, )
@@ -49,13 +49,13 @@
         self.data[i] = v
 
     def __hash__(self):
-        raise TypeError, "Vectors cannot be hashed"
+        raise TypeError("Vectors cannot be hashed")
 
     def __bool__(self):
-        raise TypeError, "Vectors cannot be used in Boolean contexts"
+        raise TypeError("Vectors cannot be used in Boolean contexts")
 
     def __cmp__(self, other):
-        raise test_support.TestFailed, "Vector.__cmp__() should not be called"
+        raise test_support.TestFailed("Vector.__cmp__() should not be called")
 
     def __repr__(self):
         return "Vector(%r)" % (self.data, )
@@ -82,7 +82,7 @@
         if isinstance(other, Vector):
             other = other.data
         if len(self.data) != len(other):
-            raise ValueError, "Cannot compare vectors of different length"
+            raise ValueError("Cannot compare vectors of different length")
         return other
 
 opmap = {
@@ -196,10 +196,10 @@
             def __lt__(self, other): return 0
             def __gt__(self, other): return 0
             def __eq__(self, other): return 0
-            def __le__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ge__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ne__(self, other): raise TestFailed, "This shouldn't happen"
-            def __cmp__(self, other): raise RuntimeError, "expected"
+            def __le__(self, other): raise TestFailed("This shouldn't happen")
+            def __ge__(self, other): raise TestFailed("This shouldn't happen")
+            def __ne__(self, other): raise TestFailed("This shouldn't happen")
+            def __cmp__(self, other): raise RuntimeError("expected")
         a = Misb()
         b = Misb()
         self.assertEqual(a<b, 0)

Modified: python/branches/py3k/Lib/test/test_scope.py
==============================================================================
--- python/branches/py3k/Lib/test/test_scope.py	(original)
+++ python/branches/py3k/Lib/test/test_scope.py	Thu Aug 30 01:37:32 2007
@@ -177,7 +177,7 @@
             if x >= 0:
                 return fact(x)
             else:
-                raise ValueError, "x must be >= 0"
+                raise ValueError("x must be >= 0")
 
         self.assertEqual(f(6), 720)
 

Modified: python/branches/py3k/Lib/test/test_socket.py
==============================================================================
--- python/branches/py3k/Lib/test/test_socket.py	(original)
+++ python/branches/py3k/Lib/test/test_socket.py	Thu Aug 30 01:37:32 2007
@@ -125,7 +125,7 @@
         self.client_ready.set()
         self.clientSetUp()
         if not hasattr(test_func, '__call__'):
-            raise TypeError, "test_func must be a callable function"
+            raise TypeError("test_func must be a callable function")
         try:
             test_func()
         except Exception as strerror:
@@ -133,7 +133,7 @@
         self.clientTearDown()
 
     def clientSetUp(self):
-        raise NotImplementedError, "clientSetUp must be implemented."
+        raise NotImplementedError("clientSetUp must be implemented.")
 
     def clientTearDown(self):
         self.done.set()

Modified: python/branches/py3k/Lib/test/test_socketserver.py
==============================================================================
--- python/branches/py3k/Lib/test/test_socketserver.py	(original)
+++ python/branches/py3k/Lib/test/test_socketserver.py	Thu Aug 30 01:37:32 2007
@@ -45,7 +45,7 @@
     if sock in r:
         return sock.recv(n)
     else:
-        raise RuntimeError, "timed out on %r" % (sock,)
+        raise RuntimeError("timed out on %r" % (sock,))
 
 def testdgram(proto, addr):
     s = socket.socket(proto, socket.SOCK_DGRAM)

Modified: python/branches/py3k/Lib/test/test_struct.py
==============================================================================
--- python/branches/py3k/Lib/test/test_struct.py	(original)
+++ python/branches/py3k/Lib/test/test_struct.py	Thu Aug 30 01:37:32 2007
@@ -36,8 +36,8 @@
     except struct.error:
         pass
     else:
-        raise TestFailed, "%s%s did not raise struct.error" % (
-            func.__name__, args)
+        raise TestFailed("%s%s did not raise struct.error" % (
+            func.__name__, args))
 
 def any_err(func, *args):
     try:
@@ -45,8 +45,8 @@
     except (struct.error, TypeError):
         pass
     else:
-        raise TestFailed, "%s%s did not raise error" % (
-            func.__name__, args)
+        raise TestFailed("%s%s did not raise error" % (
+            func.__name__, args))
 
 def with_warning_restore(func):
     def _with_warning_restore(*args, **kw):
@@ -70,11 +70,11 @@
         pass
     except DeprecationWarning:
         if not PY_STRUCT_OVERFLOW_MASKING:
-            raise TestFailed, "%s%s expected to raise struct.error" % (
-                func.__name__, args)
+            raise TestFailed("%s%s expected to raise struct.error" % (
+                func.__name__, args))
     else:
-        raise TestFailed, "%s%s did not raise error" % (
-            func.__name__, args)
+        raise TestFailed("%s%s did not raise error" % (
+            func.__name__, args))
 deprecated_err = with_warning_restore(deprecated_err)
 
 
@@ -82,15 +82,15 @@
 
 sz = struct.calcsize('i')
 if sz * 3 != struct.calcsize('iii'):
-    raise TestFailed, 'inconsistent sizes'
+    raise TestFailed('inconsistent sizes')
 
 fmt = 'cbxxxxxxhhhhiillffdt'
 fmt3 = '3c3b18x12h6i6l6f3d3t'
 sz = struct.calcsize(fmt)
 sz3 = struct.calcsize(fmt3)
 if sz * 3 != sz3:
-    raise TestFailed, 'inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % (
-        fmt, sz, 3*sz, fmt3, sz3)
+    raise TestFailed('inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % (
+        fmt, sz, 3*sz, fmt3, sz3))
 
 simple_err(struct.pack, 'iii', 3)
 simple_err(struct.pack, 'i', 3, 3, 3)
@@ -121,8 +121,8 @@
             int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d) or
                         tp != t):
             # ^^^ calculate only to two decimal places
-            raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
-                str(format), str((cp, bp, hp, ip, lp, fp, dp, tp)))
+            raise TestFailed("unpack/pack not transitive (%s, %s)" % (
+                str(format), str((cp, bp, hp, ip, lp, fp, dp, tp))))
 
 # Test some of the new features in detail
 
@@ -176,16 +176,16 @@
                         ('='+fmt, ISBIGENDIAN and big or lil)]:
         res = struct.pack(xfmt, arg)
         if res != exp:
-            raise TestFailed, "pack(%r, %r) -> %r # expected %r" % (
-                fmt, arg, res, exp)
+            raise TestFailed("pack(%r, %r) -> %r # expected %r" % (
+                fmt, arg, res, exp))
         n = struct.calcsize(xfmt)
         if n != len(res):
-            raise TestFailed, "calcsize(%r) -> %d # expected %d" % (
-                xfmt, n, len(res))
+            raise TestFailed("calcsize(%r) -> %d # expected %d" % (
+                xfmt, n, len(res)))
         rev = struct.unpack(xfmt, res)[0]
         if rev != arg and not asy:
-            raise TestFailed, "unpack(%r, %r) -> (%r,) # expected (%r,)" % (
-                fmt, res, rev, arg)
+            raise TestFailed("unpack(%r, %r) -> (%r,) # expected (%r,)" % (
+                fmt, res, rev, arg))
 
 ###########################################################################
 # Simple native q/Q tests.

Modified: python/branches/py3k/Lib/test/test_thread.py
==============================================================================
--- python/branches/py3k/Lib/test/test_thread.py	(original)
+++ python/branches/py3k/Lib/test/test_thread.py	Thu Aug 30 01:37:32 2007
@@ -108,7 +108,7 @@
 
 print('\n*** Barrier Test ***')
 if done.acquire(0):
-    raise ValueError, "'done' should have remained acquired"
+    raise ValueError("'done' should have remained acquired")
 bar = barrier(numtasks)
 running = numtasks
 for i in range(numtasks):
@@ -119,11 +119,11 @@
 # not all platforms support changing thread stack size
 print('\n*** Changing thread stack size ***')
 if thread.stack_size() != 0:
-    raise ValueError, "initial stack_size not 0"
+    raise ValueError("initial stack_size not 0")
 
 thread.stack_size(0)
 if thread.stack_size() != 0:
-    raise ValueError, "stack_size not reset to default"
+    raise ValueError("stack_size not reset to default")
 
 from os import name as os_name
 if os_name in ("nt", "os2", "posix"):
@@ -143,7 +143,7 @@
         for tss in (262144, 0x100000, 0):
             thread.stack_size(tss)
             if failed(thread.stack_size(), tss):
-                raise ValueError, fail_msg % tss
+                raise ValueError(fail_msg % tss)
             print('successfully set stack_size(%d)' % tss)
 
         for tss in (262144, 0x100000):

Modified: python/branches/py3k/Lib/test/test_threadsignals.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threadsignals.py	(original)
+++ python/branches/py3k/Lib/test/test_threadsignals.py	Thu Aug 30 01:37:32 2007
@@ -8,7 +8,7 @@
 from test.test_support import run_unittest, TestSkipped
 
 if sys.platform[:3] in ('win', 'os2'):
-    raise TestSkipped, "Can't test signal on %s" % sys.platform
+    raise TestSkipped("Can't test signal on %s" % sys.platform)
 
 process_pid = os.getpid()
 signalled_all=thread.allocate_lock()

Modified: python/branches/py3k/Lib/test/test_trace.py
==============================================================================
--- python/branches/py3k/Lib/test/test_trace.py	(original)
+++ python/branches/py3k/Lib/test/test_trace.py	Thu Aug 30 01:37:32 2007
@@ -314,7 +314,7 @@
         def g(frame, why, extra):
             if (why == 'line' and
                 frame.f_lineno == f.__code__.co_firstlineno + 2):
-                raise RuntimeError, "i am crashing"
+                raise RuntimeError("i am crashing")
             return g
 
         sys.settrace(g)
@@ -558,7 +558,7 @@
             raise
     else:
         # Something's wrong - the expected exception wasn't raised.
-        raise RuntimeError, "Trace-function-less jump failed to fail"
+        raise RuntimeError("Trace-function-less jump failed to fail")
 
 
 class JumpTestCase(unittest.TestCase):

Modified: python/branches/py3k/Lib/test/test_traceback.py
==============================================================================
--- python/branches/py3k/Lib/test/test_traceback.py	(original)
+++ python/branches/py3k/Lib/test/test_traceback.py	Thu Aug 30 01:37:32 2007
@@ -15,7 +15,7 @@
         except exc as value:
             return traceback.format_exception_only(exc, value)
         else:
-            raise ValueError, "call did not raise exception"
+            raise ValueError("call did not raise exception")
 
     def syntax_error_with_caret(self):
         compile("def fact(x):\n\treturn x!\n", "?", "exec")

Modified: python/branches/py3k/Lib/test/test_unicode_file.py
==============================================================================
--- python/branches/py3k/Lib/test/test_unicode_file.py	(original)
+++ python/branches/py3k/Lib/test/test_unicode_file.py	Thu Aug 30 01:37:32 2007
@@ -25,7 +25,7 @@
         TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING)
         if '?' in TESTFN_ENCODED:
             # MBCS will not report the error properly
-            raise UnicodeError, "mbcs encoding problem"
+            raise UnicodeError("mbcs encoding problem")
     except (UnicodeError, TypeError):
         raise TestSkipped("Cannot find a suitable filename")
 

Modified: python/branches/py3k/Lib/test/test_univnewlines.py
==============================================================================
--- python/branches/py3k/Lib/test/test_univnewlines.py	(original)
+++ python/branches/py3k/Lib/test/test_univnewlines.py	Thu Aug 30 01:37:32 2007
@@ -5,8 +5,8 @@
 from test import test_support
 
 if not hasattr(sys.stdin, 'newlines'):
-    raise test_support.TestSkipped, \
-        "This Python does not have universal newline support"
+    raise test_support.TestSkipped(
+                       "This Python does not have universal newline support")
 
 FATX = 'x' * (2**14)
 

Modified: python/branches/py3k/Lib/test/test_wait3.py
==============================================================================
--- python/branches/py3k/Lib/test/test_wait3.py	(original)
+++ python/branches/py3k/Lib/test/test_wait3.py	Thu Aug 30 01:37:32 2007
@@ -9,12 +9,12 @@
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_wait3"
+    raise TestSkipped("os.fork not defined -- skipping test_wait3")
 
 try:
     os.wait3
 except AttributeError:
-    raise TestSkipped, "os.wait3 not defined -- skipping test_wait3"
+    raise TestSkipped("os.wait3 not defined -- skipping test_wait3")
 
 class Wait3Test(ForkWait):
     def wait_impl(self, cpid):

Modified: python/branches/py3k/Lib/test/test_wait4.py
==============================================================================
--- python/branches/py3k/Lib/test/test_wait4.py	(original)
+++ python/branches/py3k/Lib/test/test_wait4.py	Thu Aug 30 01:37:32 2007
@@ -9,12 +9,12 @@
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_wait4"
+    raise TestSkipped("os.fork not defined -- skipping test_wait4")
 
 try:
     os.wait4
 except AttributeError:
-    raise TestSkipped, "os.wait4 not defined -- skipping test_wait4"
+    raise TestSkipped("os.wait4 not defined -- skipping test_wait4")
 
 class Wait4Test(ForkWait):
     def wait_impl(self, cpid):

Modified: python/branches/py3k/Lib/test/test_wave.py
==============================================================================
--- python/branches/py3k/Lib/test/test_wave.py	(original)
+++ python/branches/py3k/Lib/test/test_wave.py	Thu Aug 30 01:37:32 2007
@@ -4,7 +4,7 @@
 
 def check(t, msg=None):
     if not t:
-        raise TestFailed, msg
+        raise TestFailed(msg)
 
 nchannels = 2
 sampwidth = 2

Modified: python/branches/py3k/Lib/test/time_hashlib.py
==============================================================================
--- python/branches/py3k/Lib/test/time_hashlib.py	(original)
+++ python/branches/py3k/Lib/test/time_hashlib.py	Thu Aug 30 01:37:32 2007
@@ -6,7 +6,7 @@
 
 
 def creatorFunc():
-    raise RuntimeError, "eek, creatorFunc not overridden"
+    raise RuntimeError("eek, creatorFunc not overridden")
 
 def test_scaled_msg(scale, name):
     iterations = 106201/scale * 20


More information about the Python-3000-checkins mailing list