[Python-checkins] r79563 - in python/branches/py3k-jit: Doc/howto/unicode.rst Doc/howto/webservers.rst Doc/includes/email-headers.py Doc/library/builtins.rst Doc/library/inspect.rst Doc/library/itertools.rst Doc/library/optparse.rst Doc/library/re.rst Doc/library/unicodedata.rst Doc/reference/expressions.rst Doc/tutorial/datastructures.rst Doc/whatsnew/2.7.rst Include/ceval.h Lib/argparse.py Lib/fractions.py Lib/idlelib/PyShell.py Lib/inspect.py Lib/lib2to3/fixes/fix_exitfunc.py Lib/lib2to3/pgen2/tokenize.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_parser.py Lib/py_compile.py Lib/pydoc.py Lib/site.py Lib/test/regrtest.py Lib/test/test_argparse.py Lib/test/test_bool.py Lib/test/test_decimal.py Lib/test/test_fractions.py Lib/test/test_httpservers.py Lib/test/test_index.py Lib/test/test_inspect.py Lib/test/test_multiprocessing.py Lib/test/test_ossaudiodev.py Lib/test/test_pep277.py Lib/test/test_platform.py Lib/test/test_pydoc.py Lib/test/test_subprocess.py Lib/test/test_sys.py Lib/test/test_unicodedata.py Lib/test/test_unittest.py Lib/test/test_warnings.py Lib/test/test_weakref.py Lib/turtle.py Lib/unittest/__init__.py Lib/unittest/main.py Lib/unittest/runner.py Lib/unittest/signals.py Lib/unittest/test Makefile.pre.in Misc/ACKS Misc/NEWS Misc/developers.txt Modules/_cursesmodule.c Modules/_ssl.c Modules/ossaudiodev.c Modules/unicodedata.c Objects/unicodeobject.c Objects/unicodetype_db.h Python/bltinmodule.c Python/ceval.c Python/import.c Tools/unicode/makeunicodedata.py configure configure.in

collin.winter python-checkins at python.org
Fri Apr 2 02:00:00 CEST 2010


Author: collin.winter
Date: Fri Apr  2 01:59:59 2010
New Revision: 79563

Log:
Merged revisions 79315,79317,79319,79321,79327,79333,79352,79360,79364,79368,79375,79380,79386,79389,79393,79398,79400-79401,79407,79409,79411,79414,79420,79429,79434,79449,79452,79454,79456,79458,79461-79463,79465-79467,79469,79472-79474,79484,79499,79501,79503,79505-79508,79520,79525,79531,79536,79538,79545,79553,79556 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79315 | ezio.melotti | 2010-03-22 16:16:42 -0700 (Mon, 22 Mar 2010) | 9 lines
  
  Merged revisions 79314 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79314 | ezio.melotti | 2010-03-23 01:07:32 +0200 (Tue, 23 Mar 2010) | 1 line
    
    Update the version number of the Unicode Database in a few more places.
  ........
................
  r79317 | antoine.pitrou | 2010-03-22 17:25:54 -0700 (Mon, 22 Mar 2010) | 5 lines
  
  Issue #8139: ossaudiodev didn't initialize its types properly, therefore
  some methods (such as oss_mixer_device.fileno()) were not available.
  Initial patch by Bertrand Janin.
................
  r79319 | ezio.melotti | 2010-03-22 17:32:49 -0700 (Mon, 22 Mar 2010) | 9 lines
  
  Merged revisions 79316 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79316 | ezio.melotti | 2010-03-23 02:25:19 +0200 (Tue, 23 Mar 2010) | 1 line
    
    Remove link to objects.rst (gone in r79179).
  ........
................
  r79321 | ezio.melotti | 2010-03-22 17:39:22 -0700 (Mon, 22 Mar 2010) | 9 lines
  
  Merged revisions 79320 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79320 | ezio.melotti | 2010-03-23 02:38:12 +0200 (Tue, 23 Mar 2010) | 1 line
    
    Link specifically to the UCD version 5.2.0.
  ........
................
  r79327 | benjamin.peterson | 2010-03-22 20:22:05 -0700 (Mon, 22 Mar 2010) | 54 lines
  
  Merged revisions 79306,79311,79325 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ................
    r79306 | benjamin.peterson | 2010-03-22 17:40:06 -0500 (Mon, 22 Mar 2010) | 21 lines
    
    Merged revisions 79077,79137,79304-79305 via svnmerge from 
    svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
    
    ........
      r79077 | benjamin.peterson | 2010-03-18 18:05:29 -0500 (Thu, 18 Mar 2010) | 1 line
      
      port detect_encoding improvements from py3k
    ........
      r79137 | benjamin.peterson | 2010-03-20 11:12:53 -0500 (Sat, 20 Mar 2010) | 1 line
      
      add a fixer for setting sys.exitfunc #2356
    ........
      r79304 | benjamin.peterson | 2010-03-22 17:20:22 -0500 (Mon, 22 Mar 2010) | 1 line
      
      fix test_parser when it's run in a path with spaces #7666
    ........
      r79305 | benjamin.peterson | 2010-03-22 17:27:07 -0500 (Mon, 22 Mar 2010) | 1 line
      
      normalize whitespace
    ........
  ................
    r79311 | benjamin.peterson | 2010-03-22 17:54:42 -0500 (Mon, 22 Mar 2010) | 9 lines
    
    Merged revisions 79309 via svnmerge from 
    svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
    
    ........
      r79309 | benjamin.peterson | 2010-03-22 17:50:47 -0500 (Mon, 22 Mar 2010) | 1 line
      
      pass correct symbol in
    ........
  ................
    r79325 | benjamin.peterson | 2010-03-22 22:03:55 -0500 (Mon, 22 Mar 2010) | 13 lines
    
    Merged revisions 79313,79324 via svnmerge from 
    svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
    
    ........
      r79313 | benjamin.peterson | 2010-03-22 17:59:57 -0500 (Mon, 22 Mar 2010) | 1 line
      
      another case where a symbol is needed
    ........
      r79324 | benjamin.peterson | 2010-03-22 21:59:47 -0500 (Mon, 22 Mar 2010) | 1 line
      
      use unicode literals
    ........
  ................
................
  r79333 | senthil.kumaran | 2010-03-23 04:00:53 -0700 (Tue, 23 Mar 2010) | 9 lines
  
  Merged revisions 79329 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79329 | senthil.kumaran | 2010-03-23 14:16:31 +0530 (Tue, 23 Mar 2010) | 2 lines
    
    Fixed Issue8209 - OptionParser keyword arg 'epilog' not mentioned in the docs
  ........
................
  r79352 | benjamin.peterson | 2010-03-23 14:02:34 -0700 (Tue, 23 Mar 2010) | 9 lines
  
  Merged revisions 79351 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79351 | benjamin.peterson | 2010-03-23 15:58:37 -0500 (Tue, 23 Mar 2010) | 1 line
    
    the == test doesn't work on Solaris #8210
  ........
................
  r79360 | ezio.melotti | 2010-03-23 16:29:39 -0700 (Tue, 23 Mar 2010) | 9 lines
  
  Merged revisions 79358 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79358 | ezio.melotti | 2010-03-24 01:26:21 +0200 (Wed, 24 Mar 2010) | 1 line
    
    #8217: typo.
  ........
................
  r79364 | ezio.melotti | 2010-03-23 16:56:06 -0700 (Tue, 23 Mar 2010) | 9 lines
  
  Merged revisions 79362 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79362 | ezio.melotti | 2010-03-24 01:53:20 +0200 (Wed, 24 Mar 2010) | 1 line
    
    Another typo.
  ........
................
  r79368 | r.david.murray | 2010-03-23 17:29:21 -0700 (Tue, 23 Mar 2010) | 2 lines
  
  Fix porting mistake in r79298.
................
  r79375 | martin.v.loewis | 2010-03-24 08:07:12 -0700 (Wed, 24 Mar 2010) | 9 lines
  
  Merged revisions 79374 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79374 | martin.v.loewis | 2010-03-24 16:05:53 +0100 (Mi, 24 Mär 2010) | 2 lines
    
    Add Brian Curtin.
  ........
................
  r79380 | florent.xicluna | 2010-03-24 10:37:49 -0700 (Wed, 24 Mar 2010) | 2 lines
  
  Revert improper merge in test_inspect (r79251).
................
  r79386 | benjamin.peterson | 2010-03-24 15:10:42 -0700 (Wed, 24 Mar 2010) | 9 lines
  
  Merged revisions 79385 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79385 | benjamin.peterson | 2010-03-24 17:03:09 -0500 (Wed, 24 Mar 2010) | 1 line
    
    replace copy right notice with simple attribution
  ........
................
  r79389 | steven.bethard | 2010-03-24 16:07:31 -0700 (Wed, 24 Mar 2010) | 9 lines
  
  Merged revisions 79388 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79388 | steven.bethard | 2010-03-24 16:03:24 -0700 (Wed, 24 Mar 2010) | 1 line
    
    Replace license with simple attribution.
  ........
................
  r79393 | victor.stinner | 2010-03-24 17:30:28 -0700 (Wed, 24 Mar 2010) | 3 lines
  
  Issue #8226: sys.setfilesystemencoding() raises a LookupError if the encoding
  is unknown.
................
  r79398 | victor.stinner | 2010-03-24 17:55:12 -0700 (Wed, 24 Mar 2010) | 12 lines
  
  Merged revisions 79395 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79395 | victor.stinner | 2010-03-25 01:51:58 +0100 (jeu., 25 mars 2010) | 5 lines
    
    Fix _curses.tiget*() functions: deny None to avoid a crash.
    
    Fix the following calls: _curses.tigetflag(None), _curses.tigetnum(None),
    _curses.tigetstr(None).
  ........
................
  r79400 | larry.hastings | 2010-03-24 17:57:10 -0700 (Wed, 24 Mar 2010) | 9 lines
  
  Blocked revisions 79397 via svnmerge
  
  ........
    r79397 | larry.hastings | 2010-03-24 17:54:54 -0700 (Wed, 24 Mar 2010) | 4 lines
    
    Backported PyCapsule from 3.1, and converted most uses of
    CObject to PyCapsule.
  ........
................
  r79401 | victor.stinner | 2010-03-24 18:02:29 -0700 (Wed, 24 Mar 2010) | 10 lines
  
  Merged revisions 79392 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79392 | victor.stinner | 2010-03-25 01:21:53 +0100 (jeu., 25 mars 2010) | 3 lines
    
    Issue #8211: Save/restore CFLAGS around AC_PROG_CC in configure.in, compiler
    optimizations are disabled when --with-pydebug is used.
  ........
................
  r79407 | benjamin.peterson | 2010-03-24 18:11:10 -0700 (Wed, 24 Mar 2010) | 12 lines
  
  Blocked revisions 79402,79406 via svnmerge
  
  ........
    r79402 | benjamin.peterson | 2010-03-24 20:03:51 -0500 (Wed, 24 Mar 2010) | 1 line
    
    set bsddb eol style
  ........
    r79406 | benjamin.peterson | 2010-03-24 20:05:57 -0500 (Wed, 24 Mar 2010) | 1 line
    
    fix eol properties on capsule files
  ........
................
  r79409 | benjamin.peterson | 2010-03-24 18:21:09 -0700 (Wed, 24 Mar 2010) | 9 lines
  
  Merged revisions 79403 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79403 | benjamin.peterson | 2010-03-24 20:04:58 -0500 (Wed, 24 Mar 2010) | 1 line
    
    set eol on email example
  ........
................
  r79411 | larry.hastings | 2010-03-24 18:25:31 -0700 (Wed, 24 Mar 2010) | 8 lines
  
  Blocked revisions 79410 via svnmerge
  
  ........
    r79410 | larry.hastings | 2010-03-24 18:23:27 -0700 (Wed, 24 Mar 2010) | 2 lines
    
    Remove extraneous experimental code checked in by accident.
  ........
................
  r79414 | benjamin.peterson | 2010-03-24 20:46:05 -0700 (Wed, 24 Mar 2010) | 8 lines
  
  Blocked revisions 79413 via svnmerge
  
  ........
    r79413 | benjamin.peterson | 2010-03-24 22:44:24 -0500 (Wed, 24 Mar 2010) | 1 line
    
    make an attempt to add capsule to the Windows build
  ........
................
  r79420 | victor.stinner | 2010-03-25 05:24:38 -0700 (Thu, 25 Mar 2010) | 10 lines
  
  Fix my test introduced in test_sys by r79394:
  
  Restore the orginal filesystem encoding before testing
  assertRaises(LookupError, sys.setfilesystemencoding, "xxx"). Unittest formats
  the exception, but the formatting failed because the file system was invalid
  (set to iso-8859-1 by the previous test).
  
  Anyway, ensure to restore the original filesystem encoding when exiting
  test_setfilesystemencoding() to avoid error propagation to the other tests.
................
  r79429 | benjamin.peterson | 2010-03-25 16:30:20 -0700 (Thu, 25 Mar 2010) | 9 lines
  
  Merged revisions 79428 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79428 | benjamin.peterson | 2010-03-25 18:27:16 -0500 (Thu, 25 Mar 2010) | 1 line
    
    make naming convention consistent
  ........
................
  r79434 | brian.curtin | 2010-03-25 17:39:56 -0700 (Thu, 25 Mar 2010) | 9 lines
  
  Merged revisions 79430 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79430 | brian.curtin | 2010-03-25 18:48:54 -0500 (Thu, 25 Mar 2010) | 2 lines
    
    Fix #6538. Markup RegexObject and MatchObject as classes. Patch by Ryan Arana.
  ........
................
  r79449 | antoine.pitrou | 2010-03-26 12:32:24 -0700 (Fri, 26 Mar 2010) | 12 lines
  
  Merged revisions 79448 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79448 | antoine.pitrou | 2010-03-26 20:27:16 +0100 (ven., 26 mars 2010) | 6 lines
    
    Issue #8222: Enable the SSL_MODE_AUTO_RETRY flag on SSL sockets, so that blocking
    reads and writes are always retried by OpenSSL itself.
    
    (this is a followup to issue #3890)
  ........
................
  r79452 | antoine.pitrou | 2010-03-26 12:36:14 -0700 (Fri, 26 Mar 2010) | 3 lines
  
  Add NEWS entry for r79449.
................
  r79454 | michael.foord | 2010-03-26 18:41:24 -0700 (Fri, 26 Mar 2010) | 8 lines
  
  Blocked revisions 79432 via svnmerge
  
  ........
    r79432 | michael.foord | 2010-03-25 23:56:33 +0000 (Thu, 25 Mar 2010) | 1 line
    
    Turn unittest tests into a package
  ........
................
  r79456 | mark.dickinson | 2010-03-27 04:11:13 -0700 (Sat, 27 Mar 2010) | 9 lines
  
  Merged revisions 79455 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79455 | mark.dickinson | 2010-03-27 11:09:29 +0000 (Sat, 27 Mar 2010) | 2 lines
    
    Make Fraction to complex comparisons with <=, <, >= or > raise TypeError.
  ........
................
  r79458 | mark.dickinson | 2010-03-27 04:16:00 -0700 (Sat, 27 Mar 2010) | 9 lines
  
  Merged revisions 79457 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79457 | mark.dickinson | 2010-03-27 11:14:37 +0000 (Sat, 27 Mar 2010) | 1 line
    
    Add Misc/NEWS entry for r79455.
  ........
................
  r79461 | michael.foord | 2010-03-27 05:34:21 -0700 (Sat, 27 Mar 2010) | 1 line
  
  Breaking test_unittest.py into a package. Manual merge of revision 79432.
................
  r79462 | michael.foord | 2010-03-27 05:41:09 -0700 (Sat, 27 Mar 2010) | 8 lines
  
  Blocked revisions 79433 via svnmerge
  
  ........
    r79433 | michael.foord | 2010-03-26 00:03:38 +0000 (Fri, 26 Mar 2010) | 1 line
    
    Remove incorrect docstring in unittest.test
  ........
................
  r79463 | michael.foord | 2010-03-27 05:49:01 -0700 (Sat, 27 Mar 2010) | 8 lines
  
  Blocked revisions 79436 via svnmerge
  
  ........
    r79436 | michael.foord | 2010-03-26 02:53:56 +0000 (Fri, 26 Mar 2010) | 1 line
    
    Move a support TestCase out of the main namespace in unittest.test.test_suite
  ........
................
  r79465 | michael.foord | 2010-03-27 06:25:41 -0700 (Sat, 27 Mar 2010) | 9 lines
  
  Merged revisions 79437 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79437 | michael.foord | 2010-03-26 03:18:31 +0000 (Fri, 26 Mar 2010) | 1 line
    
    Addition of -c command line option to unittest, to handle ctrl-c during a test run more elegantly
  ........
................
  r79466 | michael.foord | 2010-03-27 06:28:27 -0700 (Sat, 27 Mar 2010) | 9 lines
  
  Merged revisions 79442 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79442 | michael.foord | 2010-03-26 13:07:38 +0000 (Fri, 26 Mar 2010) | 1 line
    
    Makefile.pre.in for the unittest/test directory
  ........
................
  r79467 | michael.foord | 2010-03-27 06:29:35 -0700 (Sat, 27 Mar 2010) | 8 lines
  
  Blocked revisions 79443 via svnmerge
  
  ........
    r79443 | benjamin.peterson | 2010-03-26 13:53:32 +0000 (Fri, 26 Mar 2010) | 1 line
    
    reorder imports
  ........
................
  r79469 | michael.foord | 2010-03-27 06:45:04 -0700 (Sat, 27 Mar 2010) | 9 lines
  
  Merged revisions 79468 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79468 | michael.foord | 2010-03-27 13:42:34 +0000 (Sat, 27 Mar 2010) | 1 line
    
    Rename the unittest test_suite function to not clash with a test module name (unittest.test.test_suite is now unambiguous).
  ........
................
  r79472 | florent.xicluna | 2010-03-27 15:18:04 -0700 (Sat, 27 Mar 2010) | 27 lines
  
  Blocked revisions 79288,79295-79296,79334,79378 via svnmerge
  
  ........
    r79288 | florent.xicluna | 2010-03-22 16:02:46 +0100 (lun, 22 mar 2010) | 2 lines
    
    Get rid of buffer() in test_ctypes:  backport the 3.x tests.
  ........
    r79295 | florent.xicluna | 2010-03-22 17:07:38 +0100 (lun, 22 mar 2010) | 3 lines
    
    Issue #7703: ctypes supports both buffer() and memoryview().  The former is deprecated.
    Complement of r79288.
  ........
    r79296 | florent.xicluna | 2010-03-22 17:36:51 +0100 (lun, 22 mar 2010) | 3 lines
    
    Preserve backward compatibility of the ctypes module.
    "This file should be kept compatible with Python 2.3, see PEP 291."
  ........
    r79334 | florent.xicluna | 2010-03-23 12:07:54 +0100 (mar, 23 mar 2010) | 2 lines
    
    Skip test_format_deprecation if _ctypes is not available.  Add a filter to the warning check.
  ........
    r79378 | florent.xicluna | 2010-03-24 18:32:58 +0100 (mer, 24 mar 2010) | 3 lines
    
    Skip test_ascii_formatd if _ctypes is not available (BSD, ...).
    Previous change was incomplete (r79334).
  ........
................
  r79473 | florent.xicluna | 2010-03-27 15:47:23 -0700 (Sat, 27 Mar 2010) | 17 lines
  
  Merged revisions 79344,79346,79350 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79344 | florent.xicluna | 2010-03-23 15:36:45 +0100 (mar, 23 mar 2010) | 2 lines
    
    Silence test_subprocess.
  ........
    r79346 | florent.xicluna | 2010-03-23 16:05:30 +0100 (mar, 23 mar 2010) | 2 lines
    
    The standard error should be empty when the signal is killed, except on SIGINT.
  ........
    r79350 | florent.xicluna | 2010-03-23 20:19:16 +0100 (mar, 23 mar 2010) | 2 lines
    
    The SIGINT signal may happen earlier, during site.py initialization.
  ........
................
  r79474 | florent.xicluna | 2010-03-27 17:25:02 -0700 (Sat, 27 Mar 2010) | 33 lines
  
  Merged revisions 79297,79310,79382,79425-79427,79450 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79297 | florent.xicluna | 2010-03-22 18:18:18 +0100 (lun, 22 mar 2010) | 2 lines
    
    #7668: Fix test_httpservers failure when sys.executable contains non-ASCII bytes.
  ........
    r79310 | florent.xicluna | 2010-03-22 23:52:11 +0100 (lun, 22 mar 2010) | 2 lines
    
    Issue #8205: Remove the "Modules" directory from sys.path when Python is running from the build directory (POSIX only).
  ........
    r79382 | florent.xicluna | 2010-03-24 20:33:25 +0100 (mer, 24 mar 2010) | 2 lines
    
    Skip tests which depend on multiprocessing.sharedctypes, if _ctypes is not available.
  ........
    r79425 | florent.xicluna | 2010-03-25 21:32:07 +0100 (jeu, 25 mar 2010) | 2 lines
    
    Syntax cleanup `== None` -> `is None`
  ........
    r79426 | florent.xicluna | 2010-03-25 21:33:49 +0100 (jeu, 25 mar 2010) | 2 lines
    
    #8207: Fix test_pep277 on OS X
  ........
    r79427 | florent.xicluna | 2010-03-25 21:39:10 +0100 (jeu, 25 mar 2010) | 2 lines
    
    Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest"
  ........
    r79450 | florent.xicluna | 2010-03-26 20:32:44 +0100 (ven, 26 mar 2010) | 2 lines
    
    Ensure that the failed or unexpected tests are sorted before printing.
  ........
................
  r79484 | raymond.hettinger | 2010-03-28 11:27:13 -0700 (Sun, 28 Mar 2010) | 1 line
  
  Update itertools recipes.
................
  r79499 | benjamin.peterson | 2010-03-30 10:34:47 -0700 (Tue, 30 Mar 2010) | 4 lines
  
  build without -fno-strict-aliasing when gcc isn't buggy #3326
  
  Patch from Daniel Stutzbach
................
  r79501 | benjamin.peterson | 2010-03-30 11:42:32 -0700 (Tue, 30 Mar 2010) | 11 lines
  
  Merged revisions 79500 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79500 | benjamin.peterson | 2010-03-30 12:58:13 -0500 (Tue, 30 Mar 2010) | 4 lines
    
    add inspect.getcallargs, which binds function arguments like a normal call #3135
    
    Patch by George Sakkis
  ........
................
  r79503 | antoine.pitrou | 2010-03-30 11:56:19 -0700 (Tue, 30 Mar 2010) | 9 lines
  
  Merged revisions 79502 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79502 | antoine.pitrou | 2010-03-30 20:49:45 +0200 (mar., 30 mars 2010) | 4 lines
    
    Issue #8248: Add some tests for the bool type.  Patch by Gregory Nofi.
  ........
................
  r79505 | antoine.pitrou | 2010-03-30 11:59:21 -0700 (Tue, 30 Mar 2010) | 8 lines
  
  Blocked revisions 79504 via svnmerge
  
  ........
    r79504 | antoine.pitrou | 2010-03-30 20:58:22 +0200 (mar., 30 mars 2010) | 3 lines
    
    Fix small error in r79502
  ........
................
  r79506 | florent.xicluna | 2010-03-30 12:34:18 -0700 (Tue, 30 Mar 2010) | 13 lines
  
  Merged revisions 79494,79496 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79494 | florent.xicluna | 2010-03-30 10:24:06 +0200 (mar, 30 mar 2010) | 2 lines
    
    #7643: Unicode codepoints VT (0x0B) and FF (0x0C) are linebreaks according to Unicode Standard Annex #14.
  ........
    r79496 | florent.xicluna | 2010-03-30 18:29:03 +0200 (mar, 30 mar 2010) | 2 lines
    
    Highlight the change of behavior related to r79494.  Now VT and FF are linebreaks.
  ........
................
  r79507 | florent.xicluna | 2010-03-30 12:37:07 -0700 (Tue, 30 Mar 2010) | 9 lines
  
  Merged revisions 79498 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79498 | florent.xicluna | 2010-03-30 18:42:47 +0200 (mar, 30 mar 2010) | 2 lines
    
    fix ACKS: alphabetic order and UTF-8
  ........
................
  r79508 | florent.xicluna | 2010-03-30 12:43:09 -0700 (Tue, 30 Mar 2010) | 9 lines
  
  Merged revisions 79497 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79497 | florent.xicluna | 2010-03-30 18:31:14 +0200 (mar, 30 mar 2010) | 2 lines
    
    #8263: Now regrtest.py will report a failure if it receives a KeyboardInterrupt (SIGINT).
  ........
................
  r79520 | brian.curtin | 2010-03-30 20:19:28 -0700 (Tue, 30 Mar 2010) | 9 lines
  
  Merged revisions 79518 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79518 | brian.curtin | 2010-03-30 22:10:21 -0500 (Tue, 30 Mar 2010) | 2 lines
    
    Fix #8225. xml.etree was displaying an incorrect link when viewed in help.
  ........
................
  r79525 | ezio.melotti | 2010-03-31 00:45:32 -0700 (Wed, 31 Mar 2010) | 9 lines
  
  Merged revisions 79522 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79522 | ezio.melotti | 2010-03-31 10:26:24 +0300 (Wed, 31 Mar 2010) | 1 line
    
    Revert r79179 and merge r75584 to explain how to implement a queue using collection.deque instead of a list.
  ........
................
  r79531 | brian.curtin | 2010-03-31 10:46:38 -0700 (Wed, 31 Mar 2010) | 4 lines
  
  Merged revisions 79529 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
................
  r79536 | barry.warsaw | 2010-03-31 14:36:22 -0700 (Wed, 31 Mar 2010) | 6 lines
  
  - Issue #8233: When run as a script, py_compile.py optionally takes a single
    argument `-` which tells it to read files to compile from stdin.  Each line
    is read on demand and the named file is compiled immediately.  (Original
    patch by Piotr Ożarowski).
................
  r79538 | antoine.pitrou | 2010-03-31 14:40:47 -0700 (Wed, 31 Mar 2010) | 13 lines
  
  NOTE: only ported the test for new-style classes.
  
  
  Merged revisions 79535 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79535 | antoine.pitrou | 2010-03-31 23:32:15 +0200 (mer., 31 mars 2010) | 5 lines
    
    Issue #8268: Old-style classes (not just instances) now support weak
    references.
  ........
................
  r79545 | brian.curtin | 2010-03-31 21:05:25 -0700 (Wed, 31 Mar 2010) | 9 lines
  
  Merged revisions 79543 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79543 | brian.curtin | 2010-03-31 23:02:00 -0500 (Wed, 31 Mar 2010) | 2 lines
    
    Fix a test_pydoc failure on Neal Norwitz's buildbot.
  ........
................
  r79553 | stefan.krah | 2010-04-01 03:34:09 -0700 (Thu, 01 Apr 2010) | 1 line
  
  Fix typo in definition of 'in' keyword.
................
  r79556 | antoine.pitrou | 2010-04-01 09:53:15 -0700 (Thu, 01 Apr 2010) | 11 lines
  
  Merged revisions 79555 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r79555 | antoine.pitrou | 2010-04-01 18:42:11 +0200 (jeu., 01 avril 2010) | 5 lines
    
    Issue #8276: PyEval_CallObject() is now only available in macro form.  The
    function declaration, which was kept for backwards compatibility reasons,
    is now removed (the macro was introduced in 1997!).
  ........
................


Added:
   python/branches/py3k-jit/Lib/lib2to3/fixes/fix_exitfunc.py
      - copied unchanged from r79556, /python/branches/py3k/Lib/lib2to3/fixes/fix_exitfunc.py
   python/branches/py3k-jit/Lib/unittest/signals.py
      - copied unchanged from r79556, /python/branches/py3k/Lib/unittest/signals.py
   python/branches/py3k-jit/Lib/unittest/test/
      - copied from r79556, /python/branches/py3k/Lib/unittest/test/
Modified:
   python/branches/py3k-jit/   (props changed)
   python/branches/py3k-jit/Doc/howto/unicode.rst
   python/branches/py3k-jit/Doc/howto/webservers.rst
   python/branches/py3k-jit/Doc/includes/email-headers.py   (props changed)
   python/branches/py3k-jit/Doc/library/builtins.rst
   python/branches/py3k-jit/Doc/library/inspect.rst
   python/branches/py3k-jit/Doc/library/itertools.rst
   python/branches/py3k-jit/Doc/library/optparse.rst
   python/branches/py3k-jit/Doc/library/re.rst
   python/branches/py3k-jit/Doc/library/unicodedata.rst
   python/branches/py3k-jit/Doc/reference/expressions.rst
   python/branches/py3k-jit/Doc/tutorial/datastructures.rst
   python/branches/py3k-jit/Doc/whatsnew/2.7.rst
   python/branches/py3k-jit/Include/ceval.h
   python/branches/py3k-jit/Lib/argparse.py
   python/branches/py3k-jit/Lib/fractions.py
   python/branches/py3k-jit/Lib/idlelib/PyShell.py
   python/branches/py3k-jit/Lib/inspect.py
   python/branches/py3k-jit/Lib/lib2to3/pgen2/tokenize.py
   python/branches/py3k-jit/Lib/lib2to3/tests/test_fixers.py
   python/branches/py3k-jit/Lib/lib2to3/tests/test_parser.py
   python/branches/py3k-jit/Lib/py_compile.py
   python/branches/py3k-jit/Lib/pydoc.py
   python/branches/py3k-jit/Lib/site.py
   python/branches/py3k-jit/Lib/test/regrtest.py
   python/branches/py3k-jit/Lib/test/test_argparse.py
   python/branches/py3k-jit/Lib/test/test_bool.py
   python/branches/py3k-jit/Lib/test/test_decimal.py
   python/branches/py3k-jit/Lib/test/test_fractions.py
   python/branches/py3k-jit/Lib/test/test_httpservers.py
   python/branches/py3k-jit/Lib/test/test_index.py
   python/branches/py3k-jit/Lib/test/test_inspect.py
   python/branches/py3k-jit/Lib/test/test_multiprocessing.py
   python/branches/py3k-jit/Lib/test/test_ossaudiodev.py
   python/branches/py3k-jit/Lib/test/test_pep277.py
   python/branches/py3k-jit/Lib/test/test_platform.py
   python/branches/py3k-jit/Lib/test/test_pydoc.py
   python/branches/py3k-jit/Lib/test/test_subprocess.py
   python/branches/py3k-jit/Lib/test/test_sys.py
   python/branches/py3k-jit/Lib/test/test_unicodedata.py
   python/branches/py3k-jit/Lib/test/test_unittest.py
   python/branches/py3k-jit/Lib/test/test_warnings.py
   python/branches/py3k-jit/Lib/test/test_weakref.py
   python/branches/py3k-jit/Lib/turtle.py
   python/branches/py3k-jit/Lib/unittest/__init__.py
   python/branches/py3k-jit/Lib/unittest/main.py
   python/branches/py3k-jit/Lib/unittest/runner.py
   python/branches/py3k-jit/Makefile.pre.in
   python/branches/py3k-jit/Misc/ACKS
   python/branches/py3k-jit/Misc/NEWS
   python/branches/py3k-jit/Misc/developers.txt
   python/branches/py3k-jit/Modules/_cursesmodule.c
   python/branches/py3k-jit/Modules/_ssl.c
   python/branches/py3k-jit/Modules/ossaudiodev.c
   python/branches/py3k-jit/Modules/unicodedata.c
   python/branches/py3k-jit/Objects/unicodeobject.c
   python/branches/py3k-jit/Objects/unicodetype_db.h
   python/branches/py3k-jit/Python/bltinmodule.c
   python/branches/py3k-jit/Python/ceval.c
   python/branches/py3k-jit/Python/import.c
   python/branches/py3k-jit/Tools/unicode/makeunicodedata.py
   python/branches/py3k-jit/configure
   python/branches/py3k-jit/configure.in

Modified: python/branches/py3k-jit/Doc/howto/unicode.rst
==============================================================================
--- python/branches/py3k-jit/Doc/howto/unicode.rst	(original)
+++ python/branches/py3k-jit/Doc/howto/unicode.rst	Fri Apr  2 01:59:59 2010
@@ -403,7 +403,7 @@
 from the above output, ``'Ll'`` means 'Letter, lowercase', ``'No'`` means
 "Number, other", ``'Mn'`` is "Mark, nonspacing", and ``'So'`` is "Symbol,
 other".  See
-<http://unicode.org/Public/5.1.0/ucd/UCD.html#General_Category_Values> for a
+<http://www.unicode.org/reports/tr44/#General_Category_Values> for a
 list of category codes.
 
 References

Modified: python/branches/py3k-jit/Doc/howto/webservers.rst
==============================================================================
--- python/branches/py3k-jit/Doc/howto/webservers.rst	(original)
+++ python/branches/py3k-jit/Doc/howto/webservers.rst	Fri Apr  2 01:59:59 2010
@@ -38,7 +38,7 @@
 When a user enters a web site, his browser makes a connection to the site's
 webserver (this is called the *request*).  The server looks up the file in the
 file system and sends it back to the user's browser, which displays it (this is
-the *response*).  This is roughly how the unterlying protocol, HTTP works.
+the *response*).  This is roughly how the underlying protocol, HTTP, works.
 
 Now, dynamic web sites are not files in the file system, but rather programs
 which are run by the web server when a request comes in.  They can do all sorts
@@ -677,7 +677,7 @@
 "normal" Python programmers use the very mature Zope components.
 
 Another framework that's already been mentioned is `Pylons`_.  Pylons is much
-like TurboGears with ab even stronger emphasis on flexibility, which is bought
+like TurboGears with an even stronger emphasis on flexibility, which is bought
 at the cost of being more difficult to use.  Nearly every component can be
 exchanged, which makes it necessary to use the documentation of every single
 component, because there are so many Pylons combinations possible that can

Modified: python/branches/py3k-jit/Doc/library/builtins.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/builtins.rst	(original)
+++ python/branches/py3k-jit/Doc/library/builtins.rst	Fri Apr  2 01:59:59 2010
@@ -7,7 +7,7 @@
 
 This module provides direct access to all 'built-in' identifiers of Python; for
 example, ``builtins.open`` is the full name for the built-in function
-:func:`open`.  See chapter :ref:`builtin`.
+:func:`open`.
 
 This module is not normally accessed explicitly by most applications, but can be
 useful in modules that provide objects with the same name as a built-in value,

Modified: python/branches/py3k-jit/Doc/library/inspect.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/inspect.rst	(original)
+++ python/branches/py3k-jit/Doc/library/inspect.rst	Fri Apr  2 01:59:59 2010
@@ -449,6 +449,32 @@
    metatype is in use, cls will be the first element of the tuple.
 
 
+.. function:: getcallargs(func[, *args][, **kwds])
+
+   Bind the *args* and *kwds* to the argument names of the Python function or
+   method *func*, as if it was called with them. For bound methods, bind also the
+   first argument (typically named ``self``) to the associated instance. A dict
+   is returned, mapping the argument names (including the names of the ``*`` and
+   ``**`` arguments, if any) to their values from *args* and *kwds*. In case of
+   invoking *func* incorrectly, i.e. whenever ``func(*args, **kwds)`` would raise
+   an exception because of incompatible signature, an exception of the same type
+   and the same or similar message is raised. For example::
+
+    >>> from inspect import getcallargs
+    >>> def f(a, b=1, *pos, **named):
+    ...     pass
+    >>> getcallargs(f, 1, 2, 3)
+    {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}
+    >>> getcallargs(f, a=2, x=4)
+    {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}
+    >>> getcallargs(f)
+    Traceback (most recent call last):
+    ...
+    TypeError: f() takes at least 1 argument (0 given)
+
+   .. versionadded:: 3.2
+
+
 .. _inspect-stack:
 
 The interpreter stack

Modified: python/branches/py3k-jit/Doc/library/itertools.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/itertools.rst	(original)
+++ python/branches/py3k-jit/Doc/library/itertools.rst	Fri Apr  2 01:59:59 2010
@@ -580,16 +580,19 @@
        "Return first n items of the iterable as a list"
        return list(islice(iterable, n))
 
-   def enumerate(iterable, start=0):
-       return zip(count(start), iterable)
-
    def tabulate(function, start=0):
        "Return function(0), function(1), ..."
        return map(function, count(start))
 
    def consume(iterator, n):
        "Advance the iterator n-steps ahead. If n is none, consume entirely."
-       collections.deque(islice(iterator, n), maxlen=0)
+       # Use functions that consume iterators at C speed.
+       if n is None:
+           # feed the entire iterator into a zero-length deque
+           collections.deque(iterator, maxlen=0)
+       else:
+           # advance to the emtpy slice starting at position n
+           next(islice(iterator, n, n), None)
 
    def nth(iterable, n, default=None):
        "Returns the nth item or a default value"
@@ -661,10 +664,9 @@
        seen = set()
        seen_add = seen.add
        if key is None:
-           for element in iterable:
-               if element not in seen:
-                   seen_add(element)
-                   yield element
+           for element in filterfalse(seen.__contains__, iterable):
+               seen_add(element)
+               yield element
        else:
            for element in iterable:
                k = key(element)
@@ -677,3 +679,33 @@
        # unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
        # unique_justseen('ABBCcAD', str.lower) --> A B C A D
        return map(next, map(itemgetter(1), groupby(iterable, key)))
+
+   def iter_except(func, exception, first=None):
+       """ Call a function repeatedly until an exception is raised.
+
+       Converts a call-until-exception interface to an iterator interface.
+       Like __builtin__.iter(func, sentinel) but uses an exception instead
+       of a sentinel to end the loop.
+
+       Examples:
+           iter_except(functools.partial(heappop, h), IndexError)   # priority queue iterator
+           iter_except(d.popitem, KeyError)                         # non-blocking dict iterator
+           iter_except(d.popleft, IndexError)                       # non-blocking deque iterator
+           iter_except(q.get_nowait, Queue.Empty)                   # loop over a producer Queue
+           iter_except(s.pop, KeyError)                             # non-blocking set iterator
+
+       """
+       try:
+           if first is not None:
+               yield first()            # For database APIs needing an initial cast to db.first()
+           while 1:
+               yield func()
+       except exception:
+           pass
+
+Note, many of the above recipes can be optimized by replacing global lookups
+with local variables defined as default values.  For example, the
+*dotproduct* recipe can be written as::
+
+   def dotproduct(vec1, vec2, sum=sum, map=map, mul=operator.mul):
+       return sum(map(mul, vec1, vec2))

Modified: python/branches/py3k-jit/Doc/library/optparse.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/optparse.rst	(original)
+++ python/branches/py3k-jit/Doc/library/optparse.rst	Fri Apr  2 01:59:59 2010
@@ -762,7 +762,8 @@
       The string to use when expanding ``"%prog"`` in ``usage`` and ``version``
       instead of ``os.path.basename(sys.argv[0])``.
 
-
+   ``epilog`` (default: ``None``)
+      A paragraph of help text to print after the option help.
 
 .. _optparse-populating-parser:
 

Modified: python/branches/py3k-jit/Doc/library/re.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/re.rst	(original)
+++ python/branches/py3k-jit/Doc/library/re.rst	Fri Apr  2 01:59:59 2010
@@ -705,98 +705,99 @@
 Regular Expression Objects
 --------------------------
 
-Compiled regular expression objects support the following methods and
-attributes:
+.. class:: RegexObject
 
+   The :class:`RegexObject` class supports the following methods and attributes:
 
-.. method:: RegexObject.match(string[, pos[, endpos]])
 
-   If zero or more characters at the beginning of *string* match this regular
-   expression, return a corresponding :class:`MatchObject` instance.  Return
-   ``None`` if the string does not match the pattern; note that this is different
-   from a zero-length match.
+   .. method:: RegexObject.match(string[, pos[, endpos]])
 
-   .. note::
+      If zero or more characters at the beginning of *string* match this regular
+      expression, return a corresponding :class:`MatchObject` instance.  Return
+      ``None`` if the string does not match the pattern; note that this is different
+      from a zero-length match.
 
-      If you want to locate a match anywhere in *string*, use
-      :meth:`~RegexObject.search` instead.
+      .. note::
 
-   The optional second parameter *pos* gives an index in the string where the
-   search is to start; it defaults to ``0``.  This is not completely equivalent to
-   slicing the string; the ``'^'`` pattern character matches at the real beginning
-   of the string and at positions just after a newline, but not necessarily at the
-   index where the search is to start.
+         If you want to locate a match anywhere in *string*, use
+         :meth:`~RegexObject.search` instead.
 
-   The optional parameter *endpos* limits how far the string will be searched; it
-   will be as if the string is *endpos* characters long, so only the characters
-   from *pos* to ``endpos - 1`` will be searched for a match.  If *endpos* is less
-   than *pos*, no match will be found, otherwise, if *rx* is a compiled regular
-   expression object, ``rx.match(string, 0, 50)`` is equivalent to
-   ``rx.match(string[:50], 0)``.
+      The optional second parameter *pos* gives an index in the string where the
+      search is to start; it defaults to ``0``.  This is not completely equivalent to
+      slicing the string; the ``'^'`` pattern character matches at the real beginning
+      of the string and at positions just after a newline, but not necessarily at the
+      index where the search is to start.
 
-      >>> pattern = re.compile("o")
-      >>> pattern.match("dog")      # No match as "o" is not at the start of "dog."
-      >>> pattern.match("dog", 1)   # Match as "o" is the 2nd character of "dog".
-      <_sre.SRE_Match object at ...>
+      The optional parameter *endpos* limits how far the string will be searched; it
+      will be as if the string is *endpos* characters long, so only the characters
+      from *pos* to ``endpos - 1`` will be searched for a match.  If *endpos* is less
+      than *pos*, no match will be found, otherwise, if *rx* is a compiled regular
+      expression object, ``rx.match(string, 0, 50)`` is equivalent to
+      ``rx.match(string[:50], 0)``.
 
+         >>> pattern = re.compile("o")
+         >>> pattern.match("dog")      # No match as "o" is not at the start of "dog."
+         >>> pattern.match("dog", 1)   # Match as "o" is the 2nd character of "dog".
+         <_sre.SRE_Match object at ...>
 
-.. method:: RegexObject.search(string[, pos[, endpos]])
 
-   Scan through *string* looking for a location where this regular expression
-   produces a match, and return a corresponding :class:`MatchObject` instance.
-   Return ``None`` if no position in the string matches the pattern; note that this
-   is different from finding a zero-length match at some point in the string.
+   .. method:: RegexObject.search(string[, pos[, endpos]])
 
-   The optional *pos* and *endpos* parameters have the same meaning as for the
-   :meth:`~RegexObject.match` method.
+      Scan through *string* looking for a location where this regular expression
+      produces a match, and return a corresponding :class:`MatchObject` instance.
+      Return ``None`` if no position in the string matches the pattern; note that this
+      is different from finding a zero-length match at some point in the string.
 
+      The optional *pos* and *endpos* parameters have the same meaning as for the
+      :meth:`~RegexObject.match` method.
 
-.. method:: RegexObject.split(string, maxsplit=0)
 
-   Identical to the :func:`split` function, using the compiled pattern.
+   .. method:: RegexObject.split(string[, maxsplit=0])
 
+      Identical to the :func:`split` function, using the compiled pattern.
 
-.. method:: RegexObject.findall(string[, pos[, endpos]])
 
-   Identical to the :func:`findall` function, using the compiled pattern.
+   .. method:: RegexObject.findall(string[, pos[, endpos]])
 
+      Identical to the :func:`findall` function, using the compiled pattern.
 
-.. method:: RegexObject.finditer(string[, pos[, endpos]])
 
-   Identical to the :func:`finditer` function, using the compiled pattern.
+   .. method:: RegexObject.finditer(string[, pos[, endpos]])
 
+      Identical to the :func:`finditer` function, using the compiled pattern.
 
-.. method:: RegexObject.sub(repl, string, count=0)
 
-   Identical to the :func:`sub` function, using the compiled pattern.
+   .. method:: RegexObject.sub(repl, string[, count=0])
 
+      Identical to the :func:`sub` function, using the compiled pattern.
 
-.. method:: RegexObject.subn(repl, string, count=0)
 
-   Identical to the :func:`subn` function, using the compiled pattern.
+   .. method:: RegexObject.subn(repl, string[, count=0])
 
+      Identical to the :func:`subn` function, using the compiled pattern.
 
-.. attribute:: RegexObject.flags
 
-   The flags argument used when the RE object was compiled, or ``0`` if no flags
-   were provided.
+   .. attribute:: RegexObject.flags
 
+      The flags argument used when the RE object was compiled, or ``0`` if no flags
+      were provided.
 
-.. attribute:: RegexObject.groups
 
-   The number of capturing groups in the pattern.
+   .. attribute:: RegexObject.groups
 
+      The number of capturing groups in the pattern.
 
-.. attribute:: RegexObject.groupindex
 
-   A dictionary mapping any symbolic group names defined by ``(?P<id>)`` to group
-   numbers.  The dictionary is empty if no symbolic groups were used in the
-   pattern.
+   .. attribute:: RegexObject.groupindex
 
+      A dictionary mapping any symbolic group names defined by ``(?P<id>)`` to group
+      numbers.  The dictionary is empty if no symbolic groups were used in the
+      pattern.
 
-.. attribute:: RegexObject.pattern
 
-   The pattern string from which the RE object was compiled.
+   .. attribute:: RegexObject.pattern
+
+      The pattern string from which the RE object was compiled.
 
 
 .. _match-objects:
@@ -804,176 +805,178 @@
 Match Objects
 -------------
 
-Match objects always have a boolean value of :const:`True`, so that you can test
-whether e.g. :func:`match` resulted in a match with a simple if statement.  They
-support the following methods and attributes:
-
+.. class:: MatchObject
 
-.. method:: MatchObject.expand(template)
+   Match Objects always have a boolean value of :const:`True`, so that you can test
+   whether e.g. :func:`match` resulted in a match with a simple if statement.  They
+   support the following methods and attributes:
 
-   Return the string obtained by doing backslash substitution on the template
-   string *template*, as done by the :meth:`~RegexObject.sub` method.  Escapes
-   such as ``\n`` are converted to the appropriate characters, and numeric
-   backreferences (``\1``, ``\2``) and named backreferences (``\g<1>``,
-   ``\g<name>``) are replaced by the contents of the corresponding group.
 
+   .. method:: MatchObject.expand(template)
 
-.. method:: MatchObject.group([group1, ...])
+      Return the string obtained by doing backslash substitution on the template
+      string *template*, as done by the :meth:`~RegexObject.sub` method.  Escapes
+      such as ``\n`` are converted to the appropriate characters, and numeric
+      backreferences (``\1``, ``\2``) and named backreferences (``\g<1>``,
+      ``\g<name>``) are replaced by the contents of the corresponding group.
 
-   Returns one or more subgroups of the match.  If there is a single argument, the
-   result is a single string; if there are multiple arguments, the result is a
-   tuple with one item per argument. Without arguments, *group1* defaults to zero
-   (the whole match is returned). If a *groupN* argument is zero, the corresponding
-   return value is the entire matching string; if it is in the inclusive range
-   [1..99], it is the string matching the corresponding parenthesized group.  If a
-   group number is negative or larger than the number of groups defined in the
-   pattern, an :exc:`IndexError` exception is raised. If a group is contained in a
-   part of the pattern that did not match, the corresponding result is ``None``.
-   If a group is contained in a part of the pattern that matched multiple times,
-   the last match is returned.
 
-      >>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
-      >>> m.group(0)       # The entire match
-      'Isaac Newton'
-      >>> m.group(1)       # The first parenthesized subgroup.
-      'Isaac'
-      >>> m.group(2)       # The second parenthesized subgroup.
-      'Newton'
-      >>> m.group(1, 2)    # Multiple arguments give us a tuple.
-      ('Isaac', 'Newton')
+   .. method:: MatchObject.group([group1, ...])
 
-   If the regular expression uses the ``(?P<name>...)`` syntax, the *groupN*
-   arguments may also be strings identifying groups by their group name.  If a
-   string argument is not used as a group name in the pattern, an :exc:`IndexError`
-   exception is raised.
+      Returns one or more subgroups of the match.  If there is a single argument, the
+      result is a single string; if there are multiple arguments, the result is a
+      tuple with one item per argument. Without arguments, *group1* defaults to zero
+      (the whole match is returned). If a *groupN* argument is zero, the corresponding
+      return value is the entire matching string; if it is in the inclusive range
+      [1..99], it is the string matching the corresponding parenthesized group.  If a
+      group number is negative or larger than the number of groups defined in the
+      pattern, an :exc:`IndexError` exception is raised. If a group is contained in a
+      part of the pattern that did not match, the corresponding result is ``None``.
+      If a group is contained in a part of the pattern that matched multiple times,
+      the last match is returned.
 
-   A moderately complicated example:
+         >>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
+         >>> m.group(0)       # The entire match
+         'Isaac Newton'
+         >>> m.group(1)       # The first parenthesized subgroup.
+         'Isaac'
+         >>> m.group(2)       # The second parenthesized subgroup.
+         'Newton'
+         >>> m.group(1, 2)    # Multiple arguments give us a tuple.
+         ('Isaac', 'Newton')
 
-      >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
-      >>> m.group('first_name')
-      'Malcolm'
-      >>> m.group('last_name')
-      'Reynolds'
+      If the regular expression uses the ``(?P<name>...)`` syntax, the *groupN*
+      arguments may also be strings identifying groups by their group name.  If a
+      string argument is not used as a group name in the pattern, an :exc:`IndexError`
+      exception is raised.
 
-   Named groups can also be referred to by their index:
+      A moderately complicated example:
 
-      >>> m.group(1)
-      'Malcolm'
-      >>> m.group(2)
-      'Reynolds'
+         >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
+         >>> m.group('first_name')
+         'Malcolm'
+         >>> m.group('last_name')
+         'Reynolds'
 
-   If a group matches multiple times, only the last match is accessible:
+      Named groups can also be referred to by their index:
 
-      >>> m = re.match(r"(..)+", "a1b2c3")  # Matches 3 times.
-      >>> m.group(1)                        # Returns only the last match.
-      'c3'
+         >>> m.group(1)
+         'Malcolm'
+         >>> m.group(2)
+         'Reynolds'
 
+      If a group matches multiple times, only the last match is accessible:
 
-.. method:: MatchObject.groups(default=None)
+         >>> m = re.match(r"(..)+", "a1b2c3")  # Matches 3 times.
+         >>> m.group(1)                        # Returns only the last match.
+         'c3'
 
-   Return a tuple containing all the subgroups of the match, from 1 up to however
-   many groups are in the pattern.  The *default* argument is used for groups that
-   did not participate in the match; it defaults to ``None``.
+      Return a tuple containing all the subgroups of the match, from 1 up to however
+      many groups are in the pattern.  The *default* argument is used for groups that
+      did not participate in the match; it defaults to ``None``.  (Incompatibility
+      note: in the original Python 1.5 release, if the tuple was one element long, a
+      string would be returned instead.  In later versions (from 1.5.1 on), a
+      singleton tuple is returned in such cases.)
 
-   For example:
+      For example:
 
-      >>> m = re.match(r"(\d+)\.(\d+)", "24.1632")
-      >>> m.groups()
-      ('24', '1632')
+         >>> m = re.match(r"(\d+)\.(\d+)", "24.1632")
+         >>> m.groups()
+         ('24', '1632')
 
-   If we make the decimal place and everything after it optional, not all groups
-   might participate in the match.  These groups will default to ``None`` unless
-   the *default* argument is given:
+      If we make the decimal place and everything after it optional, not all groups
+      might participate in the match.  These groups will default to ``None`` unless
+      the *default* argument is given:
 
-      >>> m = re.match(r"(\d+)\.?(\d+)?", "24")
-      >>> m.groups()      # Second group defaults to None.
-      ('24', None)
-      >>> m.groups('0')   # Now, the second group defaults to '0'.
-      ('24', '0')
+         >>> m = re.match(r"(\d+)\.?(\d+)?", "24")
+         >>> m.groups()      # Second group defaults to None.
+         ('24', None)
+         >>> m.groups('0')   # Now, the second group defaults to '0'.
+         ('24', '0')
 
 
-.. method:: MatchObject.groupdict(default=None)
+   .. method:: MatchObject.groupdict([default])
 
-   Return a dictionary containing all the *named* subgroups of the match, keyed by
-   the subgroup name.  The *default* argument is used for groups that did not
-   participate in the match; it defaults to ``None``.  For example:
+      Return a dictionary containing all the *named* subgroups of the match, keyed by
+      the subgroup name.  The *default* argument is used for groups that did not
+      participate in the match; it defaults to ``None``.  For example:
 
-      >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
-      >>> m.groupdict()
-      {'first_name': 'Malcolm', 'last_name': 'Reynolds'}
+         >>> m = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
+         >>> m.groupdict()
+         {'first_name': 'Malcolm', 'last_name': 'Reynolds'}
 
 
-.. method:: MatchObject.start(group=0)
-            MatchObject.end(group=0)
+   .. method:: MatchObject.start([group])
+               MatchObject.end([group])
 
-   Return the indices of the start and end of the substring matched by *group*;
-   *group* defaults to zero (meaning the whole matched substring). Return ``-1`` if
-   *group* exists but did not contribute to the match.  For a match object *m*, and
-   a group *g* that did contribute to the match, the substring matched by group *g*
-   (equivalent to ``m.group(g)``) is ::
+      Return the indices of the start and end of the substring matched by *group*;
+      *group* defaults to zero (meaning the whole matched substring). Return ``-1`` if
+      *group* exists but did not contribute to the match.  For a match object *m*, and
+      a group *g* that did contribute to the match, the substring matched by group *g*
+      (equivalent to ``m.group(g)``) is ::
 
-      m.string[m.start(g):m.end(g)]
+         m.string[m.start(g):m.end(g)]
 
-   Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched a
-   null string.  For example, after ``m = re.search('b(c?)', 'cba')``,
-   ``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both
-   2, and ``m.start(2)`` raises an :exc:`IndexError` exception.
+      Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched a
+      null string.  For example, after ``m = re.search('b(c?)', 'cba')``,
+      ``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both
+      2, and ``m.start(2)`` raises an :exc:`IndexError` exception.
 
-   An example that will remove *remove_this* from email addresses:
+      An example that will remove *remove_this* from email addresses:
 
-      >>> email = "tony at tiremove_thisger.net"
-      >>> m = re.search("remove_this", email)
-      >>> email[:m.start()] + email[m.end():]
-      'tony at tiger.net'
+         >>> email = "tony at tiremove_thisger.net"
+         >>> m = re.search("remove_this", email)
+         >>> email[:m.start()] + email[m.end():]
+         'tony at tiger.net'
 
 
-.. method:: MatchObject.span(group=0)
+   .. method:: MatchObject.span([group])
 
-   For :class:`MatchObject` *m*, return the 2-tuple ``(m.start(group),
-   m.end(group))``. Note that if *group* did not contribute to the match, this is
-   ``(-1, -1)``.  *group* defaults to zero, the entire match.
+      For :class:`MatchObject` *m*, return the 2-tuple ``(m.start(group),
+      m.end(group))``. Note that if *group* did not contribute to the match, this is
+      ``(-1, -1)``.  *group* defaults to zero, the entire match.
 
 
-.. attribute:: MatchObject.pos
+   .. attribute:: MatchObject.pos
 
-   The value of *pos* which was passed to the :meth:`~RegexObject.search` or
-   :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
-   index into the string at which the RE engine started looking for a match.
+      The value of *pos* which was passed to the :meth:`~RegexObject.search` or
+      :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
+      index into the string at which the RE engine started looking for a match.
 
 
-.. attribute:: MatchObject.endpos
+   .. attribute:: MatchObject.endpos
 
-   The value of *endpos* which was passed to the :meth:`~RegexObject.search` or
-   :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
-   index into the string beyond which the RE engine will not go.
+      The value of *endpos* which was passed to the :meth:`~RegexObject.search` or
+      :meth:`~RegexObject.match` method of the :class:`RegexObject`.  This is the
+      index into the string beyond which the RE engine will not go.
 
 
-.. attribute:: MatchObject.lastindex
+   .. attribute:: MatchObject.lastindex
 
-   The integer index of the last matched capturing group, or ``None`` if no group
-   was matched at all. For example, the expressions ``(a)b``, ``((a)(b))``, and
-   ``((ab))`` will have ``lastindex == 1`` if applied to the string ``'ab'``, while
-   the expression ``(a)(b)`` will have ``lastindex == 2``, if applied to the same
-   string.
+      The integer index of the last matched capturing group, or ``None`` if no group
+      was matched at all. For example, the expressions ``(a)b``, ``((a)(b))``, and
+      ``((ab))`` will have ``lastindex == 1`` if applied to the string ``'ab'``, while
+      the expression ``(a)(b)`` will have ``lastindex == 2``, if applied to the same
+      string.
 
 
-.. attribute:: MatchObject.lastgroup
+   .. attribute:: MatchObject.lastgroup
 
-   The name of the last matched capturing group, or ``None`` if the group didn't
-   have a name, or if no group was matched at all.
+      The name of the last matched capturing group, or ``None`` if the group didn't
+      have a name, or if no group was matched at all.
 
 
-.. attribute:: MatchObject.re
+   .. attribute:: MatchObject.re
 
-   The regular expression object whose :meth:`~RegexObject.match` or
-   :meth:`~RegexObject.search` method produced this :class:`MatchObject`
-   instance.
+      The regular expression object whose :meth:`~RegexObject.match` or
+      :meth:`~RegexObject.search` method produced this :class:`MatchObject`
+      instance.
 
 
-.. attribute:: MatchObject.string
+   .. attribute:: MatchObject.string
 
-   The string passed to :meth:`~RegexObject.match` or
-   :meth:`~RegexObject.search`.
+      The string passed to :meth:`~RegexObject.match` or
+      :meth:`~RegexObject.search`.
 
 
 Examples

Modified: python/branches/py3k-jit/Doc/library/unicodedata.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/unicodedata.rst	(original)
+++ python/branches/py3k-jit/Doc/library/unicodedata.rst	Fri Apr  2 01:59:59 2010
@@ -15,12 +15,12 @@
 
 This module provides access to the Unicode Character Database which defines
 character properties for all Unicode characters. The data in this database is
-based on the :file:`UnicodeData.txt` file version 5.1.0 which is publicly
+based on the :file:`UnicodeData.txt` file version 5.2.0 which is publicly
 available from ftp://ftp.unicode.org/.
 
 The module uses the same names and symbols as defined by the UnicodeData File
-Format 5.1.0 (see http://www.unicode.org/Public/5.1.0/ucd/UCD.html).  It defines
-the following functions:
+Format 5.2.0 (see http://www.unicode.org/reports/tr44/tr44-4.html).
+It defines the following functions:
 
 
 .. function:: lookup(name)

Modified: python/branches/py3k-jit/Doc/reference/expressions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/reference/expressions.rst	(original)
+++ python/branches/py3k-jit/Doc/reference/expressions.rst	Fri Apr  2 01:59:59 2010
@@ -1061,7 +1061,7 @@
 support this as well as dictionary, for which :keyword:`in` tests whether a the
 dictionary has a given key. For container types such as list, tuple, set,
 frozenset, dict, or collections.deque, the expression ``x in y`` is equivalent
-to ``any(x is e or x == e for val e in y)``.
+to ``any(x is e or x == e for e in y)``.
 
 For the string and bytes types, ``x in y`` is true if and only if *x* is a
 substring of *y*.  An equivalent test is ``y.find(x) != -1``.  Empty strings are

Modified: python/branches/py3k-jit/Doc/tutorial/datastructures.rst
==============================================================================
--- python/branches/py3k-jit/Doc/tutorial/datastructures.rst	(original)
+++ python/branches/py3k-jit/Doc/tutorial/datastructures.rst	Fri Apr  2 01:59:59 2010
@@ -137,26 +137,25 @@
 
 .. sectionauthor:: Ka-Ping Yee <ping at lfw.org>
 
+It is also possible to use a list as a queue, where the first element added is
+the first element retrieved ("first-in, first-out"); however, lists are not
+efficient for this purpose.  While appends and pops from the end of list are
+fast, doing inserts or pops from the beginning of a list is slow (because all
+of the other elements have to be shifted by one).
 
-You can also use a list conveniently as a queue, where the first element added
-is the first element retrieved ("first-in, first-out").  To add an item to the
-back of the queue, use :meth:`append`.  To retrieve an item from the front of
-the queue, use :meth:`pop` with ``0`` as the index.  For example::
+To implement a queue, use :class:`collections.deque` which was designed to
+have fast appends and pops from both ends.  For example::
 
-   >>> queue = ["Eric", "John", "Michael"]
+   >>> from collections import deque
+   >>> queue = deque(["Eric", "John", "Michael"])
    >>> queue.append("Terry")           # Terry arrives
    >>> queue.append("Graham")          # Graham arrives
-   >>> queue.pop(0)
+   >>> queue.popleft()                 # The first to arrive now leaves
    'Eric'
-   >>> queue.pop(0)
+   >>> queue.popleft()                 # The second to arrive now leaves
    'John'
-   >>> queue
-   ['Michael', 'Terry', 'Graham']
-
-However, since lists are implemented as an array of elements, they are not the
-optimal data structure to use as a queue (the ``pop(0)`` needs to move all
-following elements).  See :ref:`tut-list-tools` for a look at
-:class:`collections.deque`, which is designed to work efficiently as a queue.
+   >>> queue                           # Remaining queue in order of arrival
+   deque(['Michael', 'Terry', 'Graham'])
 
 
 .. _tut-listcomps:

Modified: python/branches/py3k-jit/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.7.rst	(original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.7.rst	Fri Apr  2 01:59:59 2010
@@ -933,11 +933,13 @@
   a timeout was provided and the operation timed out.
   (Contributed by Tim Lesher; :issue:`1674032`.)
 
-* The Unicode database provided by the :mod:`unicodedata` module
-  remains at version 5.1.0, but Python now uses it internally to
-  determine which characters are numeric, whitespace, or represent
-  line breaks.  The database also now includes information from the
-  :file:`Unihan.txt` data file.  (Patch by Anders Chrigström
+* The Unicode database has been updated to the version 5.2.0.
+  (Updated by Florent Xicluna; :issue:`8024`.)
+
+* The Unicode database provided by the :mod:`unicodedata` is used
+  internally to determine which characters are numeric, whitespace,
+  or represent line breaks.  The database also now includes information
+  from the :file:`Unihan.txt` data file.  (Patch by Anders Chrigström
   and Amaury Forgeot d'Arc; :issue:`1571184`.)
 
 * The :class:`UserDict` class is now a new-style class.  (Changed by

Modified: python/branches/py3k-jit/Include/ceval.h
==============================================================================
--- python/branches/py3k-jit/Include/ceval.h	(original)
+++ python/branches/py3k-jit/Include/ceval.h	Fri Apr  2 01:59:59 2010
@@ -10,10 +10,6 @@
 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
 	PyObject *, PyObject *, PyObject *);
 
-/* DLL-level Backwards compatibility: */
-#undef PyEval_CallObject
-PyAPI_FUNC(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
-
 /* Inline this */
 #define PyEval_CallObject(func,arg) \
         PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)

Modified: python/branches/py3k-jit/Lib/argparse.py
==============================================================================
--- python/branches/py3k-jit/Lib/argparse.py	(original)
+++ python/branches/py3k-jit/Lib/argparse.py	Fri Apr  2 01:59:59 2010
@@ -1,16 +1,4 @@
-# Copyright 2006-2009 Steven J. Bethard <steven.bethard at gmail.com>.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy
-# of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
+# Author: Steven J. Bethard <steven.bethard at gmail.com>.
 
 """Command-line parsing library
 

Modified: python/branches/py3k-jit/Lib/fractions.py
==============================================================================
--- python/branches/py3k-jit/Lib/fractions.py	(original)
+++ python/branches/py3k-jit/Lib/fractions.py	Fri Apr  2 01:59:59 2010
@@ -526,8 +526,6 @@
         if isinstance(other, numbers.Rational):
             return op(self._numerator * other.denominator,
                       self._denominator * other.numerator)
-        if isinstance(other, numbers.Complex) and other.imag == 0:
-            other = other.real
         if isinstance(other, float):
             if math.isnan(other) or math.isinf(other):
                 return op(0.0, other)

Modified: python/branches/py3k-jit/Lib/idlelib/PyShell.py
==============================================================================
--- python/branches/py3k-jit/Lib/idlelib/PyShell.py	(original)
+++ python/branches/py3k-jit/Lib/idlelib/PyShell.py	Fri Apr  2 01:59:59 2010
@@ -347,7 +347,7 @@
     rpcpid = None
 
     def spawn_subprocess(self):
-        if self.subprocess_arglist == None:
+        if self.subprocess_arglist is None:
             self.subprocess_arglist = self.build_subprocess_arglist()
         args = self.subprocess_arglist
         self.rpcpid = os.spawnv(os.P_NOWAIT, sys.executable, args)

Modified: python/branches/py3k-jit/Lib/inspect.py
==============================================================================
--- python/branches/py3k-jit/Lib/inspect.py	(original)
+++ python/branches/py3k-jit/Lib/inspect.py	Fri Apr  2 01:59:59 2010
@@ -17,7 +17,7 @@
     getmodule() - determine the module that an object came from
     getclasstree() - arrange classes so as to represent their hierarchy
 
-    getargspec(), getargvalues() - get info about function arguments
+    getargspec(), getargvalues(), getcallargs() - get info about function arguments
     getfullargspec() - same, with support for Python-3000 features
     formatargspec(), formatargvalues() - format an argument spec
     getouterframes(), getinnerframes() - get info about frames
@@ -33,6 +33,7 @@
 import sys
 import os
 import types
+import itertools
 import string
 import re
 import dis
@@ -926,6 +927,71 @@
         specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
     return '(' + ', '.join(specs) + ')'
 
+def getcallargs(func, *positional, **named):
+    """Get the mapping of arguments to values.
+
+    A dict is returned, with keys the function argument names (including the
+    names of the * and ** arguments, if any), and values the respective bound
+    values from 'positional' and 'named'."""
+    spec = getfullargspec(func)
+    args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = spec
+    f_name = func.__name__
+    arg2value = {}
+
+    if ismethod(func) and func.__self__ is not None:
+        # implicit 'self' (or 'cls' for classmethods) argument
+        positional = (func.__self__,) + positional
+    num_pos = len(positional)
+    num_total = num_pos + len(named)
+    num_args = len(args)
+    num_defaults = len(defaults) if defaults else 0
+    for arg, value in zip(args, positional):
+        arg2value[arg] = value
+    if varargs:
+        if num_pos > num_args:
+            arg2value[varargs] = positional[-(num_pos-num_args):]
+        else:
+            arg2value[varargs] = ()
+    elif 0 < num_args < num_pos:
+        raise TypeError('%s() takes %s %d %s (%d given)' % (
+            f_name, 'at most' if defaults else 'exactly', num_args,
+            'arguments' if num_args > 1 else 'argument', num_total))
+    elif num_args == 0 and num_total:
+        raise TypeError('%s() takes no arguments (%d given)' %
+                        (f_name, num_total))
+
+    for arg in itertools.chain(args, kwonlyargs):
+        if arg in named:
+            if arg in arg2value:
+                raise TypeError("%s() got multiple values for keyword "
+                                "argument '%s'" % (f_name, arg))
+            else:
+                arg2value[arg] = named.pop(arg)
+    for kwonlyarg in kwonlyargs:
+        if kwonlyarg not in arg2value:
+            try:
+                arg2value[kwonlyarg] = kwonlydefaults[kwonlyarg]
+            except KeyError:
+                raise TypeError("%s() needs keyword-only argument %s" %
+                                (f_name, kwonlyarg))
+    if defaults:    # fill in any missing values with the defaults
+        for arg, value in zip(args[-num_defaults:], defaults):
+            if arg not in arg2value:
+                arg2value[arg] = value
+    if varkw:
+        arg2value[varkw] = named
+    elif named:
+        unexpected = next(iter(named))
+        raise TypeError("%s() got an unexpected keyword argument '%s'" %
+                        (f_name, unexpected))
+    unassigned = num_args - len([arg for arg in args if arg in arg2value])
+    if unassigned:
+        num_required = num_args - num_defaults
+        raise TypeError('%s() takes %s %d %s (%d given)' % (
+            f_name, 'at least' if defaults else 'exactly', num_required,
+            'arguments' if num_required > 1 else 'argument', num_total))
+    return arg2value
+
 # -------------------------------------------------- stack frame extraction
 
 Traceback = namedtuple('Traceback', 'filename lineno function code_context index')

Modified: python/branches/py3k-jit/Lib/lib2to3/pgen2/tokenize.py
==============================================================================
--- python/branches/py3k-jit/Lib/lib2to3/pgen2/tokenize.py	(original)
+++ python/branches/py3k-jit/Lib/lib2to3/pgen2/tokenize.py	Fri Apr  2 01:59:59 2010
@@ -253,14 +253,16 @@
     in.
 
     It detects the encoding from the presence of a utf-8 bom or an encoding
-    cookie as specified in pep-0263. If both a bom and a cookie are present,
-    but disagree, a SyntaxError will be raised. If the encoding cookie is an
-    invalid charset, raise a SyntaxError.
+    cookie as specified in pep-0263. If both a bom and a cookie are present, but
+    disagree, a SyntaxError will be raised. If the encoding cookie is an invalid
+    charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
+    'utf-8-sig' is returned.
 
     If no encoding is specified, then the default of 'utf-8' will be returned.
     """
     bom_found = False
     encoding = None
+    default = 'utf-8'
     def read_or_stop():
         try:
             return readline()
@@ -287,17 +289,16 @@
             if codec.name != 'utf-8':
                 # This behaviour mimics the Python interpreter
                 raise SyntaxError('encoding problem: utf-8')
-            else:
-                # Allow it to be properly encoded and decoded.
-                encoding = 'utf-8-sig'
+            encoding += '-sig'
         return encoding
 
     first = read_or_stop()
     if first.startswith(BOM_UTF8):
         bom_found = True
         first = first[3:]
+        default = 'utf-8-sig'
     if not first:
-        return 'utf-8', []
+        return default, []
 
     encoding = find_cookie(first)
     if encoding:
@@ -305,13 +306,13 @@
 
     second = read_or_stop()
     if not second:
-        return 'utf-8', [first]
+        return default, [first]
 
     encoding = find_cookie(second)
     if encoding:
         return encoding, [first, second]
 
-    return 'utf-8', [first, second]
+    return default, [first, second]
 
 def untokenize(iterable):
     """Transform tokens back into Python source code.

Modified: python/branches/py3k-jit/Lib/lib2to3/tests/test_fixers.py
==============================================================================
--- python/branches/py3k-jit/Lib/lib2to3/tests/test_fixers.py	(original)
+++ python/branches/py3k-jit/Lib/lib2to3/tests/test_fixers.py	Fri Apr  2 01:59:59 2010
@@ -4285,3 +4285,91 @@
     def test_bare_sequenceIncludes(self):
         s = "sequenceIncludes(x, y)"
         self.warns_unchanged(s, "You should use operator.contains here.")
+
+
+class Test_exitfunc(FixerTestCase):
+
+    fixer = "exitfunc"
+
+    def test_simple(self):
+        b = """
+            import sys
+            sys.exitfunc = my_atexit
+            """
+        a = """
+            import sys
+            import atexit
+            atexit.register(my_atexit)
+            """
+        self.check(b, a)
+
+    def test_names_import(self):
+        b = """
+            import sys, crumbs
+            sys.exitfunc = my_func
+            """
+        a = """
+            import sys, crumbs, atexit
+            atexit.register(my_func)
+            """
+        self.check(b, a)
+
+    def test_complex_expression(self):
+        b = """
+            import sys
+            sys.exitfunc = do(d)/a()+complex(f=23, g=23)*expression
+            """
+        a = """
+            import sys
+            import atexit
+            atexit.register(do(d)/a()+complex(f=23, g=23)*expression)
+            """
+        self.check(b, a)
+
+    def test_comments(self):
+        b = """
+            import sys # Foo
+            sys.exitfunc = f # Blah
+            """
+        a = """
+            import sys
+            import atexit # Foo
+            atexit.register(f) # Blah
+            """
+        self.check(b, a)
+
+        b = """
+            import apples, sys, crumbs, larry # Pleasant comments
+            sys.exitfunc = func
+            """
+        a = """
+            import apples, sys, crumbs, larry, atexit # Pleasant comments
+            atexit.register(func)
+            """
+        self.check(b, a)
+
+    def test_in_a_function(self):
+        b = """
+            import sys
+            def f():
+                sys.exitfunc = func
+            """
+        a = """
+            import sys
+            import atexit
+            def f():
+                atexit.register(func)
+             """
+        self.check(b, a)
+
+    def test_no_sys_import(self):
+        b = """sys.exitfunc = f"""
+        a = """atexit.register(f)"""
+        msg = ("Can't find sys import; Please add an atexit import at the "
+            "top of your file.")
+        self.warns(b, a, msg)
+
+
+    def test_unchanged(self):
+        s = """f(sys.exitfunc)"""
+        self.unchanged(s)

Modified: python/branches/py3k-jit/Lib/lib2to3/tests/test_parser.py
==============================================================================
--- python/branches/py3k-jit/Lib/lib2to3/tests/test_parser.py	(original)
+++ python/branches/py3k-jit/Lib/lib2to3/tests/test_parser.py	Fri Apr  2 01:59:59 2010
@@ -206,6 +206,7 @@
     finally:
         f.close()
     try:
-        return os.system("diff -u %r @" % fn)
+        fn = fn.replace('"', '\\"')
+        return os.system('diff -u "%s" @' % fn)
     finally:
         os.remove("@")

Modified: python/branches/py3k-jit/Lib/py_compile.py
==============================================================================
--- python/branches/py3k-jit/Lib/py_compile.py	(original)
+++ python/branches/py3k-jit/Lib/py_compile.py	Fri Apr  2 01:59:59 2010
@@ -138,19 +138,35 @@
     not specified) are compiled and the resulting bytecode is cached
     in the normal manner.  This function does not search a directory
     structure to locate source files; it only compiles files named
-    explicitly.
+    explicitly.  If '-' is the only parameter in args, the list of
+    files is taken from standard input.
 
     """
     if args is None:
         args = sys.argv[1:]
     rv = 0
-    for filename in args:
-        try:
-            compile(filename, doraise=True)
-        except PyCompileError as err:
-            # return value to indicate at least one failure
-            rv = 1
-            sys.stderr.write(err.msg)
+    if args == ['-']:
+        while True:
+            filename = sys.stdin.readline()
+            if not filename:
+                break
+            filename = filename.rstrip('\n')
+            try:
+                compile(filename, doraise=True)
+            except PyCompileError as error:
+                rv = 1
+                sys.stderr.write("%s\n" % error.msg)
+            except IOError as error:
+                rv = 1
+                sys.stderr.write("%s\n" % error)
+    else:
+        for filename in args:
+            try:
+                compile(filename, doraise=True)
+            except PyCompileError as err:
+                # return value to indicate at least one failure
+                rv = 1
+                sys.stderr.write(error.msg)
     return rv
 
 if __name__ == "__main__":

Modified: python/branches/py3k-jit/Lib/pydoc.py
==============================================================================
--- python/branches/py3k-jit/Lib/pydoc.py	(original)
+++ python/branches/py3k-jit/Lib/pydoc.py	Fri Apr  2 01:59:59 2010
@@ -349,7 +349,8 @@
                                  'marshal', 'posix', 'signal', 'sys',
                                  '_thread', 'zipimport') or
              (file.startswith(basedir) and
-              not file.startswith(os.path.join(basedir, 'site-packages'))))):
+              not file.startswith(os.path.join(basedir, 'site-packages')))) and
+            object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
             if docloc.startswith("http://"):
                 docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__)
             else:

Modified: python/branches/py3k-jit/Lib/site.py
==============================================================================
--- python/branches/py3k-jit/Lib/site.py	(original)
+++ python/branches/py3k-jit/Lib/site.py	Fri Apr  2 01:59:59 2010
@@ -112,7 +112,7 @@
     s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
     if hasattr(sys, 'gettotalrefcount'):
         s += '-pydebug'
-    s = os.path.join(os.path.dirname(sys.path[-1]), s)
+    s = os.path.join(os.path.dirname(sys.path.pop()), s)
     sys.path.append(s)
 
 

Modified: python/branches/py3k-jit/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/regrtest.py	(original)
+++ python/branches/py3k-jit/Lib/test/regrtest.py	Fri Apr  2 01:59:59 2010
@@ -397,6 +397,7 @@
     skipped = []
     resource_denieds = []
     environment_changed = []
+    interrupted = False
 
     if findleaks:
         try:
@@ -451,11 +452,11 @@
         print("==  ", os.getcwd())
 
     alltests = findtests(testdir, stdtests, nottests)
-    tests = tests or args or alltests
+    selected = tests or args or alltests
     if single:
-        tests = tests[:1]
+        selected = selected[:1]
         try:
-            next_single_test = alltests[alltests.index(tests[0])+1]
+            next_single_test = alltests[alltests.index(selected[0])+1]
         except IndexError:
             next_single_test = None
     # Remove all the tests that precede start if it's set.
@@ -467,7 +468,7 @@
     if randomize:
         random.seed(random_seed)
         print("Using random seed", random_seed)
-        random.shuffle(tests)
+        random.shuffle(selected)
     if trace:
         import trace, tempfile
         tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,
@@ -496,7 +497,7 @@
             resource_denieds.append(test)
 
     if forever:
-        def test_forever(tests=list(tests)):
+        def test_forever(tests=list(selected)):
             while True:
                 for test in tests:
                     yield test
@@ -504,15 +505,13 @@
                         return
         tests = test_forever()
     else:
-        tests = iter(tests)
+        tests = iter(selected)
 
     if use_mp:
         from threading import Thread
         from queue import Queue
         from subprocess import Popen, PIPE
-        from collections import deque
         debug_output_pat = re.compile(r"\[\d+ refs\]$")
-        pending = deque()
         output = Queue()
         def tests_and_args():
             for test in tests:
@@ -571,6 +570,7 @@
                     raise KeyboardInterrupt   # What else?
                 accumulate_result(test, result)
         except KeyboardInterrupt:
+            interrupted = True
             pending.close()
         for worker in workers:
             worker.join()
@@ -593,8 +593,7 @@
                         print("Re-running test {} in verbose mode".format(test))
                         runtest(test, True, quiet, testdir, huntrleaks, debug)
                 except KeyboardInterrupt:
-                    # print a newline separate from the ^C
-                    print()
+                    interrupted = True
                     break
                 except:
                     raise
@@ -612,14 +611,15 @@
                 if module not in save_modules and module.startswith("test."):
                     support.unload(module)
 
-    # The lists won't be sorted if running with -r
-    good.sort()
-    bad.sort()
-    skipped.sort()
-    environment_changed.sort()
-
+    if interrupted:
+        # print a newline after ^C
+        print()
+        print("Test suite interrupted by signal SIGINT.")
+        omitted = set(selected) - set(good) - set(bad) - set(skipped)
+        print(count(len(omitted), "test"), "omitted:")
+        printlist(omitted)
     if good and not quiet:
-        if not bad and not skipped and len(good) > 1:
+        if not bad and not skipped and not interrupted and len(good) > 1:
             print("All", end=' ')
         print(count(len(good), "test"), "OK.")
     if print_slow:
@@ -684,7 +684,7 @@
     if runleaks:
         os.system("leaks %d" % os.getpid())
 
-    sys.exit(len(bad) > 0)
+    sys.exit(len(bad) > 0 or interrupted)
 
 
 STDTESTS = [
@@ -1128,7 +1128,8 @@
 
     from textwrap import fill
     blanks = ' ' * indent
-    print(fill(' '.join(str(elt) for elt in x), width,
+    # Print the sorted list: 'x' may be a '--random' list or a set()
+    print(fill(' '.join(str(elt) for elt in sorted(x)), width,
                initial_indent=blanks, subsequent_indent=blanks))
 
 # Map sys.platform to a string containing the basenames of tests

Modified: python/branches/py3k-jit/Lib/test/test_argparse.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_argparse.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_argparse.py	Fri Apr  2 01:59:59 2010
@@ -1,16 +1,4 @@
-# Copyright 2006-2009 Steven J. Bethard <steven.bethard at gmail.com>.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy
-# of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
+# Author: Steven J. Bethard <steven.bethard at gmail.com>.
 
 import codecs
 import os

Modified: python/branches/py3k-jit/Lib/test/test_bool.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_bool.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_bool.py	Fri Apr  2 01:59:59 2010
@@ -45,6 +45,12 @@
         self.assertEqual(int(True), 1)
         self.assertIsNot(int(True), True)
 
+    def test_float(self):
+        self.assertEqual(float(False), 0.0)
+        self.assertIsNot(float(False), False)
+        self.assertEqual(float(True), 1.0)
+        self.assertIsNot(float(True), True)
+
     def test_math(self):
         self.assertEqual(+False, 0)
         self.assertIsNot(+False, False)
@@ -235,6 +241,12 @@
         finally:
             os.remove(support.TESTFN)
 
+    def test_types(self):
+        # types are always true.
+        for t in [bool, complex, dict, float, int, list, object,
+                  set, str, tuple, type]:
+            self.assertIs(bool(t), True)
+
     def test_operator(self):
         import operator
         self.assertIs(operator.truth(0), False)

Modified: python/branches/py3k-jit/Lib/test/test_decimal.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_decimal.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_decimal.py	Fri Apr  2 01:59:59 2010
@@ -472,6 +472,12 @@
         self.assertRaises(ValueError, Decimal, (1, (4, 10, 4, 9, 1), 2) )
         self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 'a', 1), 2) )
 
+    def test_explicit_from_bool(self):
+        self.assertIs(bool(Decimal(0)), False)
+        self.assertIs(bool(Decimal(1)), True)
+        self.assertEqual(Decimal(False), Decimal(0))
+        self.assertEqual(Decimal(True), Decimal(1))
+
     def test_explicit_from_Decimal(self):
 
         #positive

Modified: python/branches/py3k-jit/Lib/test/test_fractions.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_fractions.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_fractions.py	Fri Apr  2 01:59:59 2010
@@ -479,8 +479,21 @@
 
     def testBigComplexComparisons(self):
         self.assertFalse(F(10**23) == complex(10**23))
-        self.assertTrue(F(10**23) > complex(10**23))
-        self.assertFalse(F(10**23) <= complex(10**23))
+        self.assertRaises(TypeError, operator.gt, F(10**23), complex(10**23))
+        self.assertRaises(TypeError, operator.le, F(10**23), complex(10**23))
+
+        x = F(3, 8)
+        z = complex(0.375, 0.0)
+        w = complex(0.375, 0.2)
+        self.assertTrue(x == z)
+        self.assertFalse(x != z)
+        self.assertFalse(x == w)
+        self.assertTrue(x != w)
+        for op in operator.lt, operator.le, operator.gt, operator.ge:
+            self.assertRaises(TypeError, op, x, z)
+            self.assertRaises(TypeError, op, z, x)
+            self.assertRaises(TypeError, op, x, w)
+            self.assertRaises(TypeError, op, w, x)
 
     def testMixedEqual(self):
         self.assertTrue(0.5 == F(1, 2))

Modified: python/branches/py3k-jit/Lib/test/test_httpservers.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_httpservers.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_httpservers.py	Fri Apr  2 01:59:59 2010
@@ -298,14 +298,22 @@
         self.cgi_dir = os.path.join(self.parent_dir, 'cgi-bin')
         os.mkdir(self.cgi_dir)
 
+        # The shebang line should be pure ASCII: use symlink if possible.
+        # See issue #7668.
+        if hasattr(os, 'symlink'):
+            self.pythonexe = os.path.join(self.parent_dir, 'python')
+            os.symlink(sys.executable, self.pythonexe)
+        else:
+            self.pythonexe = sys.executable
+
         self.file1_path = os.path.join(self.cgi_dir, 'file1.py')
         with open(self.file1_path, 'w') as file1:
-            file1.write(cgi_file1 % sys.executable)
+            file1.write(cgi_file1 % self.pythonexe)
         os.chmod(self.file1_path, 0o777)
 
         self.file2_path = os.path.join(self.cgi_dir, 'file2.py')
         with open(self.file2_path, 'w') as file2:
-            file2.write(cgi_file2 % sys.executable)
+            file2.write(cgi_file2 % self.pythonexe)
         os.chmod(self.file2_path, 0o777)
 
         self.cwd = os.getcwd()
@@ -314,6 +322,8 @@
     def tearDown(self):
         try:
             os.chdir(self.cwd)
+            if self.pythonexe != sys.executable:
+                os.remove(self.pythonexe)
             os.remove(self.file1_path)
             os.remove(self.file2_path)
             os.rmdir(self.cgi_dir)

Modified: python/branches/py3k-jit/Lib/test/test_index.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_index.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_index.py	Fri Apr  2 01:59:59 2010
@@ -39,6 +39,8 @@
         self.assertEqual(-7 .__index__(), -7)
         self.assertEqual(self.o.__index__(), 4)
         self.assertEqual(self.n.__index__(), 5)
+        self.assertEqual(True.__index__(), 1)
+        self.assertEqual(False.__index__(), 0)
 
     def test_subclasses(self):
         r = list(range(10))

Modified: python/branches/py3k-jit/Lib/test/test_inspect.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_inspect.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_inspect.py	Fri Apr  2 01:59:59 2010
@@ -1,3 +1,4 @@
+import re
 import sys
 import types
 import unittest
@@ -166,12 +167,12 @@
 
     def test_trace(self):
         self.assertEqual(len(git.tr), 3)
-        self.assertEqual(git.tr[0][1:], (modfile, 43, 'argue',
-                                         ['            spam(a, b, c)\n'], 0))
-        self.assertEqual(git.tr[1][1:], (modfile, 9, 'spam',
-                                         ['    eggs(b + d, c + f)\n'], 0))
-        self.assertEqual(git.tr[2][1:], (modfile, 18, 'eggs',
-                                         ['    q = y / 0\n'], 0))
+        self.assertEqual(revise(*git.tr[0][1:]),
+             (modfile, 43, 'argue', ['            spam(a, b, c)\n'], 0))
+        self.assertEqual(revise(*git.tr[1][1:]),
+             (modfile, 9, 'spam', ['    eggs(b + d, c + f)\n'], 0))
+        self.assertEqual(revise(*git.tr[2][1:]),
+             (modfile, 18, 'eggs', ['    q = y / 0\n'], 0))
 
     def test_frame(self):
         args, varargs, varkw, locals = inspect.getargvalues(mod.fr)
@@ -519,10 +520,183 @@
         self.assertIn(('m1', 'method', D), attrs, 'missing plain method')
         self.assertIn(('datablob', 'data', A), attrs, 'missing data')
 
+class TestGetcallargsFunctions(unittest.TestCase):
+
+    def assertEqualCallArgs(self, func, call_params_string, locs=None):
+        locs = dict(locs or {}, func=func)
+        r1 = eval('func(%s)' % call_params_string, None, locs)
+        r2 = eval('inspect.getcallargs(func, %s)' % call_params_string, None,
+                  locs)
+        self.assertEqual(r1, r2)
+
+    def assertEqualException(self, func, call_param_string, locs=None):
+        locs = dict(locs or {}, func=func)
+        try:
+            eval('func(%s)' % call_param_string, None, locs)
+        except Exception as e:
+            ex1 = e
+        else:
+            self.fail('Exception not raised')
+        try:
+            eval('inspect.getcallargs(func, %s)' % call_param_string, None,
+                 locs)
+        except Exception as e:
+            ex2 = e
+        else:
+            self.fail('Exception not raised')
+        self.assertIs(type(ex1), type(ex2))
+        self.assertEqual(str(ex1), str(ex2))
+        del ex1, ex2
+
+    def makeCallable(self, signature):
+        """Create a function that returns its locals()"""
+        code = "lambda %s: locals()"
+        return eval(code % signature)
+
+    def test_plain(self):
+        f = self.makeCallable('a, b=1')
+        self.assertEqualCallArgs(f, '2')
+        self.assertEqualCallArgs(f, '2, 3')
+        self.assertEqualCallArgs(f, 'a=2')
+        self.assertEqualCallArgs(f, 'b=3, a=2')
+        self.assertEqualCallArgs(f, '2, b=3')
+        # expand *iterable / **mapping
+        self.assertEqualCallArgs(f, '*(2,)')
+        self.assertEqualCallArgs(f, '*[2]')
+        self.assertEqualCallArgs(f, '*(2, 3)')
+        self.assertEqualCallArgs(f, '*[2, 3]')
+        self.assertEqualCallArgs(f, '**{"a":2}')
+        self.assertEqualCallArgs(f, 'b=3, **{"a":2}')
+        self.assertEqualCallArgs(f, '2, **{"b":3}')
+        self.assertEqualCallArgs(f, '**{"b":3, "a":2}')
+        # expand UserList / UserDict
+        self.assertEqualCallArgs(f, '*collections.UserList([2])')
+        self.assertEqualCallArgs(f, '*collections.UserList([2, 3])')
+        self.assertEqualCallArgs(f, '**collections.UserDict(a=2)')
+        self.assertEqualCallArgs(f, '2, **collections.UserDict(b=3)')
+        self.assertEqualCallArgs(f, 'b=2, **collections.UserDict(a=3)')
+
+    def test_varargs(self):
+        f = self.makeCallable('a, b=1, *c')
+        self.assertEqualCallArgs(f, '2')
+        self.assertEqualCallArgs(f, '2, 3')
+        self.assertEqualCallArgs(f, '2, 3, 4')
+        self.assertEqualCallArgs(f, '*(2,3,4)')
+        self.assertEqualCallArgs(f, '2, *[3,4]')
+        self.assertEqualCallArgs(f, '2, 3, *collections.UserList([4])')
+
+    def test_varkw(self):
+        f = self.makeCallable('a, b=1, **c')
+        self.assertEqualCallArgs(f, 'a=2')
+        self.assertEqualCallArgs(f, '2, b=3, c=4')
+        self.assertEqualCallArgs(f, 'b=3, a=2, c=4')
+        self.assertEqualCallArgs(f, 'c=4, **{"a":2, "b":3}')
+        self.assertEqualCallArgs(f, '2, c=4, **{"b":3}')
+        self.assertEqualCallArgs(f, 'b=2, **{"a":3, "c":4}')
+        self.assertEqualCallArgs(f, '**collections.UserDict(a=2, b=3, c=4)')
+        self.assertEqualCallArgs(f, '2, c=4, **collections.UserDict(b=3)')
+        self.assertEqualCallArgs(f, 'b=2, **collections.UserDict(a=3, c=4)')
+
+    def test_keyword_only(self):
+        f = self.makeCallable('a=3, *, c, d=2')
+        self.assertEqualCallArgs(f, 'c=3')
+        self.assertEqualCallArgs(f, 'c=3, a=3')
+        self.assertEqualCallArgs(f, 'a=2, c=4')
+        self.assertEqualCallArgs(f, '4, c=4')
+        self.assertEqualException(f, '')
+        self.assertEqualException(f, '3')
+        self.assertEqualException(f, 'a=3')
+        self.assertEqualException(f, 'd=4')
+
+    def test_multiple_features(self):
+        f = self.makeCallable('a, b=2, *f, **g')
+        self.assertEqualCallArgs(f, '2, 3, 7')
+        self.assertEqualCallArgs(f, '2, 3, x=8')
+        self.assertEqualCallArgs(f, '2, 3, x=8, *[(4,[5,6]), 7]')
+        self.assertEqualCallArgs(f, '2, x=8, *[3, (4,[5,6]), 7], y=9')
+        self.assertEqualCallArgs(f, 'x=8, *[2, 3, (4,[5,6])], y=9')
+        self.assertEqualCallArgs(f, 'x=8, *collections.UserList('
+                                 '[2, 3, (4,[5,6])]), **{"y":9, "z":10}')
+        self.assertEqualCallArgs(f, '2, x=8, *collections.UserList([3, '
+                                 '(4,[5,6])]), **collections.UserDict('
+                                 'y=9, z=10)')
+
+    def test_errors(self):
+        f0 = self.makeCallable('')
+        f1 = self.makeCallable('a, b')
+        f2 = self.makeCallable('a, b=1')
+        # f0 takes no arguments
+        self.assertEqualException(f0, '1')
+        self.assertEqualException(f0, 'x=1')
+        self.assertEqualException(f0, '1,x=1')
+        # f1 takes exactly 2 arguments
+        self.assertEqualException(f1, '')
+        self.assertEqualException(f1, '1')
+        self.assertEqualException(f1, 'a=2')
+        self.assertEqualException(f1, 'b=3')
+        # f2 takes at least 1 argument
+        self.assertEqualException(f2, '')
+        self.assertEqualException(f2, 'b=3')
+        for f in f1, f2:
+            # f1/f2 takes exactly/at most 2 arguments
+            self.assertEqualException(f, '2, 3, 4')
+            self.assertEqualException(f, '1, 2, 3, a=1')
+            self.assertEqualException(f, '2, 3, 4, c=5')
+            self.assertEqualException(f, '2, 3, 4, a=1, c=5')
+            # f got an unexpected keyword argument
+            self.assertEqualException(f, 'c=2')
+            self.assertEqualException(f, '2, c=3')
+            self.assertEqualException(f, '2, 3, c=4')
+            self.assertEqualException(f, '2, c=4, b=3')
+            self.assertEqualException(f, '**{u"\u03c0\u03b9": 4}')
+            # f got multiple values for keyword argument
+            self.assertEqualException(f, '1, a=2')
+            self.assertEqualException(f, '1, **{"a":2}')
+            self.assertEqualException(f, '1, 2, b=3')
+            # XXX: Python inconsistency
+            # - for functions and bound methods: unexpected keyword 'c'
+            # - for unbound methods: multiple values for keyword 'a'
+            #self.assertEqualException(f, '1, c=3, a=2')
+
+class TestGetcallargsMethods(TestGetcallargsFunctions):
+
+    def setUp(self):
+        class Foo(object):
+            pass
+        self.cls = Foo
+        self.inst = Foo()
+
+    def makeCallable(self, signature):
+        assert 'self' not in signature
+        mk = super(TestGetcallargsMethods, self).makeCallable
+        self.cls.method = mk('self, ' + signature)
+        return self.inst.method
+
+class TestGetcallargsUnboundMethods(TestGetcallargsMethods):
+
+    def makeCallable(self, signature):
+        super(TestGetcallargsUnboundMethods, self).makeCallable(signature)
+        return self.cls.method
+
+    def assertEqualCallArgs(self, func, call_params_string, locs=None):
+        return super(TestGetcallargsUnboundMethods, self).assertEqualCallArgs(
+            *self._getAssertEqualParams(func, call_params_string, locs))
+
+    def assertEqualException(self, func, call_params_string, locs=None):
+        return super(TestGetcallargsUnboundMethods, self).assertEqualException(
+            *self._getAssertEqualParams(func, call_params_string, locs))
+
+    def _getAssertEqualParams(self, func, call_params_string, locs=None):
+        assert 'inst' not in call_params_string
+        locs = dict(locs or {}, inst=self.inst)
+        return (func, 'inst,' + call_params_string, locs)
+
 def test_main():
-    run_unittest(TestDecorators, TestRetrievingSourceCode, TestOneliners,
-                 TestBuggyCases,
-                 TestInterpreterStack, TestClassesAndFunctions, TestPredicates)
+    run_unittest(
+        TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBuggyCases,
+        TestInterpreterStack, TestClassesAndFunctions, TestPredicates,
+        TestGetcallargsFunctions, TestGetcallargsMethods,
+        TestGetcallargsUnboundMethods)
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-jit/Lib/test/test_multiprocessing.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_multiprocessing.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_multiprocessing.py	Fri Apr  2 01:59:59 2010
@@ -64,6 +64,16 @@
 WIN32 = (sys.platform == "win32")
 
 #
+# Some tests require ctypes
+#
+
+try:
+    from ctypes import Structure, Value, copy, c_int, c_double
+except ImportError:
+    Structure = object
+    c_int = c_double = None
+
+#
 # Creates a wrapper for a function which records the time it takes to finish
 #
 
@@ -506,7 +516,7 @@
         queue = self.JoinableQueue()
 
         if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'):
-            return
+            self.skipTest("requires 'queue.task_done()' method")
 
         workers = [self.Process(target=self._test_task_done, args=(queue,))
                    for i in range(4)]
@@ -783,6 +793,8 @@
 
 class _TestValue(BaseTestCase):
 
+    ALLOWED_TYPES = ('processes',)
+
     codes_values = [
         ('i', 4343, 24234),
         ('d', 3.625, -4.25),
@@ -795,10 +807,8 @@
             sv.value = cv[2]
 
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_value(self, raw=False):
-        if self.TYPE != 'processes':
-            return
-
         if raw:
             values = [self.RawValue(code, value)
                       for code, value, _ in self.codes_values]
@@ -816,13 +826,12 @@
         for sv, cv in zip(values, self.codes_values):
             self.assertEqual(sv.value, cv[2])
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_rawvalue(self):
         self.test_value(raw=True)
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_getobj_getlock(self):
-        if self.TYPE != 'processes':
-            return
-
         val1 = self.Value('i', 5)
         lock1 = val1.get_lock()
         obj1 = val1.get_obj()
@@ -850,14 +859,14 @@
 
 class _TestArray(BaseTestCase):
 
+    ALLOWED_TYPES = ('processes',)
+
     def f(self, seq):
         for i in range(1, len(seq)):
             seq[i] += seq[i-1]
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_array(self, raw=False):
-        if self.TYPE != 'processes':
-            return
-
         seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831]
         if raw:
             arr = self.RawArray('i', seq)
@@ -880,13 +889,12 @@
 
         self.assertEqual(list(arr[:]), seq)
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_rawarray(self):
         self.test_array(raw=True)
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_getobj_getlock_obj(self):
-        if self.TYPE != 'processes':
-            return
-
         arr1 = self.Array('i', list(range(10)))
         lock1 = arr1.get_lock()
         obj1 = arr1.get_obj()
@@ -1570,12 +1578,6 @@
 #
 #
 
-try:
-    from ctypes import Structure, Value, copy, c_int, c_double
-except ImportError:
-    Structure = object
-    c_int = c_double = None
-
 class _Foo(Structure):
     _fields_ = [
         ('x', c_int),
@@ -1595,10 +1597,8 @@
         for i in range(len(arr)):
             arr[i] *= 2
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_sharedctypes(self, lock=False):
-        if c_int is None:
-            return
-
         x = Value('i', 7, lock=lock)
         y = Value(c_double, 1.0/3.0, lock=lock)
         foo = Value(_Foo, 3, 2, lock=lock)
@@ -1621,10 +1621,8 @@
     def test_synchronize(self):
         self.test_sharedctypes(lock=True)
 
+    @unittest.skipIf(c_int is None, "requires _ctypes")
     def test_copy(self):
-        if c_int is None:
-            return
-
         foo = _Foo(2, 5.0)
         bar = copy(foo)
         foo.x = 0
@@ -1696,13 +1694,17 @@
     ALLOWED_TYPES = ('processes',)
 
     def test_import(self):
-        modules = (
+        modules = [
             'multiprocessing', 'multiprocessing.connection',
             'multiprocessing.heap', 'multiprocessing.managers',
             'multiprocessing.pool', 'multiprocessing.process',
-            'multiprocessing.reduction', 'multiprocessing.sharedctypes',
+            'multiprocessing.reduction',
             'multiprocessing.synchronize', 'multiprocessing.util'
-            )
+            ]
+
+        if c_int is not None:
+            # This module requires _ctypes
+            modules.append('multiprocessing.sharedctypes')
 
         for name in modules:
             __import__(name)
@@ -1782,12 +1784,12 @@
 
 class TestInvalidHandle(unittest.TestCase):
 
+    @unittest.skipIf(WIN32, "skipped on Windows")
     def test_invalid_handles(self):
-        if WIN32:
-            return
         conn = _multiprocessing.Connection(44977608)
         self.assertRaises(IOError, conn.poll)
         self.assertRaises(IOError, _multiprocessing.Connection, -1)
+
 #
 # Functions used to create test cases from the base ones in this module
 #
@@ -1804,7 +1806,7 @@
 def create_test_cases(Mixin, type):
     result = {}
     glob = globals()
-    Type = type[0].upper() + type[1:]
+    Type = type.capitalize()
 
     for name in list(glob.keys()):
         if name.startswith('_Test'):

Modified: python/branches/py3k-jit/Lib/test/test_ossaudiodev.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_ossaudiodev.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_ossaudiodev.py	Fri Apr  2 01:59:59 2010
@@ -159,6 +159,15 @@
             dsp.close()
             self.assertTrue(dsp.closed)
 
+    def test_mixer_methods(self):
+        # Issue #8139: ossaudiodev didn't initialize its types properly,
+        # therefore some methods were unavailable.
+        mixer = ossaudiodev.openmixer()
+        try:
+            self.assertGreaterEqual(mixer.fileno(), 0)
+        finally:
+            mixer.close()
+
 
 def test_main():
     try:

Modified: python/branches/py3k-jit/Lib/test/test_pep277.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_pep277.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_pep277.py	Fri Apr  2 01:59:59 2010
@@ -15,11 +15,6 @@
     '\u66e8\u66e9\u66eb',
     '\u66e8\u05e9\u3093\u0434\u0393\xdf',
     # Specific code points: fn, NFC(fn) and NFKC(fn) all differents
-    '\u2000\u2000\u2000A',
-    '\u2001\u2001\u2001A',
-    '\u2003\u2003\u2003A',  # == NFC('\u2001\u2001\u2001A')
-    '\u0020\u0020\u0020A',  # '\u0020' == ' ' == NFKC('\u2000')
-                            # '\u0020' == NFKC('\u2001') == NFKC('\u2003')
     '\u1fee\u1ffd',
     # Specific code points: NFC(fn), NFD(fn), NFKC(fn) and NFKD(fn) all differents
     '\u0385\u03d3\u03d4',
@@ -28,6 +23,22 @@
     '\u1e9b\u1fc1\u1fcd\u1fce\u1fcf\u1fdd\u1fde\u1fdf\u1fed',
     ]
 
+# Mac OS X decomposes Unicode names, using Normal Form D.
+# http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+# "However, most volume formats do not follow the exact specification for
+# these normal forms.  For example, HFS Plus uses a variant of Normal Form D
+# in which U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
+# U+2FAFF are not decomposed."
+if sys.platform != 'darwin':
+    filenames.extend([
+        # Specific code points: fn, NFC(fn) and NFKC(fn) all differents
+        '\u1fee\u1ffd\ufad1',
+        '\u2000\u2000\u2000A',
+        '\u2001\u2001\u2001A',
+        '\u2003\u2003\u2003A',  # == NFC('\u2001\u2001\u2001A')
+        '\u0020\u0020\u0020A',  # '\u0020' == ' ' == NFKC('\u2000') ==
+                                #  NFKC('\u2001') == NFKC('\u2003')
+])
 
 # Destroy directory dirname and all files under it, to one level.
 def deltree(dirname):
@@ -114,8 +125,7 @@
             files = set(normalize('NFD', file) for file in files)
         for name in others:
             if sys.platform == 'darwin' and normalize('NFD', name) in files:
-                # Mac OS X decomposes Unicode names, using Normal Form D.
-                # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+                # Mac OS X decomposes Unicode names.  See comment above.
                 os.stat(name)
                 continue
             self._apply_failure(open, name, IOError)
@@ -131,8 +141,7 @@
         f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding()))
         f2 = os.listdir(support.TESTFN)
         if sys.platform == 'darwin':
-            # Mac OS X returns canonically decomposed Unicode (Normal Form D)
-            # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+            # Mac OS X decomposes Unicode names.  See comment above.
             sf0 = set(normalize('NFD', f) for f in self.files)
             f2 = [normalize('NFD', f) for f in f2]
         sf2 = set(os.path.join(support.TESTFN, f) for f in f2)

Modified: python/branches/py3k-jit/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_platform.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_platform.py	Fri Apr  2 01:59:59 2010
@@ -134,7 +134,7 @@
         # using it, per
         # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
         try:
-            with test_support.EnvironmentVarGuard() as environ:
+            with support.EnvironmentVarGuard() as environ:
                 if 'PROCESSOR_ARCHITEW6432' in environ:
                     del environ['PROCESSOR_ARCHITEW6432']
                 environ['PROCESSOR_ARCHITECTURE'] = 'foo'

Modified: python/branches/py3k-jit/Lib/test/test_pydoc.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_pydoc.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_pydoc.py	Fri Apr  2 01:59:59 2010
@@ -8,6 +8,7 @@
 import inspect
 import unittest
 import test.support
+import xml.etree
 from contextlib import contextmanager
 from test.support import (
     TESTFN, forget, rmtree, EnvironmentVarGuard, reap_children)
@@ -265,6 +266,11 @@
             print_diffs(expected_text, result)
             self.fail("outputs are not equal, see diff above")
 
+    def test_issue8225(self):
+        # Test issue8225 to ensure no doc link appears for xml.etree
+        result, doc_loc = get_pydoc_text(xml.etree)
+        self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
+
     def test_not_here(self):
         missing_module = "test.i_am_not_here"
         result = str(run_pydoc(missing_module), 'ascii')

Modified: python/branches/py3k-jit/Lib/test/test_subprocess.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_subprocess.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_subprocess.py	Fri Apr  2 01:59:59 2010
@@ -37,7 +37,7 @@
         return os.open(fname, os.O_RDWR|os.O_CREAT), fname
 
 
-class ProcessTestCase(unittest.TestCase):
+class BaseTestCase(unittest.TestCase):
     def setUp(self):
         # Try to minimize the number of children we have so this test
         # doesn't crash on some buildbots (Alphas in particular).
@@ -56,6 +56,9 @@
         actual = re.sub("\[\d+ refs\]\r?\n?$", "", stderr.decode()).encode()
         self.assertEqual(actual, expected, msg)
 
+
+class ProcessTestCase(BaseTestCase):
+
     def test_call_seq(self):
         # call() function with sequence argument
         rc = subprocess.call([sys.executable, "-c",
@@ -559,17 +562,7 @@
 
 
 @unittest.skipIf(mswindows, "POSIX specific tests")
-class POSIXProcessTestCase(unittest.TestCase):
-    def setUp(self):
-        # Try to minimize the number of children we have so this test
-        # doesn't crash on some buildbots (Alphas in particular).
-        support.reap_children()
-
-    def tearDown(self):
-        for inst in subprocess._active:
-            inst.wait()
-        subprocess._cleanup()
-        self.assertFalse(subprocess._active, "subprocess._active not empty")
+class POSIXProcessTestCase(BaseTestCase):
 
     def test_exceptions(self):
         nonexistent_dir = "/_this/pa.th/does/not/exist"
@@ -752,7 +745,7 @@
         # Do not inherit file handles from the parent.
         # It should fix failures on some platforms.
         p = subprocess.Popen([sys.executable, "-c", "input()"], close_fds=True,
-                             stdin=subprocess.PIPE)
+                             stdin=subprocess.PIPE, stderr=subprocess.PIPE)
 
         # Let the process initialize (Issue #3137)
         time.sleep(0.1)
@@ -773,29 +766,25 @@
 
     def test_send_signal(self):
         p = self._kill_process('send_signal', signal.SIGINT)
+        _, stderr = p.communicate()
+        self.assertIn(b'KeyboardInterrupt', stderr)
         self.assertNotEqual(p.wait(), 0)
 
     def test_kill(self):
         p = self._kill_process('kill')
+        _, stderr = p.communicate()
+        self.assertStderrEqual(stderr, b'')
         self.assertEqual(p.wait(), -signal.SIGKILL)
 
     def test_terminate(self):
         p = self._kill_process('terminate')
+        _, stderr = p.communicate()
+        self.assertStderrEqual(stderr, b'')
         self.assertEqual(p.wait(), -signal.SIGTERM)
 
 
 @unittest.skipUnless(mswindows, "Windows specific tests")
-class Win32ProcessTestCase(unittest.TestCase):
-    def setUp(self):
-        # Try to minimize the number of children we have so this test
-        # doesn't crash on some buildbots (Alphas in particular).
-        support.reap_children()
-
-    def tearDown(self):
-        for inst in subprocess._active:
-            inst.wait()
-        subprocess._cleanup()
-        self.assertFalse(subprocess._active, "subprocess._active not empty")
+class Win32ProcessTestCase(BaseTestCase):
 
     def test_startupinfo(self):
         # startupinfo argument
@@ -866,7 +855,7 @@
     def _kill_process(self, method, *args):
         # Some win32 buildbot raises EOFError if stdin is inherited
         p = subprocess.Popen([sys.executable, "-c", "input()"],
-                             stdin=subprocess.PIPE)
+                             stdin=subprocess.PIPE, stderr=subprocess.PIPE)
 
         # Let the process initialize (Issue #3137)
         time.sleep(0.1)
@@ -884,6 +873,8 @@
         if count > 1:
             print("p.{}{} succeeded after "
                   "{} attempts".format(method, args, count), file=sys.stderr)
+        _, stderr = p.communicate()
+        self.assertStderrEqual(stderr, b'')
         self.assertEqual(p.wait(), returncode)
         self.assertNotEqual(returncode, 0)
 

Modified: python/branches/py3k-jit/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_sys.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_sys.py	Fri Apr  2 01:59:59 2010
@@ -797,9 +797,15 @@
 
     def test_setfilesystemencoding(self):
         old = sys.getfilesystemencoding()
-        sys.setfilesystemencoding("iso-8859-1")
-        self.assertEqual(sys.getfilesystemencoding(), "iso-8859-1")
-        sys.setfilesystemencoding(old)
+        try:
+            sys.setfilesystemencoding("iso-8859-1")
+            self.assertEqual(sys.getfilesystemencoding(), "iso-8859-1")
+        finally:
+            sys.setfilesystemencoding(old)
+        try:
+            self.assertRaises(LookupError, sys.setfilesystemencoding, "xxx")
+        finally:
+            sys.setfilesystemencoding(old)
 
 def test_main():
     test.support.run_unittest(SysModuleTest, SizeofTest)

Modified: python/branches/py3k-jit/Lib/test/test_unicodedata.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_unicodedata.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_unicodedata.py	Fri Apr  2 01:59:59 2010
@@ -25,7 +25,7 @@
 
     def test_method_checksum(self):
         h = hashlib.sha1()
-        for i in range(65536):
+        for i in range(0x10000):
             char = chr(i)
             data = [
                 # Predicates (single char)
@@ -284,6 +284,17 @@
         self.assertEqual("\u01c5".title(), "\u01c5")
         self.assertEqual("\u01c6".title(), "\u01c5")
 
+    def test_linebreak_7643(self):
+        for i in range(0x10000):
+            lines = (chr(i) + 'A').splitlines()
+            if i in (0x0a, 0x0b, 0x0c, 0x0d, 0x85,
+                     0x1c, 0x1d, 0x1e, 0x2028, 0x2029):
+                self.assertEqual(len(lines), 2,
+                                 r"\u%.4x should be a linebreak" % i)
+            else:
+                self.assertEqual(len(lines), 1,
+                                 r"\u%.4x should not be a linebreak" % i)
+
 def test_main():
     test.support.run_unittest(
         UnicodeMiscTest,

Modified: python/branches/py3k-jit/Lib/test/test_unittest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_unittest.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_unittest.py	Fri Apr  2 01:59:59 2010
@@ -1,4402 +1,11 @@
-"""Test script for unittest.
+import unittest.test
 
-By Collin Winter <collinw at gmail.com>
-
-Still need testing:
-    TestCase.{assert,fail}* methods (some are tested implicitly)
-"""
-
-import builtins
-import os
-import re
-import sys
-import warnings
 from test import support
-import unittest
-from unittest import TestCase, TestProgram
-import types
-from copy import deepcopy
-import io
-import pickle
-import warnings
-
-
-### Support code
-################################################################
-
-def resultFactory(*_):
-    return unittest.TestResult()
-
-class LoggingResult(unittest.TestResult):
-    def __init__(self, log):
-        self._events = log
-        super().__init__()
-
-    def startTest(self, test):
-        self._events.append('startTest')
-        super().startTest(test)
-
-    def startTestRun(self):
-        self._events.append('startTestRun')
-        super(LoggingResult, self).startTestRun()
-
-    def stopTest(self, test):
-        self._events.append('stopTest')
-        super().stopTest(test)
-
-    def stopTestRun(self):
-        self._events.append('stopTestRun')
-        super(LoggingResult, self).stopTestRun()
-
-    def addFailure(self, *args):
-        self._events.append('addFailure')
-        super().addFailure(*args)
-
-    def addSuccess(self, *args):
-        self._events.append('addSuccess')
-        super(LoggingResult, self).addSuccess(*args)
-
-    def addError(self, *args):
-        self._events.append('addError')
-        super().addError(*args)
-
-    def addSkip(self, *args):
-        self._events.append('addSkip')
-        super(LoggingResult, self).addSkip(*args)
-
-    def addExpectedFailure(self, *args):
-        self._events.append('addExpectedFailure')
-        super(LoggingResult, self).addExpectedFailure(*args)
-
-    def addUnexpectedSuccess(self, *args):
-        self._events.append('addUnexpectedSuccess')
-        super(LoggingResult, self).addUnexpectedSuccess(*args)
-
-
-class TestEquality(object):
-    """Used as a mixin for TestCase"""
-
-    # Check for a valid __eq__ implementation
-    def test_eq(self):
-        for obj_1, obj_2 in self.eq_pairs:
-            self.assertEqual(obj_1, obj_2)
-            self.assertEqual(obj_2, obj_1)
-
-    # Check for a valid __ne__ implementation
-    def test_ne(self):
-        for obj_1, obj_2 in self.ne_pairs:
-            self.assertNotEqual(obj_1, obj_2)
-            self.assertNotEqual(obj_2, obj_1)
-
-class TestHashing(object):
-    """Used as a mixin for TestCase"""
-
-    # Check for a valid __hash__ implementation
-    def test_hash(self):
-        for obj_1, obj_2 in self.eq_pairs:
-            try:
-                if not hash(obj_1) == hash(obj_2):
-                    self.fail("%r and %r do not hash equal" % (obj_1, obj_2))
-            except KeyboardInterrupt:
-                raise
-            except Exception as e:
-                self.fail("Problem hashing %r and %r: %s" % (obj_1, obj_2, e))
-
-        for obj_1, obj_2 in self.ne_pairs:
-            try:
-                if hash(obj_1) == hash(obj_2):
-                    self.fail("%s and %s hash equal, but shouldn't" %
-                              (obj_1, obj_2))
-            except KeyboardInterrupt:
-                raise
-            except Exception as e:
-                self.fail("Problem hashing %s and %s: %s" % (obj_1, obj_2, e))
-
-
-# List subclass we can add attributes to.
-class MyClassSuite(list):
-
-    def __init__(self, tests):
-        super(MyClassSuite, self).__init__(tests)
-
-
-################################################################
-### /Support code
-
-class Test_TestLoader(TestCase):
-
-    ### Tests for TestLoader.loadTestsFromTestCase
-    ################################################################
-
-    # "Return a suite of all tests cases contained in the TestCase-derived
-    # class testCaseClass"
-    def test_loadTestsFromTestCase(self):
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-
-        tests = unittest.TestSuite([Foo('test_1'), Foo('test_2')])
-
-        loader = unittest.TestLoader()
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), tests)
-
-    # "Return a suite of all tests cases contained in the TestCase-derived
-    # class testCaseClass"
-    #
-    # Make sure it does the right thing even if no tests were found
-    def test_loadTestsFromTestCase__no_matches(self):
-        class Foo(unittest.TestCase):
-            def foo_bar(self): pass
-
-        empty_suite = unittest.TestSuite()
-
-        loader = unittest.TestLoader()
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), empty_suite)
-
-    # "Return a suite of all tests cases contained in the TestCase-derived
-    # class testCaseClass"
-    #
-    # What happens if loadTestsFromTestCase() is given an object
-    # that isn't a subclass of TestCase? Specifically, what happens
-    # if testCaseClass is a subclass of TestSuite?
-    #
-    # This is checked for specifically in the code, so we better add a
-    # test for it.
-    def test_loadTestsFromTestCase__TestSuite_subclass(self):
-        class NotATestCase(unittest.TestSuite):
-            pass
-
-        loader = unittest.TestLoader()
-        try:
-            loader.loadTestsFromTestCase(NotATestCase)
-        except TypeError:
-            pass
-        else:
-            self.fail('Should raise TypeError')
-
-    # "Return a suite of all tests cases contained in the TestCase-derived
-    # class testCaseClass"
-    #
-    # Make sure loadTestsFromTestCase() picks up the default test method
-    # name (as specified by TestCase), even though the method name does
-    # not match the default TestLoader.testMethodPrefix string
-    def test_loadTestsFromTestCase__default_method_name(self):
-        class Foo(unittest.TestCase):
-            def runTest(self):
-                pass
-
-        loader = unittest.TestLoader()
-        # This has to be false for the test to succeed
-        self.assertFalse('runTest'.startswith(loader.testMethodPrefix))
-
-        suite = loader.loadTestsFromTestCase(Foo)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [Foo('runTest')])
-
-    ################################################################
-    ### /Tests for TestLoader.loadTestsFromTestCase
-
-    ### Tests for TestLoader.loadTestsFromModule
-    ################################################################
-
-    # "This method searches `module` for classes derived from TestCase"
-    def test_loadTestsFromModule__TestCase_subclass(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        expected = [loader.suiteClass([MyTestCase('test')])]
-        self.assertEqual(list(suite), expected)
-
-    # "This method searches `module` for classes derived from TestCase"
-    #
-    # What happens if no tests are found (no TestCase instances)?
-    def test_loadTestsFromModule__no_TestCase_instances(self):
-        m = types.ModuleType('m')
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(m)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [])
-
-    # "This method searches `module` for classes derived from TestCase"
-    #
-    # What happens if no tests are found (TestCases instances, but no tests)?
-    def test_loadTestsFromModule__no_TestCase_tests(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        self.assertEqual(list(suite), [loader.suiteClass()])
-
-    # "This method searches `module` for classes derived from TestCase"s
-    #
-    # What happens if loadTestsFromModule() is given something other
-    # than a module?
-    #
-    # XXX Currently, it succeeds anyway. This flexibility
-    # should either be documented or loadTestsFromModule() should
-    # raise a TypeError
-    #
-    # XXX Certain people are using this behaviour. We'll add a test for it
-    def test_loadTestsFromModule__not_a_module(self):
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-
-        class NotAModule(object):
-            test_2 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(NotAModule)
-
-        reference = [unittest.TestSuite([MyTestCase('test')])]
-        self.assertEqual(list(suite), reference)
-
-
-    # Check that loadTestsFromModule honors (or not) a module
-    # with a load_tests function.
-    def test_loadTestsFromModule__load_tests(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        load_tests_args = []
-        def load_tests(loader, tests, pattern):
-            self.assertIsInstance(tests, unittest.TestSuite)
-            load_tests_args.extend((loader, tests, pattern))
-            return tests
-        m.load_tests = load_tests
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(m)
-        self.assertIsInstance(suite, unittest.TestSuite)
-        self.assertEquals(load_tests_args, [loader, suite, None])
-
-        load_tests_args = []
-        suite = loader.loadTestsFromModule(m, use_load_tests=False)
-        self.assertEquals(load_tests_args, [])
-
-    def test_loadTestsFromModule__faulty_load_tests(self):
-        m = types.ModuleType('m')
-
-        def load_tests(loader, tests, pattern):
-            raise TypeError('some failure')
-        m.load_tests = load_tests
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromModule(m)
-        self.assertIsInstance(suite, unittest.TestSuite)
-        self.assertEqual(suite.countTestCases(), 1)
-        test = list(suite)[0]
-
-        self.assertRaisesRegexp(TypeError, "some failure", test.m)
-
-    ################################################################
-    ### /Tests for TestLoader.loadTestsFromModule()
-
-    ### Tests for TestLoader.loadTestsFromName()
-    ################################################################
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # Is ValueError raised in response to an empty name?
-    def test_loadTestsFromName__empty_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromName('')
-        except ValueError as e:
-            self.assertEqual(str(e), "Empty module name")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise ValueError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when the name contains invalid characters?
-    def test_loadTestsFromName__malformed_name(self):
-        loader = unittest.TestLoader()
-
-        # XXX Should this raise ValueError or ImportError?
-        try:
-            loader.loadTestsFromName('abc () //')
-        except ValueError:
-            pass
-        except ImportError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise ValueError")
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to a
-    # module"
-    #
-    # What happens when a module by that name can't be found?
-    def test_loadTestsFromName__unknown_module_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromName('sdasfasfasdf')
-        except ImportError as e:
-            self.assertEqual(str(e), "No module named sdasfasfasdf")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise ImportError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when the module is found, but the attribute can't?
-    def test_loadTestsFromName__unknown_attr_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromName('unittest.sdasfasfasdf')
-        except AttributeError as e:
-            self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when we provide the module, but the attribute can't be
-    # found?
-    def test_loadTestsFromName__relative_unknown_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromName('sdasfasfasdf', unittest)
-        except AttributeError as e:
-            self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # Does loadTestsFromName raise ValueError when passed an empty
-    # name relative to a provided module?
-    #
-    # XXX Should probably raise a ValueError instead of an AttributeError
-    def test_loadTestsFromName__relative_empty_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromName('', unittest)
-        except AttributeError as e:
-            pass
-        else:
-            self.fail("Failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # What happens when an impossible name is given, relative to the provided
-    # `module`?
-    def test_loadTestsFromName__relative_malformed_name(self):
-        loader = unittest.TestLoader()
-
-        # XXX Should this raise AttributeError or ValueError?
-        try:
-            loader.loadTestsFromName('abc () //', unittest)
-        except ValueError:
-            pass
-        except AttributeError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise ValueError")
-
-    # "The method optionally resolves name relative to the given module"
-    #
-    # Does loadTestsFromName raise TypeError when the `module` argument
-    # isn't a module object?
-    #
-    # XXX Accepts the not-a-module object, ignorning the object's type
-    # This should raise an exception or the method name should be changed
-    #
-    # XXX Some people are relying on this, so keep it for now
-    def test_loadTestsFromName__relative_not_a_module(self):
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-
-        class NotAModule(object):
-            test_2 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('test_2', NotAModule)
-
-        reference = [MyTestCase('test')]
-        self.assertEqual(list(suite), reference)
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # Does it raise an exception if the name resolves to an invalid
-    # object?
-    def test_loadTestsFromName__relative_bad_object(self):
-        m = types.ModuleType('m')
-        m.testcase_1 = object()
-
-        loader = unittest.TestLoader()
-        try:
-            loader.loadTestsFromName('testcase_1', m)
-        except TypeError:
-            pass
-        else:
-            self.fail("Should have raised TypeError")
-
-    # "The specifier name is a ``dotted name'' that may
-    # resolve either to ... a test case class"
-    def test_loadTestsFromName__relative_TestCase_subclass(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('testcase_1', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [MyTestCase('test')])
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    def test_loadTestsFromName__relative_TestSuite(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testsuite = unittest.TestSuite([MyTestCase('test')])
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('testsuite', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        self.assertEqual(list(suite), [MyTestCase('test')])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a test method within a test case class"
-    def test_loadTestsFromName__relative_testmethod(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('testcase_1.test', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        self.assertEqual(list(suite), [MyTestCase('test')])
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # Does loadTestsFromName() raise the proper exception when trying to
-    # resolve "a test method within a test case class" that doesn't exist
-    # for the given name (relative to a provided module)?
-    def test_loadTestsFromName__relative_invalid_testmethod(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        try:
-            loader.loadTestsFromName('testcase_1.testfoo', m)
-        except AttributeError as e:
-            self.assertEqual(str(e), "type object 'MyTestCase' has no attribute 'testfoo'")
-        else:
-            self.fail("Failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a ... TestSuite instance"
-    def test_loadTestsFromName__callable__TestSuite(self):
-        m = types.ModuleType('m')
-        testcase_1 = unittest.FunctionTestCase(lambda: None)
-        testcase_2 = unittest.FunctionTestCase(lambda: None)
-        def return_TestSuite():
-            return unittest.TestSuite([testcase_1, testcase_2])
-        m.return_TestSuite = return_TestSuite
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('return_TestSuite', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [testcase_1, testcase_2])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase ... instance"
-    def test_loadTestsFromName__callable__TestCase_instance(self):
-        m = types.ModuleType('m')
-        testcase_1 = unittest.FunctionTestCase(lambda: None)
-        def return_TestCase():
-            return testcase_1
-        m.return_TestCase = return_TestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromName('return_TestCase', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [testcase_1])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase ... instance"
-    #*****************************************************************
-    #Override the suiteClass attribute to ensure that the suiteClass
-    #attribute is used
-    def test_loadTestsFromName__callable__TestCase_instance_ProperSuiteClass(self):
-        class SubTestSuite(unittest.TestSuite):
-            pass
-        m = types.ModuleType('m')
-        testcase_1 = unittest.FunctionTestCase(lambda: None)
-        def return_TestCase():
-            return testcase_1
-        m.return_TestCase = return_TestCase
-
-        loader = unittest.TestLoader()
-        loader.suiteClass = SubTestSuite
-        suite = loader.loadTestsFromName('return_TestCase', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [testcase_1])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a test method within a test case class"
-    #*****************************************************************
-    #Override the suiteClass attribute to ensure that the suiteClass
-    #attribute is used
-    def test_loadTestsFromName__relative_testmethod_ProperSuiteClass(self):
-        class SubTestSuite(unittest.TestSuite):
-            pass
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        loader.suiteClass=SubTestSuite
-        suite = loader.loadTestsFromName('testcase_1.test', m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        self.assertEqual(list(suite), [MyTestCase('test')])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase or TestSuite instance"
-    #
-    # What happens if the callable returns something else?
-    def test_loadTestsFromName__callable__wrong_type(self):
-        m = types.ModuleType('m')
-        def return_wrong():
-            return 6
-        m.return_wrong = return_wrong
-
-        loader = unittest.TestLoader()
-        try:
-            suite = loader.loadTestsFromName('return_wrong', m)
-        except TypeError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise TypeError")
-
-    # "The specifier can refer to modules and packages which have not been
-    # imported; they will be imported as a side-effect"
-    def test_loadTestsFromName__module_not_loaded(self):
-        # We're going to try to load this module as a side-effect, so it
-        # better not be loaded before we try.
-        #
-        # Why pick audioop? Google shows it isn't used very often, so there's
-        # a good chance that it won't be imported when this test is run
-        module_name = 'audioop'
-
-        if module_name in sys.modules:
-            del sys.modules[module_name]
-
-        loader = unittest.TestLoader()
-        try:
-            suite = loader.loadTestsFromName(module_name)
-
-            self.assertIsInstance(suite, loader.suiteClass)
-            self.assertEqual(list(suite), [])
-
-            # audioop should now be loaded, thanks to loadTestsFromName()
-            self.assertIn(module_name, sys.modules)
-        finally:
-            if module_name in sys.modules:
-                del sys.modules[module_name]
-
-    ################################################################
-    ### Tests for TestLoader.loadTestsFromName()
-
-    ### Tests for TestLoader.loadTestsFromNames()
-    ################################################################
-
-    # "Similar to loadTestsFromName(), but takes a sequence of names rather
-    # than a single name."
-    #
-    # What happens if that sequence of names is empty?
-    def test_loadTestsFromNames__empty_name_list(self):
-        loader = unittest.TestLoader()
-
-        suite = loader.loadTestsFromNames([])
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [])
-
-    # "Similar to loadTestsFromName(), but takes a sequence of names rather
-    # than a single name."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # What happens if that sequence of names is empty?
-    #
-    # XXX Should this raise a ValueError or just return an empty TestSuite?
-    def test_loadTestsFromNames__relative_empty_name_list(self):
-        loader = unittest.TestLoader()
-
-        suite = loader.loadTestsFromNames([], unittest)
-        self.assertIsInstance(suite, loader.suiteClass)
-        self.assertEqual(list(suite), [])
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # Is ValueError raised in response to an empty name?
-    def test_loadTestsFromNames__empty_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames([''])
-        except ValueError as e:
-            self.assertEqual(str(e), "Empty module name")
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise ValueError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when presented with an impossible module name?
-    def test_loadTestsFromNames__malformed_name(self):
-        loader = unittest.TestLoader()
-
-        # XXX Should this raise ValueError or ImportError?
-        try:
-            loader.loadTestsFromNames(['abc () //'])
-        except ValueError:
-            pass
-        except ImportError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise ValueError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when no module can be found for the given name?
-    def test_loadTestsFromNames__unknown_module_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames(['sdasfasfasdf'])
-        except ImportError as e:
-            self.assertEqual(str(e), "No module named sdasfasfasdf")
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise ImportError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # What happens when the module can be found, but not the attribute?
-    def test_loadTestsFromNames__unknown_attr_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames(['unittest.sdasfasfasdf', 'unittest'])
-        except AttributeError as e:
-            self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # What happens when given an unknown attribute on a specified `module`
-    # argument?
-    def test_loadTestsFromNames__unknown_name_relative_1(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames(['sdasfasfasdf'], unittest)
-        except AttributeError as e:
-            self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # Do unknown attributes (relative to a provided module) still raise an
-    # exception even in the presence of valid attribute names?
-    def test_loadTestsFromNames__unknown_name_relative_2(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames(['TestCase', 'sdasfasfasdf'], unittest)
-        except AttributeError as e:
-            self.assertEqual(str(e), "'module' object has no attribute 'sdasfasfasdf'")
-        else:
-            self.fail("TestLoader.loadTestsFromName failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # What happens when faced with the empty string?
-    #
-    # XXX This currently raises AttributeError, though ValueError is probably
-    # more appropriate
-    def test_loadTestsFromNames__relative_empty_name(self):
-        loader = unittest.TestLoader()
-
-        try:
-            loader.loadTestsFromNames([''], unittest)
-        except AttributeError:
-            pass
-        else:
-            self.fail("Failed to raise ValueError")
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    # ...
-    # "The method optionally resolves name relative to the given module"
-    #
-    # What happens when presented with an impossible attribute name?
-    def test_loadTestsFromNames__relative_malformed_name(self):
-        loader = unittest.TestLoader()
-
-        # XXX Should this raise AttributeError or ValueError?
-        try:
-            loader.loadTestsFromNames(['abc () //'], unittest)
-        except AttributeError:
-            pass
-        except ValueError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise ValueError")
-
-    # "The method optionally resolves name relative to the given module"
-    #
-    # Does loadTestsFromNames() make sure the provided `module` is in fact
-    # a module?
-    #
-    # XXX This validation is currently not done. This flexibility should
-    # either be documented or a TypeError should be raised.
-    def test_loadTestsFromNames__relative_not_a_module(self):
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-
-        class NotAModule(object):
-            test_2 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['test_2'], NotAModule)
-
-        reference = [unittest.TestSuite([MyTestCase('test')])]
-        self.assertEqual(list(suite), reference)
-
-    # "The specifier name is a ``dotted name'' that may resolve either to
-    # a module, a test case class, a TestSuite instance, a test method
-    # within a test case class, or a callable object which returns a
-    # TestCase or TestSuite instance."
-    #
-    # Does it raise an exception if the name resolves to an invalid
-    # object?
-    def test_loadTestsFromNames__relative_bad_object(self):
-        m = types.ModuleType('m')
-        m.testcase_1 = object()
-
-        loader = unittest.TestLoader()
-        try:
-            loader.loadTestsFromNames(['testcase_1'], m)
-        except TypeError:
-            pass
-        else:
-            self.fail("Should have raised TypeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a test case class"
-    def test_loadTestsFromNames__relative_TestCase_subclass(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['testcase_1'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        expected = loader.suiteClass([MyTestCase('test')])
-        self.assertEqual(list(suite), [expected])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a TestSuite instance"
-    def test_loadTestsFromNames__relative_TestSuite(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testsuite = unittest.TestSuite([MyTestCase('test')])
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['testsuite'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        self.assertEqual(list(suite), [m.testsuite])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to ... a
-    # test method within a test case class"
-    def test_loadTestsFromNames__relative_testmethod(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['testcase_1.test'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        ref_suite = unittest.TestSuite([MyTestCase('test')])
-        self.assertEqual(list(suite), [ref_suite])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to ... a
-    # test method within a test case class"
-    #
-    # Does the method gracefully handle names that initially look like they
-    # resolve to "a test method within a test case class" but don't?
-    def test_loadTestsFromNames__relative_invalid_testmethod(self):
-        m = types.ModuleType('m')
-        class MyTestCase(unittest.TestCase):
-            def test(self):
-                pass
-        m.testcase_1 = MyTestCase
-
-        loader = unittest.TestLoader()
-        try:
-            loader.loadTestsFromNames(['testcase_1.testfoo'], m)
-        except AttributeError as e:
-            self.assertEqual(str(e), "type object 'MyTestCase' has no attribute 'testfoo'")
-        else:
-            self.fail("Failed to raise AttributeError")
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a ... TestSuite instance"
-    def test_loadTestsFromNames__callable__TestSuite(self):
-        m = types.ModuleType('m')
-        testcase_1 = unittest.FunctionTestCase(lambda: None)
-        testcase_2 = unittest.FunctionTestCase(lambda: None)
-        def return_TestSuite():
-            return unittest.TestSuite([testcase_1, testcase_2])
-        m.return_TestSuite = return_TestSuite
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['return_TestSuite'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        expected = unittest.TestSuite([testcase_1, testcase_2])
-        self.assertEqual(list(suite), [expected])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase ... instance"
-    def test_loadTestsFromNames__callable__TestCase_instance(self):
-        m = types.ModuleType('m')
-        testcase_1 = unittest.FunctionTestCase(lambda: None)
-        def return_TestCase():
-            return testcase_1
-        m.return_TestCase = return_TestCase
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['return_TestCase'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        ref_suite = unittest.TestSuite([testcase_1])
-        self.assertEqual(list(suite), [ref_suite])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase or TestSuite instance"
-    #
-    # Are staticmethods handled correctly?
-    def test_loadTestsFromNames__callable__call_staticmethod(self):
-        m = types.ModuleType('m')
-        class Test1(unittest.TestCase):
-            def test(self):
-                pass
-
-        testcase_1 = Test1('test')
-        class Foo(unittest.TestCase):
-            @staticmethod
-            def foo():
-                return testcase_1
-        m.Foo = Foo
-
-        loader = unittest.TestLoader()
-        suite = loader.loadTestsFromNames(['Foo.foo'], m)
-        self.assertIsInstance(suite, loader.suiteClass)
-
-        ref_suite = unittest.TestSuite([testcase_1])
-        self.assertEqual(list(suite), [ref_suite])
-
-    # "The specifier name is a ``dotted name'' that may resolve ... to
-    # ... a callable object which returns a TestCase or TestSuite instance"
-    #
-    # What happens when the callable returns something else?
-    def test_loadTestsFromNames__callable__wrong_type(self):
-        m = types.ModuleType('m')
-        def return_wrong():
-            return 6
-        m.return_wrong = return_wrong
-
-        loader = unittest.TestLoader()
-        try:
-            suite = loader.loadTestsFromNames(['return_wrong'], m)
-        except TypeError:
-            pass
-        else:
-            self.fail("TestLoader.loadTestsFromNames failed to raise TypeError")
-
-    # "The specifier can refer to modules and packages which have not been
-    # imported; they will be imported as a side-effect"
-    def test_loadTestsFromNames__module_not_loaded(self):
-        # We're going to try to load this module as a side-effect, so it
-        # better not be loaded before we try.
-        #
-        # Why pick audioop? Google shows it isn't used very often, so there's
-        # a good chance that it won't be imported when this test is run
-        module_name = 'audioop'
-
-        if module_name in sys.modules:
-            del sys.modules[module_name]
-
-        loader = unittest.TestLoader()
-        try:
-            suite = loader.loadTestsFromNames([module_name])
-
-            self.assertIsInstance(suite, loader.suiteClass)
-            self.assertEqual(list(suite), [unittest.TestSuite()])
-
-            # audioop should now be loaded, thanks to loadTestsFromName()
-            self.assertIn(module_name, sys.modules)
-        finally:
-            if module_name in sys.modules:
-                del sys.modules[module_name]
-
-    ################################################################
-    ### /Tests for TestLoader.loadTestsFromNames()
-
-    ### Tests for TestLoader.getTestCaseNames()
-    ################################################################
-
-    # "Return a sorted sequence of method names found within testCaseClass"
-    #
-    # Test.foobar is defined to make sure getTestCaseNames() respects
-    # loader.testMethodPrefix
-    def test_getTestCaseNames(self):
-        class Test(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foobar(self): pass
-
-        loader = unittest.TestLoader()
-
-        self.assertEqual(loader.getTestCaseNames(Test), ['test_1', 'test_2'])
-
-    # "Return a sorted sequence of method names found within testCaseClass"
-    #
-    # Does getTestCaseNames() behave appropriately if no tests are found?
-    def test_getTestCaseNames__no_tests(self):
-        class Test(unittest.TestCase):
-            def foobar(self): pass
-
-        loader = unittest.TestLoader()
-
-        self.assertEqual(loader.getTestCaseNames(Test), [])
-
-    # "Return a sorted sequence of method names found within testCaseClass"
-    #
-    # Are not-TestCases handled gracefully?
-    #
-    # XXX This should raise a TypeError, not return a list
-    #
-    # XXX It's too late in the 2.5 release cycle to fix this, but it should
-    # probably be revisited for 2.6
-    def test_getTestCaseNames__not_a_TestCase(self):
-        class BadCase(int):
-            def test_foo(self):
-                pass
-
-        loader = unittest.TestLoader()
-        names = loader.getTestCaseNames(BadCase)
-
-        self.assertEqual(names, ['test_foo'])
-
-    # "Return a sorted sequence of method names found within testCaseClass"
-    #
-    # Make sure inherited names are handled.
-    #
-    # TestP.foobar is defined to make sure getTestCaseNames() respects
-    # loader.testMethodPrefix
-    def test_getTestCaseNames__inheritance(self):
-        class TestP(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foobar(self): pass
-
-        class TestC(TestP):
-            def test_1(self): pass
-            def test_3(self): pass
-
-        loader = unittest.TestLoader()
-
-        names = ['test_1', 'test_2', 'test_3']
-        self.assertEqual(loader.getTestCaseNames(TestC), names)
-
-    ################################################################
-    ### /Tests for TestLoader.getTestCaseNames()
-
-    ### Tests for TestLoader.testMethodPrefix
-    ################################################################
-
-    # "String giving the prefix of method names which will be interpreted as
-    # test methods"
-    #
-    # Implicit in the documentation is that testMethodPrefix is respected by
-    # all loadTestsFrom* methods.
-    def test_testMethodPrefix__loadTestsFromTestCase(self):
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-
-        tests_1 = unittest.TestSuite([Foo('foo_bar')])
-        tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')])
-
-        loader = unittest.TestLoader()
-        loader.testMethodPrefix = 'foo'
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), tests_1)
-
-        loader.testMethodPrefix = 'test'
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), tests_2)
-
-    # "String giving the prefix of method names which will be interpreted as
-    # test methods"
-    #
-    # Implicit in the documentation is that testMethodPrefix is respected by
-    # all loadTestsFrom* methods.
-    def test_testMethodPrefix__loadTestsFromModule(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests_1 = [unittest.TestSuite([Foo('foo_bar')])]
-        tests_2 = [unittest.TestSuite([Foo('test_1'), Foo('test_2')])]
-
-        loader = unittest.TestLoader()
-        loader.testMethodPrefix = 'foo'
-        self.assertEqual(list(loader.loadTestsFromModule(m)), tests_1)
-
-        loader.testMethodPrefix = 'test'
-        self.assertEqual(list(loader.loadTestsFromModule(m)), tests_2)
-
-    # "String giving the prefix of method names which will be interpreted as
-    # test methods"
-    #
-    # Implicit in the documentation is that testMethodPrefix is respected by
-    # all loadTestsFrom* methods.
-    def test_testMethodPrefix__loadTestsFromName(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests_1 = unittest.TestSuite([Foo('foo_bar')])
-        tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')])
-
-        loader = unittest.TestLoader()
-        loader.testMethodPrefix = 'foo'
-        self.assertEqual(loader.loadTestsFromName('Foo', m), tests_1)
-
-        loader.testMethodPrefix = 'test'
-        self.assertEqual(loader.loadTestsFromName('Foo', m), tests_2)
-
-    # "String giving the prefix of method names which will be interpreted as
-    # test methods"
-    #
-    # Implicit in the documentation is that testMethodPrefix is respected by
-    # all loadTestsFrom* methods.
-    def test_testMethodPrefix__loadTestsFromNames(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests_1 = unittest.TestSuite([unittest.TestSuite([Foo('foo_bar')])])
-        tests_2 = unittest.TestSuite([Foo('test_1'), Foo('test_2')])
-        tests_2 = unittest.TestSuite([tests_2])
-
-        loader = unittest.TestLoader()
-        loader.testMethodPrefix = 'foo'
-        self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests_1)
-
-        loader.testMethodPrefix = 'test'
-        self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests_2)
-
-    # "The default value is 'test'"
-    def test_testMethodPrefix__default_value(self):
-        loader = unittest.TestLoader()
-        self.assertEqual(loader.testMethodPrefix, 'test')
-
-    ################################################################
-    ### /Tests for TestLoader.testMethodPrefix
-
-    ### Tests for TestLoader.sortTestMethodsUsing
-    ################################################################
-
-    # "Function to be used to compare method names when sorting them in
-    # getTestCaseNames() and all the loadTestsFromX() methods"
-    def test_sortTestMethodsUsing__loadTestsFromTestCase(self):
-        def reversed_cmp(x, y):
-            return -((x > y) - (x < y))
-
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = reversed_cmp
-
-        tests = loader.suiteClass([Foo('test_2'), Foo('test_1')])
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), tests)
-
-    # "Function to be used to compare method names when sorting them in
-    # getTestCaseNames() and all the loadTestsFromX() methods"
-    def test_sortTestMethodsUsing__loadTestsFromModule(self):
-        def reversed_cmp(x, y):
-            return -((x > y) - (x < y))
-
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-        m.Foo = Foo
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = reversed_cmp
-
-        tests = [loader.suiteClass([Foo('test_2'), Foo('test_1')])]
-        self.assertEqual(list(loader.loadTestsFromModule(m)), tests)
-
-    # "Function to be used to compare method names when sorting them in
-    # getTestCaseNames() and all the loadTestsFromX() methods"
-    def test_sortTestMethodsUsing__loadTestsFromName(self):
-        def reversed_cmp(x, y):
-            return -((x > y) - (x < y))
-
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-        m.Foo = Foo
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = reversed_cmp
-
-        tests = loader.suiteClass([Foo('test_2'), Foo('test_1')])
-        self.assertEqual(loader.loadTestsFromName('Foo', m), tests)
-
-    # "Function to be used to compare method names when sorting them in
-    # getTestCaseNames() and all the loadTestsFromX() methods"
-    def test_sortTestMethodsUsing__loadTestsFromNames(self):
-        def reversed_cmp(x, y):
-            return -((x > y) - (x < y))
-
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-        m.Foo = Foo
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = reversed_cmp
-
-        tests = [loader.suiteClass([Foo('test_2'), Foo('test_1')])]
-        self.assertEqual(list(loader.loadTestsFromNames(['Foo'], m)), tests)
-
-    # "Function to be used to compare method names when sorting them in
-    # getTestCaseNames()"
-    #
-    # Does it actually affect getTestCaseNames()?
-    def test_sortTestMethodsUsing__getTestCaseNames(self):
-        def reversed_cmp(x, y):
-            return -((x > y) - (x < y))
-
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = reversed_cmp
-
-        test_names = ['test_2', 'test_1']
-        self.assertEqual(loader.getTestCaseNames(Foo), test_names)
-
-    # "The default value is the built-in cmp() function"
-    # Since cmp is now defunct, we simply verify that the results
-    # occur in the same order as they would with the default sort.
-    def test_sortTestMethodsUsing__default_value(self):
-        loader = unittest.TestLoader()
-
-        class Foo(unittest.TestCase):
-            def test_2(self): pass
-            def test_3(self): pass
-            def test_1(self): pass
-
-        test_names = ['test_2', 'test_3', 'test_1']
-        self.assertEqual(loader.getTestCaseNames(Foo), sorted(test_names))
-
-
-    # "it can be set to None to disable the sort."
-    #
-    # XXX How is this different from reassigning cmp? Are the tests returned
-    # in a random order or something? This behaviour should die
-    def test_sortTestMethodsUsing__None(self):
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-
-        loader = unittest.TestLoader()
-        loader.sortTestMethodsUsing = None
-
-        test_names = ['test_2', 'test_1']
-        self.assertEqual(set(loader.getTestCaseNames(Foo)), set(test_names))
-
-    ################################################################
-    ### /Tests for TestLoader.sortTestMethodsUsing
-
-    ### Tests for TestLoader.suiteClass
-    ################################################################
-
-    # "Callable object that constructs a test suite from a list of tests."
-    def test_suiteClass__loadTestsFromTestCase(self):
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-
-        tests = [Foo('test_1'), Foo('test_2')]
-
-        loader = unittest.TestLoader()
-        loader.suiteClass = list
-        self.assertEqual(loader.loadTestsFromTestCase(Foo), tests)
-
-    # It is implicit in the documentation for TestLoader.suiteClass that
-    # all TestLoader.loadTestsFrom* methods respect it. Let's make sure
-    def test_suiteClass__loadTestsFromModule(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests = [[Foo('test_1'), Foo('test_2')]]
-
-        loader = unittest.TestLoader()
-        loader.suiteClass = list
-        self.assertEqual(loader.loadTestsFromModule(m), tests)
-
-    # It is implicit in the documentation for TestLoader.suiteClass that
-    # all TestLoader.loadTestsFrom* methods respect it. Let's make sure
-    def test_suiteClass__loadTestsFromName(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests = [Foo('test_1'), Foo('test_2')]
-
-        loader = unittest.TestLoader()
-        loader.suiteClass = list
-        self.assertEqual(loader.loadTestsFromName('Foo', m), tests)
-
-    # It is implicit in the documentation for TestLoader.suiteClass that
-    # all TestLoader.loadTestsFrom* methods respect it. Let's make sure
-    def test_suiteClass__loadTestsFromNames(self):
-        m = types.ModuleType('m')
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-            def foo_bar(self): pass
-        m.Foo = Foo
-
-        tests = [[Foo('test_1'), Foo('test_2')]]
-
-        loader = unittest.TestLoader()
-        loader.suiteClass = list
-        self.assertEqual(loader.loadTestsFromNames(['Foo'], m), tests)
-
-    # "The default value is the TestSuite class"
-    def test_suiteClass__default_value(self):
-        loader = unittest.TestLoader()
-        self.assertTrue(loader.suiteClass is unittest.TestSuite)
-
-    ################################################################
-    ### /Tests for TestLoader.suiteClass
-
-### Support code for Test_TestSuite
-################################################################
-
-class Foo(unittest.TestCase):
-    def test_1(self): pass
-    def test_2(self): pass
-    def test_3(self): pass
-    def runTest(self): pass
-
-def _mk_TestSuite(*names):
-    return unittest.TestSuite(Foo(n) for n in names)
-
-################################################################
-### /Support code for Test_TestSuite
-
-class Test_TestSuite(TestCase, TestEquality):
-
-    ### Set up attributes needed by inherited tests
-    ################################################################
-
-    # Used by TestEquality.test_eq
-    eq_pairs = [(unittest.TestSuite(), unittest.TestSuite())
-               ,(unittest.TestSuite(), unittest.TestSuite([]))
-               ,(_mk_TestSuite('test_1'), _mk_TestSuite('test_1'))]
-
-    # Used by TestEquality.test_ne
-    ne_pairs = [(unittest.TestSuite(), _mk_TestSuite('test_1'))
-               ,(unittest.TestSuite([]), _mk_TestSuite('test_1'))
-               ,(_mk_TestSuite('test_1', 'test_2'), _mk_TestSuite('test_1', 'test_3'))
-               ,(_mk_TestSuite('test_1'), _mk_TestSuite('test_2'))]
-
-    ################################################################
-    ### /Set up attributes needed by inherited tests
-
-    ### Tests for TestSuite.__init__
-    ################################################################
-
-    # "class TestSuite([tests])"
-    #
-    # The tests iterable should be optional
-    def test_init__tests_optional(self):
-        suite = unittest.TestSuite()
-
-        self.assertEqual(suite.countTestCases(), 0)
-
-    # "class TestSuite([tests])"
-    # ...
-    # "If tests is given, it must be an iterable of individual test cases
-    # or other test suites that will be used to build the suite initially"
-    #
-    # TestSuite should deal with empty tests iterables by allowing the
-    # creation of an empty suite
-    def test_init__empty_tests(self):
-        suite = unittest.TestSuite([])
-
-        self.assertEqual(suite.countTestCases(), 0)
-
-    # "class TestSuite([tests])"
-    # ...
-    # "If tests is given, it must be an iterable of individual test cases
-    # or other test suites that will be used to build the suite initially"
-    #
-    # TestSuite should allow any iterable to provide tests
-    def test_init__tests_from_any_iterable(self):
-        def tests():
-            yield unittest.FunctionTestCase(lambda: None)
-            yield unittest.FunctionTestCase(lambda: None)
-
-        suite_1 = unittest.TestSuite(tests())
-        self.assertEqual(suite_1.countTestCases(), 2)
-
-        suite_2 = unittest.TestSuite(suite_1)
-        self.assertEqual(suite_2.countTestCases(), 2)
-
-        suite_3 = unittest.TestSuite(set(suite_1))
-        self.assertEqual(suite_3.countTestCases(), 2)
-
-    # "class TestSuite([tests])"
-    # ...
-    # "If tests is given, it must be an iterable of individual test cases
-    # or other test suites that will be used to build the suite initially"
-    #
-    # Does TestSuite() also allow other TestSuite() instances to be present
-    # in the tests iterable?
-    def test_init__TestSuite_instances_in_tests(self):
-        def tests():
-            ftc = unittest.FunctionTestCase(lambda: None)
-            yield unittest.TestSuite([ftc])
-            yield unittest.FunctionTestCase(lambda: None)
-
-        suite = unittest.TestSuite(tests())
-        self.assertEqual(suite.countTestCases(), 2)
-
-    ################################################################
-    ### /Tests for TestSuite.__init__
-
-    # Container types should support the iter protocol
-    def test_iter(self):
-        test1 = unittest.FunctionTestCase(lambda: None)
-        test2 = unittest.FunctionTestCase(lambda: None)
-        suite = unittest.TestSuite((test1, test2))
-
-        self.assertEqual(list(suite), [test1, test2])
-
-    # "Return the number of tests represented by the this test object.
-    # ...this method is also implemented by the TestSuite class, which can
-    # return larger [greater than 1] values"
-    #
-    # Presumably an empty TestSuite returns 0?
-    def test_countTestCases_zero_simple(self):
-        suite = unittest.TestSuite()
-
-        self.assertEqual(suite.countTestCases(), 0)
-
-    # "Return the number of tests represented by the this test object.
-    # ...this method is also implemented by the TestSuite class, which can
-    # return larger [greater than 1] values"
-    #
-    # Presumably an empty TestSuite (even if it contains other empty
-    # TestSuite instances) returns 0?
-    def test_countTestCases_zero_nested(self):
-        class Test1(unittest.TestCase):
-            def test(self):
-                pass
-
-        suite = unittest.TestSuite([unittest.TestSuite()])
-
-        self.assertEqual(suite.countTestCases(), 0)
-
-    # "Return the number of tests represented by the this test object.
-    # ...this method is also implemented by the TestSuite class, which can
-    # return larger [greater than 1] values"
-    def test_countTestCases_simple(self):
-        test1 = unittest.FunctionTestCase(lambda: None)
-        test2 = unittest.FunctionTestCase(lambda: None)
-        suite = unittest.TestSuite((test1, test2))
-
-        self.assertEqual(suite.countTestCases(), 2)
-
-    # "Return the number of tests represented by the this test object.
-    # ...this method is also implemented by the TestSuite class, which can
-    # return larger [greater than 1] values"
-    #
-    # Make sure this holds for nested TestSuite instances, too
-    def test_countTestCases_nested(self):
-        class Test1(unittest.TestCase):
-            def test1(self): pass
-            def test2(self): pass
-
-        test2 = unittest.FunctionTestCase(lambda: None)
-        test3 = unittest.FunctionTestCase(lambda: None)
-        child = unittest.TestSuite((Test1('test2'), test2))
-        parent = unittest.TestSuite((test3, child, Test1('test1')))
-
-        self.assertEqual(parent.countTestCases(), 4)
-
-    # "Run the tests associated with this suite, collecting the result into
-    # the test result object passed as result."
-    #
-    # And if there are no tests? What then?
-    def test_run__empty_suite(self):
-        events = []
-        result = LoggingResult(events)
-
-        suite = unittest.TestSuite()
-
-        suite.run(result)
-
-        self.assertEqual(events, [])
-
-    # "Note that unlike TestCase.run(), TestSuite.run() requires the
-    # "result object to be passed in."
-    def test_run__requires_result(self):
-        suite = unittest.TestSuite()
-
-        try:
-            suite.run()
-        except TypeError:
-            pass
-        else:
-            self.fail("Failed to raise TypeError")
-
-    # "Run the tests associated with this suite, collecting the result into
-    # the test result object passed as result."
-    def test_run(self):
-        events = []
-        result = LoggingResult(events)
-
-        class LoggingCase(unittest.TestCase):
-            def run(self, result):
-                events.append('run %s' % self._testMethodName)
-
-            def test1(self): pass
-            def test2(self): pass
-
-        tests = [LoggingCase('test1'), LoggingCase('test2')]
-
-        unittest.TestSuite(tests).run(result)
-
-        self.assertEqual(events, ['run test1', 'run test2'])
-
-    # "Add a TestCase ... to the suite"
-    def test_addTest__TestCase(self):
-        class Foo(unittest.TestCase):
-            def test(self): pass
-
-        test = Foo('test')
-        suite = unittest.TestSuite()
-
-        suite.addTest(test)
-
-        self.assertEqual(suite.countTestCases(), 1)
-        self.assertEqual(list(suite), [test])
-
-    # "Add a ... TestSuite to the suite"
-    def test_addTest__TestSuite(self):
-        class Foo(unittest.TestCase):
-            def test(self): pass
-
-        suite_2 = unittest.TestSuite([Foo('test')])
-
-        suite = unittest.TestSuite()
-        suite.addTest(suite_2)
-
-        self.assertEqual(suite.countTestCases(), 1)
-        self.assertEqual(list(suite), [suite_2])
-
-    # "Add all the tests from an iterable of TestCase and TestSuite
-    # instances to this test suite."
-    #
-    # "This is equivalent to iterating over tests, calling addTest() for
-    # each element"
-    def test_addTests(self):
-        class Foo(unittest.TestCase):
-            def test_1(self): pass
-            def test_2(self): pass
-
-        test_1 = Foo('test_1')
-        test_2 = Foo('test_2')
-        inner_suite = unittest.TestSuite([test_2])
-
-        def gen():
-            yield test_1
-            yield test_2
-            yield inner_suite
-
-        suite_1 = unittest.TestSuite()
-        suite_1.addTests(gen())
-
-        self.assertEqual(list(suite_1), list(gen()))
-
-        # "This is equivalent to iterating over tests, calling addTest() for
-        # each element"
-        suite_2 = unittest.TestSuite()
-        for t in gen():
-            suite_2.addTest(t)
-
-        self.assertEqual(suite_1, suite_2)
-
-    # "Add all the tests from an iterable of TestCase and TestSuite
-    # instances to this test suite."
-    #
-    # What happens if it doesn't get an iterable?
-    def test_addTest__noniterable(self):
-        suite = unittest.TestSuite()
-
-        try:
-            suite.addTests(5)
-        except TypeError:
-            pass
-        else:
-            self.fail("Failed to raise TypeError")
-
-    def test_addTest__noncallable(self):
-        suite = unittest.TestSuite()
-        self.assertRaises(TypeError, suite.addTest, 5)
-
-    def test_addTest__casesuiteclass(self):
-        suite = unittest.TestSuite()
-        self.assertRaises(TypeError, suite.addTest, Test_TestSuite)
-        self.assertRaises(TypeError, suite.addTest, unittest.TestSuite)
-
-    def test_addTests__string(self):
-        suite = unittest.TestSuite()
-        self.assertRaises(TypeError, suite.addTests, "foo")
-
-
-class Test_FunctionTestCase(TestCase):
-
-    # "Return the number of tests represented by the this test object. For
-    # TestCase instances, this will always be 1"
-    def test_countTestCases(self):
-        test = unittest.FunctionTestCase(lambda: None)
-
-        self.assertEqual(test.countTestCases(), 1)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if setUp() raises
-    # an exception.
-    def test_run_call_order__error_in_setUp(self):
-        events = []
-        result = LoggingResult(events)
-
-        def setUp():
-            events.append('setUp')
-            raise RuntimeError('raised by setUp')
-
-        def test():
-            events.append('test')
-
-        def tearDown():
-            events.append('tearDown')
-
-        expected = ['startTest', 'setUp', 'addError', 'stopTest']
-        unittest.FunctionTestCase(test, setUp, tearDown).run(result)
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if the test raises
-    # an error (as opposed to a failure).
-    def test_run_call_order__error_in_test(self):
-        events = []
-        result = LoggingResult(events)
-
-        def setUp():
-            events.append('setUp')
-
-        def test():
-            events.append('test')
-            raise RuntimeError('raised by test')
-
-        def tearDown():
-            events.append('tearDown')
-
-        expected = ['startTest', 'setUp', 'test', 'addError', 'tearDown',
-                    'stopTest']
-        unittest.FunctionTestCase(test, setUp, tearDown).run(result)
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if the test signals
-    # a failure (as opposed to an error).
-    def test_run_call_order__failure_in_test(self):
-        events = []
-        result = LoggingResult(events)
-
-        def setUp():
-            events.append('setUp')
-
-        def test():
-            events.append('test')
-            self.fail('raised by test')
-
-        def tearDown():
-            events.append('tearDown')
-
-        expected = ['startTest', 'setUp', 'test', 'addFailure', 'tearDown',
-                    'stopTest']
-        unittest.FunctionTestCase(test, setUp, tearDown).run(result)
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if tearDown() raises
-    # an exception.
-    def test_run_call_order__error_in_tearDown(self):
-        events = []
-        result = LoggingResult(events)
-
-        def setUp():
-            events.append('setUp')
-
-        def test():
-            events.append('test')
-
-        def tearDown():
-            events.append('tearDown')
-            raise RuntimeError('raised by tearDown')
-
-        expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError',
-                    'stopTest']
-        unittest.FunctionTestCase(test, setUp, tearDown).run(result)
-        self.assertEqual(events, expected)
-
-    # "Return a string identifying the specific test case."
-    #
-    # Because of the vague nature of the docs, I'm not going to lock this
-    # test down too much. Really all that can be asserted is that the id()
-    # will be a string (either 8-byte or unicode -- again, because the docs
-    # just say "string")
-    def test_id(self):
-        test = unittest.FunctionTestCase(lambda: None)
-
-        self.assertIsInstance(test.id(), str)
-
-    # "Returns a one-line description of the test, or None if no description
-    # has been provided. The default implementation of this method returns
-    # the first line of the test method's docstring, if available, or None."
-    def test_shortDescription__no_docstring(self):
-        test = unittest.FunctionTestCase(lambda: None)
-
-        self.assertEqual(test.shortDescription(), None)
-
-    # "Returns a one-line description of the test, or None if no description
-    # has been provided. The default implementation of this method returns
-    # the first line of the test method's docstring, if available, or None."
-    def test_shortDescription__singleline_docstring(self):
-        desc = "this tests foo"
-        test = unittest.FunctionTestCase(lambda: None, description=desc)
-
-        self.assertEqual(test.shortDescription(), "this tests foo")
-
-class Test_TestResult(TestCase):
-    # Note: there are not separate tests for TestResult.wasSuccessful(),
-    # TestResult.errors, TestResult.failures, TestResult.testsRun or
-    # TestResult.shouldStop because these only have meaning in terms of
-    # other TestResult methods.
-    #
-    # Accordingly, tests for the aforenamed attributes are incorporated
-    # in with the tests for the defining methods.
-    ################################################################
-
-    def test_init(self):
-        result = unittest.TestResult()
-
-        self.assertTrue(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 0)
-        self.assertEqual(result.shouldStop, False)
-
-    # "This method can be called to signal that the set of tests being
-    # run should be aborted by setting the TestResult's shouldStop
-    # attribute to True."
-    def test_stop(self):
-        result = unittest.TestResult()
-
-        result.stop()
-
-        self.assertEqual(result.shouldStop, True)
-
-    # "Called when the test case test is about to be run. The default
-    # implementation simply increments the instance's testsRun counter."
-    def test_startTest(self):
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                pass
-
-        test = Foo('test_1')
-
-        result = unittest.TestResult()
-
-        result.startTest(test)
-
-        self.assertTrue(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-        result.stopTest(test)
-
-    # "Called after the test case test has been executed, regardless of
-    # the outcome. The default implementation does nothing."
-    def test_stopTest(self):
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                pass
-
-        test = Foo('test_1')
-
-        result = unittest.TestResult()
-
-        result.startTest(test)
-
-        self.assertTrue(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-        result.stopTest(test)
-
-        # Same tests as above; make sure nothing has changed
-        self.assertTrue(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-    # "Called before and after tests are run. The default implementation does nothing."
-    def test_startTestRun_stopTestRun(self):
-        result = unittest.TestResult()
-        result.startTestRun()
-        result.stopTestRun()
-
-    # "addSuccess(test)"
-    # ...
-    # "Called when the test case test succeeds"
-    # ...
-    # "wasSuccessful() - Returns True if all tests run so far have passed,
-    # otherwise returns False"
-    # ...
-    # "testsRun - The total number of tests run so far."
-    # ...
-    # "errors - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test which raised an
-    # unexpected exception. Contains formatted
-    # tracebacks instead of sys.exc_info() results."
-    # ...
-    # "failures - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test where a failure was
-    # explicitly signalled using the TestCase.fail*() or TestCase.assert*()
-    # methods. Contains formatted tracebacks instead
-    # of sys.exc_info() results."
-    def test_addSuccess(self):
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                pass
-
-        test = Foo('test_1')
-
-        result = unittest.TestResult()
-
-        result.startTest(test)
-        result.addSuccess(test)
-        result.stopTest(test)
-
-        self.assertTrue(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-    # "addFailure(test, err)"
-    # ...
-    # "Called when the test case test signals a failure. err is a tuple of
-    # the form returned by sys.exc_info(): (type, value, traceback)"
-    # ...
-    # "wasSuccessful() - Returns True if all tests run so far have passed,
-    # otherwise returns False"
-    # ...
-    # "testsRun - The total number of tests run so far."
-    # ...
-    # "errors - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test which raised an
-    # unexpected exception. Contains formatted
-    # tracebacks instead of sys.exc_info() results."
-    # ...
-    # "failures - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test where a failure was
-    # explicitly signalled using the TestCase.fail*() or TestCase.assert*()
-    # methods. Contains formatted tracebacks instead
-    # of sys.exc_info() results."
-    def test_addFailure(self):
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                pass
-
-        test = Foo('test_1')
-        try:
-            test.fail("foo")
-        except:
-            exc_info_tuple = sys.exc_info()
-
-        result = unittest.TestResult()
-
-        result.startTest(test)
-        result.addFailure(test, exc_info_tuple)
-        result.stopTest(test)
-
-        self.assertFalse(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 0)
-        self.assertEqual(len(result.failures), 1)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-        test_case, formatted_exc = result.failures[0]
-        self.assertTrue(test_case is test)
-        self.assertIsInstance(formatted_exc, str)
-
-    # "addError(test, err)"
-    # ...
-    # "Called when the test case test raises an unexpected exception err
-    # is a tuple of the form returned by sys.exc_info():
-    # (type, value, traceback)"
-    # ...
-    # "wasSuccessful() - Returns True if all tests run so far have passed,
-    # otherwise returns False"
-    # ...
-    # "testsRun - The total number of tests run so far."
-    # ...
-    # "errors - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test which raised an
-    # unexpected exception. Contains formatted
-    # tracebacks instead of sys.exc_info() results."
-    # ...
-    # "failures - A list containing 2-tuples of TestCase instances and
-    # formatted tracebacks. Each tuple represents a test where a failure was
-    # explicitly signalled using the TestCase.fail*() or TestCase.assert*()
-    # methods. Contains formatted tracebacks instead
-    # of sys.exc_info() results."
-    def test_addError(self):
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                pass
-
-        test = Foo('test_1')
-        try:
-            raise TypeError()
-        except:
-            exc_info_tuple = sys.exc_info()
-
-        result = unittest.TestResult()
-
-        result.startTest(test)
-        result.addError(test, exc_info_tuple)
-        result.stopTest(test)
-
-        self.assertFalse(result.wasSuccessful())
-        self.assertEqual(len(result.errors), 1)
-        self.assertEqual(len(result.failures), 0)
-        self.assertEqual(result.testsRun, 1)
-        self.assertEqual(result.shouldStop, False)
-
-        test_case, formatted_exc = result.errors[0]
-        self.assertTrue(test_case is test)
-        self.assertIsInstance(formatted_exc, str)
-
-    def testGetDescriptionWithoutDocstring(self):
-        result = unittest.TextTestResult(None, True, 1)
-        self.assertEqual(
-                result.getDescription(self),
-                'testGetDescriptionWithoutDocstring (' + __name__ +
-                '.Test_TestResult)')
-
-    @unittest.skipIf(sys.flags.optimize >= 2,
-                     "Docstrings are omitted with -O2 and above")
-    def testGetDescriptionWithOneLineDocstring(self):
-        """Tests getDescription() for a method with a docstring."""
-        result = unittest.TextTestResult(None, True, 1)
-        self.assertEqual(
-                result.getDescription(self),
-               ('testGetDescriptionWithOneLineDocstring '
-                '(' + __name__ + '.Test_TestResult)\n'
-                'Tests getDescription() for a method with a docstring.'))
-
-    @unittest.skipIf(sys.flags.optimize >= 2,
-                     "Docstrings are omitted with -O2 and above")
-    def testGetDescriptionWithMultiLineDocstring(self):
-        """Tests getDescription() for a method with a longer docstring.
-        The second line of the docstring.
-        """
-        result = unittest.TextTestResult(None, True, 1)
-        self.assertEqual(
-                result.getDescription(self),
-               ('testGetDescriptionWithMultiLineDocstring '
-                '(' + __name__ + '.Test_TestResult)\n'
-                'Tests getDescription() for a method with a longer '
-                'docstring.'))
-
-    def testStackFrameTrimming(self):
-        class Frame(object):
-            class tb_frame(object):
-                f_globals = {}
-        result = unittest.TestResult()
-        self.assertFalse(result._is_relevant_tb_level(Frame))
-
-        Frame.tb_frame.f_globals['__unittest'] = True
-        self.assertTrue(result._is_relevant_tb_level(Frame))
-
-    def testFailFast(self):
-        result = unittest.TestResult()
-        result._exc_info_to_string = lambda *_: ''
-        result.failfast = True
-        result.addError(None, None)
-        self.assertTrue(result.shouldStop)
-
-        result = unittest.TestResult()
-        result._exc_info_to_string = lambda *_: ''
-        result.failfast = True
-        result.addFailure(None, None)
-        self.assertTrue(result.shouldStop)
-
-        result = unittest.TestResult()
-        result._exc_info_to_string = lambda *_: ''
-        result.failfast = True
-        result.addUnexpectedSuccess(None)
-        self.assertTrue(result.shouldStop)
-
-    def testFailFastSetByRunner(self):
-        runner = unittest.TextTestRunner(stream=io.StringIO(), failfast=True)
-        def test(result):
-            self.assertTrue(result.failfast)
-        result = runner.run(test)
-
-
-classDict = dict(unittest.TestResult.__dict__)
-for m in ('addSkip', 'addExpectedFailure', 'addUnexpectedSuccess',
-           '__init__'):
-    del classDict[m]
-
-def __init__(self, stream=None, descriptions=None, verbosity=None):
-    self.failures = []
-    self.errors = []
-    self.testsRun = 0
-    self.shouldStop = False
-classDict['__init__'] = __init__
-OldResult = type('OldResult', (object,), classDict)
-
-class Test_OldTestResult(unittest.TestCase):
-
-    def assertOldResultWarning(self, test, failures):
-        with warnings.catch_warnings(record=True) as log:
-            result = OldResult()
-            test.run(result)
-            self.assertEqual(len(result.failures), failures)
-            warning, = log
-            self.assertIs(warning.category, RuntimeWarning)
-
-    def testOldTestResult(self):
-        class Test(unittest.TestCase):
-            def testSkip(self):
-                self.skipTest('foobar')
-            @unittest.expectedFailure
-            def testExpectedFail(self):
-                raise TypeError
-            @unittest.expectedFailure
-            def testUnexpectedSuccess(self):
-                pass
-
-        for test_name, should_pass in (('testSkip', True),
-                                       ('testExpectedFail', True),
-                                       ('testUnexpectedSuccess', False)):
-            test = Test(test_name)
-            self.assertOldResultWarning(test, int(not should_pass))
-
-    def testOldTestTesultSetup(self):
-        class Test(unittest.TestCase):
-            def setUp(self):
-                self.skipTest('no reason')
-            def testFoo(self):
-                pass
-        self.assertOldResultWarning(Test('testFoo'), 0)
-
-    def testOldTestResultClass(self):
-        @unittest.skip('no reason')
-        class Test(unittest.TestCase):
-            def testFoo(self):
-                pass
-        self.assertOldResultWarning(Test('testFoo'), 0)
-
-    def testOldResultWithRunner(self):
-        class Test(unittest.TestCase):
-            def testFoo(self):
-                pass
-        runner = unittest.TextTestRunner(resultclass=OldResult,
-                                          stream=io.StringIO())
-        # This will raise an exception if TextTestRunner can't handle old
-        # test result objects
-        runner.run(Test('testFoo'))
-
-### Support code for Test_TestCase
-################################################################
-
-class Foo(unittest.TestCase):
-    def runTest(self): pass
-    def test1(self): pass
-
-class Bar(Foo):
-    def test2(self): pass
-
-def getLoggingTestCase():
-    class LoggingTestCase(unittest.TestCase):
-        """A test case which logs its calls."""
-
-        def __init__(self, events):
-            super(LoggingTestCase, self).__init__('test')
-            self.events = events
-
-        def setUp(self):
-            self.events.append('setUp')
-
-        def test(self):
-            self.events.append('test')
-
-        def tearDown(self):
-            self.events.append('tearDown')
-    return LoggingTestCase
-
-class ResultWithNoStartTestRunStopTestRun(object):
-    """An object honouring TestResult before startTestRun/stopTestRun."""
-
-    def __init__(self):
-        self.failures = []
-        self.errors = []
-        self.testsRun = 0
-        self.skipped = []
-        self.expectedFailures = []
-        self.unexpectedSuccesses = []
-        self.shouldStop = False
-
-    def startTest(self, test):
-        pass
-
-    def stopTest(self, test):
-        pass
-
-    def addError(self, test):
-        pass
-
-    def addFailure(self, test):
-        pass
-
-    def addSuccess(self, test):
-        pass
-
-    def wasSuccessful(self):
-        return True
-
-
-################################################################
-### /Support code for Test_TestCase
-
-class Test_TestCase(TestCase, TestEquality, TestHashing):
-
-    ### Set up attributes used by inherited tests
-    ################################################################
-
-    # Used by TestHashing.test_hash and TestEquality.test_eq
-    eq_pairs = [(Foo('test1'), Foo('test1'))]
-
-    # Used by TestEquality.test_ne
-    ne_pairs = [(Foo('test1'), Foo('runTest'))
-               ,(Foo('test1'), Bar('test1'))
-               ,(Foo('test1'), Bar('test2'))]
-
-    ################################################################
-    ### /Set up attributes used by inherited tests
-
-
-    # "class TestCase([methodName])"
-    # ...
-    # "Each instance of TestCase will run a single test method: the
-    # method named methodName."
-    # ...
-    # "methodName defaults to "runTest"."
-    #
-    # Make sure it really is optional, and that it defaults to the proper
-    # thing.
-    def test_init__no_test_name(self):
-        class Test(unittest.TestCase):
-            def runTest(self): raise MyException()
-            def test(self): pass
-
-        self.assertEqual(Test().id()[-13:], '.Test.runTest')
-
-    # "class TestCase([methodName])"
-    # ...
-    # "Each instance of TestCase will run a single test method: the
-    # method named methodName."
-    def test_init__test_name__valid(self):
-        class Test(unittest.TestCase):
-            def runTest(self): raise MyException()
-            def test(self): pass
-
-        self.assertEqual(Test('test').id()[-10:], '.Test.test')
-
-    # "class TestCase([methodName])"
-    # ...
-    # "Each instance of TestCase will run a single test method: the
-    # method named methodName."
-    def test_init__test_name__invalid(self):
-        class Test(unittest.TestCase):
-            def runTest(self): raise MyException()
-            def test(self): pass
-
-        try:
-            Test('testfoo')
-        except ValueError:
-            pass
-        else:
-            self.fail("Failed to raise ValueError")
-
-    # "Return the number of tests represented by the this test object. For
-    # TestCase instances, this will always be 1"
-    def test_countTestCases(self):
-        class Foo(unittest.TestCase):
-            def test(self): pass
-
-        self.assertEqual(Foo('test').countTestCases(), 1)
-
-    # "Return the default type of test result object to be used to run this
-    # test. For TestCase instances, this will always be
-    # unittest.TestResult;  subclasses of TestCase should
-    # override this as necessary."
-    def test_defaultTestResult(self):
-        class Foo(unittest.TestCase):
-            def runTest(self):
-                pass
-
-        result = Foo().defaultTestResult()
-        self.assertEqual(type(result), unittest.TestResult)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if setUp() raises
-    # an exception.
-    def test_run_call_order__error_in_setUp(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(getLoggingTestCase()):
-            def setUp(self):
-                super(Foo, self).setUp()
-                raise RuntimeError('raised by Foo.setUp')
-
-        Foo(events).run(result)
-        expected = ['startTest', 'setUp', 'addError', 'stopTest']
-        self.assertEqual(events, expected)
-
-    # "With a temporary result stopTestRun is called when setUp errors.
-    def test_run_call_order__error_in_setUp_default_result(self):
-        events = []
-
-        class Foo(getLoggingTestCase()):
-            def defaultTestResult(self):
-                return LoggingResult(self.events)
-
-            def setUp(self):
-                super(Foo, self).setUp()
-                raise RuntimeError('raised by Foo.setUp')
-
-        Foo(events).run()
-        expected = ['startTestRun', 'startTest', 'setUp', 'addError',
-                    'stopTest', 'stopTestRun']
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if the test raises
-    # an error (as opposed to a failure).
-    def test_run_call_order__error_in_test(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(getLoggingTestCase()):
-            def test(self):
-                super(Foo, self).test()
-                raise RuntimeError('raised by Foo.test')
-
-        expected = ['startTest', 'setUp', 'test', 'addError', 'tearDown',
-                    'stopTest']
-        Foo(events).run(result)
-        self.assertEqual(events, expected)
-
-    # "With a default result, an error in the test still results in stopTestRun
-    # being called."
-    def test_run_call_order__error_in_test_default_result(self):
-        events = []
-
-        class Foo(getLoggingTestCase()):
-            def defaultTestResult(self):
-                return LoggingResult(self.events)
-
-            def test(self):
-                super(Foo, self).test()
-                raise RuntimeError('raised by Foo.test')
-
-        expected = ['startTestRun', 'startTest', 'setUp', 'test', 'addError',
-                    'tearDown', 'stopTest', 'stopTestRun']
-        Foo(events).run()
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if the test signals
-    # a failure (as opposed to an error).
-    def test_run_call_order__failure_in_test(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(getLoggingTestCase()):
-            def test(self):
-                super(Foo, self).test()
-                self.fail('raised by Foo.test')
-
-        expected = ['startTest', 'setUp', 'test', 'addFailure', 'tearDown',
-                    'stopTest']
-        Foo(events).run(result)
-        self.assertEqual(events, expected)
-
-    # "When a test fails with a default result stopTestRun is still called."
-    def test_run_call_order__failure_in_test_default_result(self):
-
-        class Foo(getLoggingTestCase()):
-            def defaultTestResult(self):
-                return LoggingResult(self.events)
-            def test(self):
-                super(Foo, self).test()
-                self.fail('raised by Foo.test')
-
-        expected = ['startTestRun', 'startTest', 'setUp', 'test', 'addFailure',
-                    'tearDown', 'stopTest', 'stopTestRun']
-        events = []
-        Foo(events).run()
-        self.assertEqual(events, expected)
-
-    # "When a setUp() method is defined, the test runner will run that method
-    # prior to each test. Likewise, if a tearDown() method is defined, the
-    # test runner will invoke that method after each test. In the example,
-    # setUp() was used to create a fresh sequence for each test."
-    #
-    # Make sure the proper call order is maintained, even if tearDown() raises
-    # an exception.
-    def test_run_call_order__error_in_tearDown(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(getLoggingTestCase()):
-            def tearDown(self):
-                super(Foo, self).tearDown()
-                raise RuntimeError('raised by Foo.tearDown')
-
-        Foo(events).run(result)
-        expected = ['startTest', 'setUp', 'test', 'tearDown', 'addError',
-                    'stopTest']
-        self.assertEqual(events, expected)
-
-    # "When tearDown errors with a default result stopTestRun is still called."
-    def test_run_call_order__error_in_tearDown_default_result(self):
-
-        class Foo(getLoggingTestCase()):
-            def defaultTestResult(self):
-                return LoggingResult(self.events)
-            def tearDown(self):
-                super(Foo, self).tearDown()
-                raise RuntimeError('raised by Foo.tearDown')
-
-        events = []
-        Foo(events).run()
-        expected = ['startTestRun', 'startTest', 'setUp', 'test', 'tearDown',
-                    'addError', 'stopTest', 'stopTestRun']
-        self.assertEqual(events, expected)
-
-    # "TestCase.run() still works when the defaultTestResult is a TestResult
-    # that does not support startTestRun and stopTestRun.
-    def test_run_call_order_default_result(self):
-
-        class Foo(unittest.TestCase):
-            def defaultTestResult(self):
-                return ResultWithNoStartTestRunStopTestRun()
-            def test(self):
-                pass
-
-        Foo('test').run()
-
-    # "This class attribute gives the exception raised by the test() method.
-    # If a test framework needs to use a specialized exception, possibly to
-    # carry additional information, it must subclass this exception in
-    # order to ``play fair'' with the framework.  The initial value of this
-    # attribute is AssertionError"
-    def test_failureException__default(self):
-        class Foo(unittest.TestCase):
-            def test(self):
-                pass
-
-        self.assertTrue(Foo('test').failureException is AssertionError)
-
-    # "This class attribute gives the exception raised by the test() method.
-    # If a test framework needs to use a specialized exception, possibly to
-    # carry additional information, it must subclass this exception in
-    # order to ``play fair'' with the framework."
-    #
-    # Make sure TestCase.run() respects the designated failureException
-    def test_failureException__subclassing__explicit_raise(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(unittest.TestCase):
-            def test(self):
-                raise RuntimeError()
-
-            failureException = RuntimeError
-
-        self.assertTrue(Foo('test').failureException is RuntimeError)
-
-
-        Foo('test').run(result)
-        expected = ['startTest', 'addFailure', 'stopTest']
-        self.assertEqual(events, expected)
-
-    # "This class attribute gives the exception raised by the test() method.
-    # If a test framework needs to use a specialized exception, possibly to
-    # carry additional information, it must subclass this exception in
-    # order to ``play fair'' with the framework."
-    #
-    # Make sure TestCase.run() respects the designated failureException
-    def test_failureException__subclassing__implicit_raise(self):
-        events = []
-        result = LoggingResult(events)
-
-        class Foo(unittest.TestCase):
-            def test(self):
-                self.fail("foo")
-
-            failureException = RuntimeError
-
-        self.assertTrue(Foo('test').failureException is RuntimeError)
-
-
-        Foo('test').run(result)
-        expected = ['startTest', 'addFailure', 'stopTest']
-        self.assertEqual(events, expected)
-
-    # "The default implementation does nothing."
-    def test_setUp(self):
-        class Foo(unittest.TestCase):
-            def runTest(self):
-                pass
-
-        # ... and nothing should happen
-        Foo().setUp()
-
-    # "The default implementation does nothing."
-    def test_tearDown(self):
-        class Foo(unittest.TestCase):
-            def runTest(self):
-                pass
-
-        # ... and nothing should happen
-        Foo().tearDown()
-
-    # "Return a string identifying the specific test case."
-    #
-    # Because of the vague nature of the docs, I'm not going to lock this
-    # test down too much. Really all that can be asserted is that the id()
-    # will be a string (either 8-byte or unicode -- again, because the docs
-    # just say "string")
-    def test_id(self):
-        class Foo(unittest.TestCase):
-            def runTest(self):
-                pass
-
-        self.assertIsInstance(Foo().id(), str)
-
-
-    # "If result is omitted or None, a temporary result object is created
-    # and used, but is not made available to the caller. As TestCase owns the
-    # temporary result startTestRun and stopTestRun are called.
-
-    def test_run__uses_defaultTestResult(self):
-        events = []
-
-        class Foo(unittest.TestCase):
-            def test(self):
-                events.append('test')
-
-            def defaultTestResult(self):
-                return LoggingResult(events)
-
-        # Make run() find a result object on its own
-        Foo('test').run()
-
-        expected = ['startTestRun', 'startTest', 'test', 'addSuccess',
-            'stopTest', 'stopTestRun']
-        self.assertEqual(events, expected)
-
-    def testShortDescriptionWithoutDocstring(self):
-        self.assertIsNone(self.shortDescription())
-
-    @unittest.skipIf(sys.flags.optimize >= 2,
-                     "Docstrings are omitted with -O2 and above")
-    def testShortDescriptionWithOneLineDocstring(self):
-        """Tests shortDescription() for a method with a docstring."""
-        self.assertEqual(
-                self.shortDescription(),
-                'Tests shortDescription() for a method with a docstring.')
-
-    @unittest.skipIf(sys.flags.optimize >= 2,
-                     "Docstrings are omitted with -O2 and above")
-    def testShortDescriptionWithMultiLineDocstring(self):
-        """Tests shortDescription() for a method with a longer docstring.
-
-        This method ensures that only the first line of a docstring is
-        returned used in the short description, no matter how long the
-        whole thing is.
-        """
-        self.assertEqual(
-                self.shortDescription(),
-                 'Tests shortDescription() for a method with a longer '
-                 'docstring.')
-
-    def testAddTypeEqualityFunc(self):
-        class SadSnake(object):
-            """Dummy class for test_addTypeEqualityFunc."""
-        s1, s2 = SadSnake(), SadSnake()
-        self.assertFalse(s1 == s2)
-        def AllSnakesCreatedEqual(a, b, msg=None):
-            return type(a) == type(b) == SadSnake
-        self.addTypeEqualityFunc(SadSnake, AllSnakesCreatedEqual)
-        self.assertEqual(s1, s2)
-        # No this doesn't clean up and remove the SadSnake equality func
-        # from this TestCase instance but since its a local nothing else
-        # will ever notice that.
-
-    def testAssertIs(self):
-        thing = object()
-        self.assertIs(thing, thing)
-        self.assertRaises(self.failureException, self.assertIs, thing, object())
-
-    def testAssertIsNot(self):
-        thing = object()
-        self.assertIsNot(thing, object())
-        self.assertRaises(self.failureException, self.assertIsNot, thing, thing)
-
-    def testAssertIsInstance(self):
-        thing = []
-        self.assertIsInstance(thing, list)
-        self.assertRaises(self.failureException, self.assertIsInstance,
-                          thing, dict)
-
-    def testAssertNotIsInstance(self):
-        thing = []
-        self.assertNotIsInstance(thing, dict)
-        self.assertRaises(self.failureException, self.assertNotIsInstance,
-                          thing, list)
-
-    def testAssertIn(self):
-        animals = {'monkey': 'banana', 'cow': 'grass', 'seal': 'fish'}
-
-        self.assertIn('a', 'abc')
-        self.assertIn(2, [1, 2, 3])
-        self.assertIn('monkey', animals)
-
-        self.assertNotIn('d', 'abc')
-        self.assertNotIn(0, [1, 2, 3])
-        self.assertNotIn('otter', animals)
-
-        self.assertRaises(self.failureException, self.assertIn, 'x', 'abc')
-        self.assertRaises(self.failureException, self.assertIn, 4, [1, 2, 3])
-        self.assertRaises(self.failureException, self.assertIn, 'elephant',
-                          animals)
-
-        self.assertRaises(self.failureException, self.assertNotIn, 'c', 'abc')
-        self.assertRaises(self.failureException, self.assertNotIn, 1, [1, 2, 3])
-        self.assertRaises(self.failureException, self.assertNotIn, 'cow',
-                          animals)
-
-    def testAssertDictContainsSubset(self):
-        self.assertDictContainsSubset({}, {})
-        self.assertDictContainsSubset({}, {'a': 1})
-        self.assertDictContainsSubset({'a': 1}, {'a': 1})
-        self.assertDictContainsSubset({'a': 1}, {'a': 1, 'b': 2})
-        self.assertDictContainsSubset({'a': 1, 'b': 2}, {'a': 1, 'b': 2})
-
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({1: "one"}, {})
-
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 2}, {'a': 1})
-
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'c': 1}, {'a': 1})
-
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
-
-        with self.assertRaises(self.failureException):
-            self.assertDictContainsSubset({'a': 1, 'c': 1}, {'a': 1})
-
-        with warnings.catch_warnings(record=True):
-            # silence the UnicodeWarning
-            one = ''.join(chr(i) for i in range(255))
-            # this used to cause a UnicodeDecodeError constructing the failure msg
-            with self.assertRaises(self.failureException):
-                self.assertDictContainsSubset({'foo': one}, {'foo': '\uFFFD'})
-
-    def testAssertEqual(self):
-        equal_pairs = [
-                ((), ()),
-                ({}, {}),
-                ([], []),
-                (set(), set()),
-                (frozenset(), frozenset())]
-        for a, b in equal_pairs:
-            # This mess of try excepts is to test the assertEqual behavior
-            # itself.
-            try:
-                self.assertEqual(a, b)
-            except self.failureException:
-                self.fail('assertEqual(%r, %r) failed' % (a, b))
-            try:
-                self.assertEqual(a, b, msg='foo')
-            except self.failureException:
-                self.fail('assertEqual(%r, %r) with msg= failed' % (a, b))
-            try:
-                self.assertEqual(a, b, 'foo')
-            except self.failureException:
-                self.fail('assertEqual(%r, %r) with third parameter failed' %
-                          (a, b))
-
-        unequal_pairs = [
-               ((), []),
-               ({}, set()),
-               (set([4,1]), frozenset([4,2])),
-               (frozenset([4,5]), set([2,3])),
-               (set([3,4]), set([5,4]))]
-        for a, b in unequal_pairs:
-            self.assertRaises(self.failureException, self.assertEqual, a, b)
-            self.assertRaises(self.failureException, self.assertEqual, a, b,
-                              'foo')
-            self.assertRaises(self.failureException, self.assertEqual, a, b,
-                              msg='foo')
-
-    def testEquality(self):
-        self.assertListEqual([], [])
-        self.assertTupleEqual((), ())
-        self.assertSequenceEqual([], ())
-
-        a = [0, 'a', []]
-        b = []
-        self.assertRaises(unittest.TestCase.failureException,
-                          self.assertListEqual, a, b)
-        self.assertRaises(unittest.TestCase.failureException,
-                          self.assertListEqual, tuple(a), tuple(b))
-        self.assertRaises(unittest.TestCase.failureException,
-                          self.assertSequenceEqual, a, tuple(b))
-
-        b.extend(a)
-        self.assertListEqual(a, b)
-        self.assertTupleEqual(tuple(a), tuple(b))
-        self.assertSequenceEqual(a, tuple(b))
-        self.assertSequenceEqual(tuple(a), b)
-
-        self.assertRaises(self.failureException, self.assertListEqual,
-                          a, tuple(b))
-        self.assertRaises(self.failureException, self.assertTupleEqual,
-                          tuple(a), b)
-        self.assertRaises(self.failureException, self.assertListEqual, None, b)
-        self.assertRaises(self.failureException, self.assertTupleEqual, None,
-                          tuple(b))
-        self.assertRaises(self.failureException, self.assertSequenceEqual,
-                          None, tuple(b))
-        self.assertRaises(self.failureException, self.assertListEqual, 1, 1)
-        self.assertRaises(self.failureException, self.assertTupleEqual, 1, 1)
-        self.assertRaises(self.failureException, self.assertSequenceEqual,
-                          1, 1)
-
-        self.assertDictEqual({}, {})
-
-        c = { 'x': 1 }
-        d = {}
-        self.assertRaises(unittest.TestCase.failureException,
-                          self.assertDictEqual, c, d)
-
-        d.update(c)
-        self.assertDictEqual(c, d)
-
-        d['x'] = 0
-        self.assertRaises(unittest.TestCase.failureException,
-                          self.assertDictEqual, c, d, 'These are unequal')
-
-        self.assertRaises(self.failureException, self.assertDictEqual, None, d)
-        self.assertRaises(self.failureException, self.assertDictEqual, [], d)
-        self.assertRaises(self.failureException, self.assertDictEqual, 1, 1)
-
-    def testAssertItemsEqual(self):
-        a = object()
-        self.assertItemsEqual([1, 2, 3], [3, 2, 1])
-        self.assertItemsEqual(['foo', 'bar', 'baz'], ['bar', 'baz', 'foo'])
-        self.assertItemsEqual([a, a, 2, 2, 3], (a, 2, 3, a, 2))
-        self.assertItemsEqual([1, "2", "a", "a"], ["a", "2", True, "a"])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [1, 2] + [3] * 100, [1] * 100 + [2, 3])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [1, "2", "a", "a"], ["a", "2", True, 1])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [10], [10, 11])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [10, 11], [10])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [10, 11, 10], [10, 11])
-
-        # Test that sequences of unhashable objects can be tested for sameness:
-        self.assertItemsEqual([[1, 2], [3, 4], 0], [False, [3, 4], [1, 2]])
-
-        # hashable types, but not orderable
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [], [divmod, 'x', 1, 5j, 2j, frozenset()])
-        # comparing dicts raises a py3k warning
-        self.assertItemsEqual([{'a': 1}, {'b': 2}], [{'b': 2}, {'a': 1}])
-        # comparing heterogenous non-hashable sequences raises a py3k warning
-        self.assertItemsEqual([1, 'x', divmod, []], [divmod, [], 'x', 1])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [], [divmod, [], 'x', 1, 5j, 2j, set()])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [[1]], [[2]])
-
-        # Same elements, but not same sequence length
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [1, 1, 2], [2, 1])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [1, 1, "2", "a", "a"], ["2", "2", True, "a"])
-        self.assertRaises(self.failureException, self.assertItemsEqual,
-                          [1, {'b': 2}, None, True], [{'b': 2}, True, None])
-
-    def testAssertSetEqual(self):
-        set1 = set()
-        set2 = set()
-        self.assertSetEqual(set1, set2)
-
-        self.assertRaises(self.failureException, self.assertSetEqual, None, set2)
-        self.assertRaises(self.failureException, self.assertSetEqual, [], set2)
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, None)
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, [])
-
-        set1 = set(['a'])
-        set2 = set()
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, set2)
-
-        set1 = set(['a'])
-        set2 = set(['a'])
-        self.assertSetEqual(set1, set2)
-
-        set1 = set(['a'])
-        set2 = set(['a', 'b'])
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, set2)
-
-        set1 = set(['a'])
-        set2 = frozenset(['a', 'b'])
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, set2)
-
-        set1 = set(['a', 'b'])
-        set2 = frozenset(['a', 'b'])
-        self.assertSetEqual(set1, set2)
-
-        set1 = set()
-        set2 = "foo"
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, set2)
-        self.assertRaises(self.failureException, self.assertSetEqual, set2, set1)
-
-        # make sure any string formatting is tuple-safe
-        set1 = set([(0, 1), (2, 3)])
-        set2 = set([(4, 5)])
-        self.assertRaises(self.failureException, self.assertSetEqual, set1, set2)
-
-    def testInequality(self):
-        # Try ints
-        self.assertGreater(2, 1)
-        self.assertGreaterEqual(2, 1)
-        self.assertGreaterEqual(1, 1)
-        self.assertLess(1, 2)
-        self.assertLessEqual(1, 2)
-        self.assertLessEqual(1, 1)
-        self.assertRaises(self.failureException, self.assertGreater, 1, 2)
-        self.assertRaises(self.failureException, self.assertGreater, 1, 1)
-        self.assertRaises(self.failureException, self.assertGreaterEqual, 1, 2)
-        self.assertRaises(self.failureException, self.assertLess, 2, 1)
-        self.assertRaises(self.failureException, self.assertLess, 1, 1)
-        self.assertRaises(self.failureException, self.assertLessEqual, 2, 1)
-
-        # Try Floats
-        self.assertGreater(1.1, 1.0)
-        self.assertGreaterEqual(1.1, 1.0)
-        self.assertGreaterEqual(1.0, 1.0)
-        self.assertLess(1.0, 1.1)
-        self.assertLessEqual(1.0, 1.1)
-        self.assertLessEqual(1.0, 1.0)
-        self.assertRaises(self.failureException, self.assertGreater, 1.0, 1.1)
-        self.assertRaises(self.failureException, self.assertGreater, 1.0, 1.0)
-        self.assertRaises(self.failureException, self.assertGreaterEqual, 1.0, 1.1)
-        self.assertRaises(self.failureException, self.assertLess, 1.1, 1.0)
-        self.assertRaises(self.failureException, self.assertLess, 1.0, 1.0)
-        self.assertRaises(self.failureException, self.assertLessEqual, 1.1, 1.0)
-
-        # Try Strings
-        self.assertGreater('bug', 'ant')
-        self.assertGreaterEqual('bug', 'ant')
-        self.assertGreaterEqual('ant', 'ant')
-        self.assertLess('ant', 'bug')
-        self.assertLessEqual('ant', 'bug')
-        self.assertLessEqual('ant', 'ant')
-        self.assertRaises(self.failureException, self.assertGreater, 'ant', 'bug')
-        self.assertRaises(self.failureException, self.assertGreater, 'ant', 'ant')
-        self.assertRaises(self.failureException, self.assertGreaterEqual, 'ant', 'bug')
-        self.assertRaises(self.failureException, self.assertLess, 'bug', 'ant')
-        self.assertRaises(self.failureException, self.assertLess, 'ant', 'ant')
-        self.assertRaises(self.failureException, self.assertLessEqual, 'bug', 'ant')
-
-        # Try bytes
-        self.assertGreater(b'bug', b'ant')
-        self.assertGreaterEqual(b'bug', b'ant')
-        self.assertGreaterEqual(b'ant', b'ant')
-        self.assertLess(b'ant', b'bug')
-        self.assertLessEqual(b'ant', b'bug')
-        self.assertLessEqual(b'ant', b'ant')
-        self.assertRaises(self.failureException, self.assertGreater, b'ant', b'bug')
-        self.assertRaises(self.failureException, self.assertGreater, b'ant', b'ant')
-        self.assertRaises(self.failureException, self.assertGreaterEqual, b'ant',
-                          b'bug')
-        self.assertRaises(self.failureException, self.assertLess, b'bug', b'ant')
-        self.assertRaises(self.failureException, self.assertLess, b'ant', b'ant')
-        self.assertRaises(self.failureException, self.assertLessEqual, b'bug', b'ant')
-
-    def testAssertMultiLineEqual(self):
-        sample_text = """\
-http://www.python.org/doc/2.3/lib/module-unittest.html
-test case
-    A test case is the smallest unit of testing. [...]
-"""
-        revised_sample_text = """\
-http://www.python.org/doc/2.4.1/lib/module-unittest.html
-test case
-    A test case is the smallest unit of testing. [...] You may provide your
-    own implementation that does not subclass from TestCase, of course.
-"""
-        sample_text_error = """
-- http://www.python.org/doc/2.3/lib/module-unittest.html
-?                             ^
-+ http://www.python.org/doc/2.4.1/lib/module-unittest.html
-?                             ^^^
-  test case
--     A test case is the smallest unit of testing. [...]
-+     A test case is the smallest unit of testing. [...] You may provide your
-?                                                       +++++++++++++++++++++
-+     own implementation that does not subclass from TestCase, of course.
-"""
-
-        try:
-            self.assertMultiLineEqual(sample_text, revised_sample_text)
-        except self.failureException as e:
-            # no fair testing ourself with ourself, and assertEqual is used for strings
-            # so can't use assertEqual either. Just use assertTrue.
-            self.assertTrue(sample_text_error == str(e))
-
-    def testAssertIsNone(self):
-        self.assertIsNone(None)
-        self.assertRaises(self.failureException, self.assertIsNone, False)
-        self.assertIsNotNone('DjZoPloGears on Rails')
-        self.assertRaises(self.failureException, self.assertIsNotNone, None)
-
-    def testAssertRegexpMatches(self):
-        self.assertRegexpMatches('asdfabasdf', r'ab+')
-        self.assertRaises(self.failureException, self.assertRegexpMatches,
-                          'saaas', r'aaaa')
-
-    def testAssertRaisesRegexp(self):
-        class ExceptionMock(Exception):
-            pass
-
-        def Stub():
-            raise ExceptionMock('We expect')
-
-        self.assertRaisesRegexp(ExceptionMock, re.compile('expect$'), Stub)
-        self.assertRaisesRegexp(ExceptionMock, 'expect$', Stub)
-
-    def testAssertNotRaisesRegexp(self):
-        self.assertRaisesRegexp(
-                self.failureException, '^Exception not raised by <lambda>$',
-                self.assertRaisesRegexp, Exception, re.compile('x'),
-                lambda: None)
-        self.assertRaisesRegexp(
-                self.failureException, '^Exception not raised by <lambda>$',
-                self.assertRaisesRegexp, Exception, 'x',
-                lambda: None)
-
-    def testAssertRaisesRegexpMismatch(self):
-        def Stub():
-            raise Exception('Unexpected')
-
-        self.assertRaisesRegexp(
-                self.failureException,
-                r'"\^Expected\$" does not match "Unexpected"',
-                self.assertRaisesRegexp, Exception, '^Expected$',
-                Stub)
-        self.assertRaisesRegexp(
-                self.failureException,
-                r'"\^Expected\$" does not match "Unexpected"',
-                self.assertRaisesRegexp, Exception,
-                re.compile('^Expected$'), Stub)
-
-    def testAssertRaisesExcValue(self):
-        class ExceptionMock(Exception):
-            pass
-
-        def Stub(foo):
-            raise ExceptionMock(foo)
-        v = "particular value"
-
-        ctx = self.assertRaises(ExceptionMock)
-        with ctx:
-            Stub(v)
-        e = ctx.exception
-        self.assertIsInstance(e, ExceptionMock)
-        self.assertEqual(e.args[0], v)
-
-    def testSynonymAssertMethodNames(self):
-        """Test undocumented method name synonyms.
-
-        Please do not use these methods names in your own code.
-
-        This test confirms their continued existence and functionality
-        in order to avoid breaking existing code.
-        """
-        self.assertNotEquals(3, 5)
-        self.assertEquals(3, 3)
-        self.assertAlmostEquals(2.0, 2.0)
-        self.assertNotAlmostEquals(3.0, 5.0)
-        self.assert_(True)
-
-    def testPendingDeprecationMethodNames(self):
-        """Test fail* methods pending deprecation, they will warn in 3.2.
-
-        Do not use these methods.  They will go away in 3.3.
-        """
-        old = (
-            (self.failIfEqual, (3, 5)),
-            (self.failUnlessEqual, (3, 3)),
-            (self.failUnlessAlmostEqual, (2.0, 2.0)),
-            (self.failIfAlmostEqual, (3.0, 5.0)),
-            (self.failUnless, (True,)),
-            (self.failUnlessRaises, (TypeError, lambda _: 3.14 + 'spam')),
-            (self.failIf, (False,)),
-            (self.assertSameElements, ([1, 1, 2, 3], [1, 2, 3]))
-        )
-        for meth, args in old:
-            with warnings.catch_warnings(record=True) as w:
-                meth(*args)
-            self.assertEqual(len(w), 1)
-            self.assertIs(w[0].category, DeprecationWarning)
-
-    def testDeepcopy(self):
-        # Issue: 5660
-        class TestableTest(TestCase):
-            def testNothing(self):
-                pass
-
-        test = TestableTest('testNothing')
-
-        # This shouldn't blow up
-        deepcopy(test)
-
-
-class Test_TestSkipping(TestCase):
-
-    def test_skipping(self):
-        class Foo(unittest.TestCase):
-            def test_skip_me(self):
-                self.skipTest("skip")
-        events = []
-        result = LoggingResult(events)
-        test = Foo("test_skip_me")
-        test.run(result)
-        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
-        self.assertEqual(result.skipped, [(test, "skip")])
-
-        # Try letting setUp skip the test now.
-        class Foo(unittest.TestCase):
-            def setUp(self):
-                self.skipTest("testing")
-            def test_nothing(self): pass
-        events = []
-        result = LoggingResult(events)
-        test = Foo("test_nothing")
-        test.run(result)
-        self.assertEqual(events, ['startTest', 'addSkip', 'stopTest'])
-        self.assertEqual(result.skipped, [(test, "testing")])
-        self.assertEqual(result.testsRun, 1)
-
-    def test_skipping_decorators(self):
-        op_table = ((unittest.skipUnless, False, True),
-                    (unittest.skipIf, True, False))
-        for deco, do_skip, dont_skip in op_table:
-            class Foo(unittest.TestCase):
-                @deco(do_skip, "testing")
-                def test_skip(self): pass
-
-                @deco(dont_skip, "testing")
-                def test_dont_skip(self): pass
-            test_do_skip = Foo("test_skip")
-            test_dont_skip = Foo("test_dont_skip")
-            suite = unittest.TestSuite([test_do_skip, test_dont_skip])
-            events = []
-            result = LoggingResult(events)
-            suite.run(result)
-            self.assertEqual(len(result.skipped), 1)
-            expected = ['startTest', 'addSkip', 'stopTest',
-                        'startTest', 'addSuccess', 'stopTest']
-            self.assertEqual(events, expected)
-            self.assertEqual(result.testsRun, 2)
-            self.assertEqual(result.skipped, [(test_do_skip, "testing")])
-            self.assertTrue(result.wasSuccessful())
-
-    def test_skip_class(self):
-        @unittest.skip("testing")
-        class Foo(unittest.TestCase):
-            def test_1(self):
-                record.append(1)
-        record = []
-        result = unittest.TestResult()
-        test = Foo("test_1")
-        suite = unittest.TestSuite([test])
-        suite.run(result)
-        self.assertEqual(result.skipped, [(test, "testing")])
-        self.assertEqual(record, [])
-
-    def test_expected_failure(self):
-        class Foo(unittest.TestCase):
-            @unittest.expectedFailure
-            def test_die(self):
-                self.fail("help me!")
-        events = []
-        result = LoggingResult(events)
-        test = Foo("test_die")
-        test.run(result)
-        self.assertEqual(events,
-                         ['startTest', 'addExpectedFailure', 'stopTest'])
-        self.assertEqual(result.expectedFailures[0][0], test)
-        self.assertTrue(result.wasSuccessful())
-
-    def test_unexpected_success(self):
-        class Foo(unittest.TestCase):
-            @unittest.expectedFailure
-            def test_die(self):
-                pass
-        events = []
-        result = LoggingResult(events)
-        test = Foo("test_die")
-        test.run(result)
-        self.assertEqual(events,
-                         ['startTest', 'addUnexpectedSuccess', 'stopTest'])
-        self.assertFalse(result.failures)
-        self.assertEqual(result.unexpectedSuccesses, [test])
-        self.assertTrue(result.wasSuccessful())
-
-    def test_skip_doesnt_run_setup(self):
-        class Foo(unittest.TestCase):
-            wasSetUp = False
-            wasTornDown = False
-            def setUp(self):
-                Foo.wasSetUp = True
-            def tornDown(self):
-                Foo.wasTornDown = True
-            @unittest.skip('testing')
-            def test_1(self):
-                pass
-
-        result = unittest.TestResult()
-        test = Foo("test_1")
-        suite = unittest.TestSuite([test])
-        suite.run(result)
-        self.assertEqual(result.skipped, [(test, "testing")])
-        self.assertFalse(Foo.wasSetUp)
-        self.assertFalse(Foo.wasTornDown)
-
-    def test_decorated_skip(self):
-        def decorator(func):
-            def inner(*a):
-                return func(*a)
-            return inner
-
-        class Foo(unittest.TestCase):
-            @decorator
-            @unittest.skip('testing')
-            def test_1(self):
-                pass
-
-        result = unittest.TestResult()
-        test = Foo("test_1")
-        suite = unittest.TestSuite([test])
-        suite.run(result)
-        self.assertEqual(result.skipped, [(test, "testing")])
-
-
-class Test_Assertions(TestCase):
-    def test_AlmostEqual(self):
-        self.assertAlmostEqual(1.00000001, 1.0)
-        self.assertNotAlmostEqual(1.0000001, 1.0)
-        self.assertRaises(self.failureException,
-                          self.assertAlmostEqual, 1.0000001, 1.0)
-        self.assertRaises(self.failureException,
-                          self.assertNotAlmostEqual, 1.00000001, 1.0)
-
-        self.assertAlmostEqual(1.1, 1.0, places=0)
-        self.assertRaises(self.failureException,
-                          self.assertAlmostEqual, 1.1, 1.0, places=1)
-
-        self.assertAlmostEqual(0, .1+.1j, places=0)
-        self.assertNotAlmostEqual(0, .1+.1j, places=1)
-        self.assertRaises(self.failureException,
-                          self.assertAlmostEqual, 0, .1+.1j, places=1)
-        self.assertRaises(self.failureException,
-                          self.assertNotAlmostEqual, 0, .1+.1j, places=0)
-
-        self.assertAlmostEqual(float('inf'), float('inf'))
-        self.assertRaises(self.failureException, self.assertNotAlmostEqual,
-                          float('inf'), float('inf'))
-
-
-    def test_assertRaises(self):
-        def _raise(e):
-            raise e
-        self.assertRaises(KeyError, _raise, KeyError)
-        self.assertRaises(KeyError, _raise, KeyError("key"))
-        try:
-            self.assertRaises(KeyError, lambda: None)
-        except self.failureException as e:
-            self.assertIn("KeyError not raised", str(e))
-        else:
-            self.fail("assertRaises() didn't fail")
-        try:
-            self.assertRaises(KeyError, _raise, ValueError)
-        except ValueError:
-            pass
-        else:
-            self.fail("assertRaises() didn't let exception pass through")
-        with self.assertRaises(KeyError) as cm:
-            try:
-                raise KeyError
-            except Exception as e:
-                exc = e
-                raise
-        self.assertIs(cm.exception, exc)
-
-        with self.assertRaises(KeyError):
-            raise KeyError("key")
-        try:
-            with self.assertRaises(KeyError):
-                pass
-        except self.failureException as e:
-            self.assertIn("KeyError not raised", str(e))
-        else:
-            self.fail("assertRaises() didn't fail")
-        try:
-            with self.assertRaises(KeyError):
-                raise ValueError
-        except ValueError:
-            pass
-        else:
-            self.fail("assertRaises() didn't let exception pass through")
-
-
-class TestLongMessage(TestCase):
-    """Test that the individual asserts honour longMessage.
-    This actually tests all the message behaviour for
-    asserts that use longMessage."""
-
-    def setUp(self):
-        class TestableTestFalse(TestCase):
-            longMessage = False
-            failureException = self.failureException
-
-            def testTest(self):
-                pass
-
-        class TestableTestTrue(TestCase):
-            longMessage = True
-            failureException = self.failureException
-
-            def testTest(self):
-                pass
-
-        self.testableTrue = TestableTestTrue('testTest')
-        self.testableFalse = TestableTestFalse('testTest')
-
-    def testDefault(self):
-        self.assertFalse(TestCase.longMessage)
-
-    def test_formatMsg(self):
-        self.assertEquals(self.testableFalse._formatMessage(None, "foo"), "foo")
-        self.assertEquals(self.testableFalse._formatMessage("foo", "bar"), "foo")
-
-        self.assertEquals(self.testableTrue._formatMessage(None, "foo"), "foo")
-        self.assertEquals(self.testableTrue._formatMessage("foo", "bar"), "bar : foo")
-
-        # This blows up if _formatMessage uses string concatenation
-        self.testableTrue._formatMessage(object(), 'foo')
-
-    def test_formatMessage_unicode_error(self):
-        with warnings.catch_warnings(record=True):
-            # This causes a UnicodeWarning due to its craziness
-            one = ''.join(chr(i) for i in range(255))
-            # this used to cause a UnicodeDecodeError constructing msg
-            self.testableTrue._formatMessage(one, '\uFFFD')
-
-    def assertMessages(self, methodName, args, errors):
-        def getMethod(i):
-            useTestableFalse  = i < 2
-            if useTestableFalse:
-                test = self.testableFalse
-            else:
-                test = self.testableTrue
-            return getattr(test, methodName)
-
-        for i, expected_regexp in enumerate(errors):
-            testMethod = getMethod(i)
-            kwargs = {}
-            withMsg = i % 2
-            if withMsg:
-                kwargs = {"msg": "oops"}
-
-            with self.assertRaisesRegexp(self.failureException,
-                                         expected_regexp=expected_regexp):
-                testMethod(*args, **kwargs)
-
-    def testAssertTrue(self):
-        self.assertMessages('assertTrue', (False,),
-                            ["^False is not True$", "^oops$", "^False is not True$",
-                             "^False is not True : oops$"])
-
-    def testAssertFalse(self):
-        self.assertMessages('assertFalse', (True,),
-                            ["^True is not False$", "^oops$", "^True is not False$",
-                             "^True is not False : oops$"])
-
-    def testNotEqual(self):
-        self.assertMessages('assertNotEqual', (1, 1),
-                            ["^1 == 1$", "^oops$", "^1 == 1$",
-                             "^1 == 1 : oops$"])
-
-    def testAlmostEqual(self):
-        self.assertMessages('assertAlmostEqual', (1, 2),
-                            ["^1 != 2 within 7 places$", "^oops$",
-                             "^1 != 2 within 7 places$", "^1 != 2 within 7 places : oops$"])
-
-    def testNotAlmostEqual(self):
-        self.assertMessages('assertNotAlmostEqual', (1, 1),
-                            ["^1 == 1 within 7 places$", "^oops$",
-                             "^1 == 1 within 7 places$", "^1 == 1 within 7 places : oops$"])
-
-    def test_baseAssertEqual(self):
-        self.assertMessages('_baseAssertEqual', (1, 2),
-                            ["^1 != 2$", "^oops$", "^1 != 2$", "^1 != 2 : oops$"])
-
-    def testAssertSequenceEqual(self):
-        # Error messages are multiline so not testing on full message
-        # assertTupleEqual and assertListEqual delegate to this method
-        self.assertMessages('assertSequenceEqual', ([], [None]),
-                            ["\+ \[None\]$", "^oops$", r"\+ \[None\]$",
-                             r"\+ \[None\] : oops$"])
-
-    def testAssertSetEqual(self):
-        self.assertMessages('assertSetEqual', (set(), set([None])),
-                            ["None$", "^oops$", "None$",
-                             "None : oops$"])
-
-    def testAssertIn(self):
-        self.assertMessages('assertIn', (None, []),
-                            ['^None not found in \[\]$', "^oops$",
-                             '^None not found in \[\]$',
-                             '^None not found in \[\] : oops$'])
-
-    def testAssertNotIn(self):
-        self.assertMessages('assertNotIn', (None, [None]),
-                            ['^None unexpectedly found in \[None\]$', "^oops$",
-                             '^None unexpectedly found in \[None\]$',
-                             '^None unexpectedly found in \[None\] : oops$'])
-
-    def testAssertDictEqual(self):
-        self.assertMessages('assertDictEqual', ({}, {'key': 'value'}),
-                            [r"\+ \{'key': 'value'\}$", "^oops$",
-                             "\+ \{'key': 'value'\}$",
-                             "\+ \{'key': 'value'\} : oops$"])
-
-    def testAssertDictContainsSubset(self):
-        self.assertMessages('assertDictContainsSubset', ({'key': 'value'}, {}),
-                            ["^Missing: 'key'$", "^oops$",
-                             "^Missing: 'key'$",
-                             "^Missing: 'key' : oops$"])
-
-    def testAssertItemsEqual(self):
-        self.assertMessages('assertItemsEqual', ([], [None]),
-                            [r"\[None\]$", "^oops$",
-                             r"\[None\]$",
-                             r"\[None\] : oops$"])
-
-    def testAssertMultiLineEqual(self):
-        self.assertMessages('assertMultiLineEqual', ("", "foo"),
-                            [r"\+ foo$", "^oops$",
-                             r"\+ foo$",
-                             r"\+ foo : oops$"])
-
-    def testAssertLess(self):
-        self.assertMessages('assertLess', (2, 1),
-                            ["^2 not less than 1$", "^oops$",
-                             "^2 not less than 1$", "^2 not less than 1 : oops$"])
-
-    def testAssertLessEqual(self):
-        self.assertMessages('assertLessEqual', (2, 1),
-                            ["^2 not less than or equal to 1$", "^oops$",
-                             "^2 not less than or equal to 1$",
-                             "^2 not less than or equal to 1 : oops$"])
-
-    def testAssertGreater(self):
-        self.assertMessages('assertGreater', (1, 2),
-                            ["^1 not greater than 2$", "^oops$",
-                             "^1 not greater than 2$",
-                             "^1 not greater than 2 : oops$"])
-
-    def testAssertGreaterEqual(self):
-        self.assertMessages('assertGreaterEqual', (1, 2),
-                            ["^1 not greater than or equal to 2$", "^oops$",
-                             "^1 not greater than or equal to 2$",
-                             "^1 not greater than or equal to 2 : oops$"])
-
-    def testAssertIsNone(self):
-        self.assertMessages('assertIsNone', ('not None',),
-                            ["^'not None' is not None$", "^oops$",
-                             "^'not None' is not None$",
-                             "^'not None' is not None : oops$"])
-
-    def testAssertIsNotNone(self):
-        self.assertMessages('assertIsNotNone', (None,),
-                            ["^unexpectedly None$", "^oops$",
-                             "^unexpectedly None$",
-                             "^unexpectedly None : oops$"])
-
-    def testAssertIs(self):
-        self.assertMessages('assertIs', (None, 'foo'),
-                            ["^None is not 'foo'$", "^oops$",
-                             "^None is not 'foo'$",
-                             "^None is not 'foo' : oops$"])
-
-    def testAssertIsNot(self):
-        self.assertMessages('assertIsNot', (None, None),
-                            ["^unexpectedly identical: None$", "^oops$",
-                             "^unexpectedly identical: None$",
-                             "^unexpectedly identical: None : oops$"])
-
-
-class TestCleanUp(TestCase):
-
-    def testCleanUp(self):
-        class TestableTest(TestCase):
-            def testNothing(self):
-                pass
-
-        test = TestableTest('testNothing')
-        self.assertEqual(test._cleanups, [])
-
-        cleanups = []
-
-        def cleanup1(*args, **kwargs):
-            cleanups.append((1, args, kwargs))
-
-        def cleanup2(*args, **kwargs):
-            cleanups.append((2, args, kwargs))
-
-        test.addCleanup(cleanup1, 1, 2, 3, four='hello', five='goodbye')
-        test.addCleanup(cleanup2)
-
-        self.assertEqual(test._cleanups,
-                         [(cleanup1, (1, 2, 3), dict(four='hello', five='goodbye')),
-                          (cleanup2, (), {})])
-
-        result = test.doCleanups()
-        self.assertTrue(result)
-
-        self.assertEqual(cleanups, [(2, (), {}), (1, (1, 2, 3), dict(four='hello', five='goodbye'))])
-
-    def testCleanUpWithErrors(self):
-        class TestableTest(TestCase):
-            def testNothing(self):
-                pass
-
-        class MockResult(object):
-            errors = []
-            def addError(self, test, exc_info):
-                self.errors.append((test, exc_info))
-
-        result = MockResult()
-        test = TestableTest('testNothing')
-        test._resultForDoCleanups = result
-
-        exc1 = Exception('foo')
-        exc2 = Exception('bar')
-        def cleanup1():
-            raise exc1
-
-        def cleanup2():
-            raise exc2
-
-        test.addCleanup(cleanup1)
-        test.addCleanup(cleanup2)
-
-        self.assertFalse(test.doCleanups())
-
-        (test1, (Type1, instance1, _)), (test2, (Type2, instance2, _)) = reversed(MockResult.errors)
-        self.assertEqual((test1, Type1, instance1), (test, Exception, exc1))
-        self.assertEqual((test2, Type2, instance2), (test, Exception, exc2))
-
-    def testCleanupInRun(self):
-        blowUp = False
-        ordering = []
-
-        class TestableTest(TestCase):
-            def setUp(self):
-                ordering.append('setUp')
-                if blowUp:
-                    raise Exception('foo')
-
-            def testNothing(self):
-                ordering.append('test')
-
-            def tearDown(self):
-                ordering.append('tearDown')
-
-        test = TestableTest('testNothing')
-
-        def cleanup1():
-            ordering.append('cleanup1')
-        def cleanup2():
-            ordering.append('cleanup2')
-        test.addCleanup(cleanup1)
-        test.addCleanup(cleanup2)
-
-        def success(some_test):
-            self.assertEqual(some_test, test)
-            ordering.append('success')
-
-        result = unittest.TestResult()
-        result.addSuccess = success
-
-        test.run(result)
-        self.assertEqual(ordering, ['setUp', 'test', 'tearDown',
-                                    'cleanup2', 'cleanup1', 'success'])
-
-        blowUp = True
-        ordering = []
-        test = TestableTest('testNothing')
-        test.addCleanup(cleanup1)
-        test.run(result)
-        self.assertEqual(ordering, ['setUp', 'cleanup1'])
-
-
-class Test_TestProgram(TestCase):
-
-    # Horrible white box test
-    def testNoExit(self):
-        result = object()
-        test = object()
-
-        class FakeRunner(object):
-            def run(self, test):
-                self.test = test
-                return result
-
-        runner = FakeRunner()
-
-        oldParseArgs = TestProgram.parseArgs
-        def restoreParseArgs():
-            TestProgram.parseArgs = oldParseArgs
-        TestProgram.parseArgs = lambda *args: None
-        self.addCleanup(restoreParseArgs)
-
-        def removeTest():
-            del TestProgram.test
-        TestProgram.test = test
-        self.addCleanup(removeTest)
-
-        program = TestProgram(testRunner=runner, exit=False, verbosity=2)
-
-        self.assertEqual(program.result, result)
-        self.assertEqual(runner.test, test)
-        self.assertEqual(program.verbosity, 2)
-
-    class FooBar(unittest.TestCase):
-        def testPass(self):
-            assert True
-        def testFail(self):
-            assert False
-
-    class FooBarLoader(unittest.TestLoader):
-        """Test loader that returns a suite containing FooBar."""
-        def loadTestsFromModule(self, module):
-            return self.suiteClass(
-                [self.loadTestsFromTestCase(Test_TestProgram.FooBar)])
-
-
-    def test_NonExit(self):
-        program = unittest.main(exit=False,
-                                argv=["foobar"],
-                                testRunner=unittest.TextTestRunner(stream=io.StringIO()),
-                                testLoader=self.FooBarLoader())
-        self.assertTrue(hasattr(program, 'result'))
-
-
-    def test_Exit(self):
-        self.assertRaises(
-            SystemExit,
-            unittest.main,
-            argv=["foobar"],
-            testRunner=unittest.TextTestRunner(stream=io.StringIO()),
-            exit=True,
-            testLoader=self.FooBarLoader())
-
-
-    def test_ExitAsDefault(self):
-        self.assertRaises(
-            SystemExit,
-            unittest.main,
-            argv=["foobar"],
-            testRunner=unittest.TextTestRunner(stream=io.StringIO()),
-            testLoader=self.FooBarLoader())
-
-
-class Test_TextTestRunner(TestCase):
-    """Tests for TextTestRunner."""
-
-    def test_works_with_result_without_startTestRun_stopTestRun(self):
-        class OldTextResult(ResultWithNoStartTestRunStopTestRun):
-            separator2 = ''
-            def printErrors(self):
-                pass
-
-        class Runner(unittest.TextTestRunner):
-            def __init__(self):
-                super(Runner, self).__init__(io.StringIO())
-
-            def _makeResult(self):
-                return OldTextResult()
-
-        runner = Runner()
-        runner.run(unittest.TestSuite())
-
-    def test_startTestRun_stopTestRun_called(self):
-        class LoggingTextResult(LoggingResult):
-            separator2 = ''
-            def printErrors(self):
-                pass
-
-        class LoggingRunner(unittest.TextTestRunner):
-            def __init__(self, events):
-                super(LoggingRunner, self).__init__(io.StringIO())
-                self._events = events
-
-            def _makeResult(self):
-                return LoggingTextResult(self._events)
-
-        events = []
-        runner = LoggingRunner(events)
-        runner.run(unittest.TestSuite())
-        expected = ['startTestRun', 'stopTestRun']
-        self.assertEqual(events, expected)
-
-    def test_pickle_unpickle(self):
-        # Issue #7197: a TextTestRunner should be (un)pickleable. This is
-        # required by test_multiprocessing under Windows (in verbose mode).
-        stream = io.StringIO("foo")
-        runner = unittest.TextTestRunner(stream)
-        for protocol in range(2, pickle.HIGHEST_PROTOCOL + 1):
-            s = pickle.dumps(runner, protocol)
-            obj = pickle.loads(s)
-            # StringIO objects never compare equal, a cheap test instead.
-            self.assertEqual(obj.stream.getvalue(), stream.getvalue())
-
-    def test_resultclass(self):
-        def MockResultClass(*args):
-            return args
-        STREAM = object()
-        DESCRIPTIONS = object()
-        VERBOSITY = object()
-        runner = unittest.TextTestRunner(STREAM, DESCRIPTIONS, VERBOSITY,
-                                         resultclass=MockResultClass)
-        self.assertEqual(runner.resultclass, MockResultClass)
-
-        expectedresult = (runner.stream, DESCRIPTIONS, VERBOSITY)
-        self.assertEqual(runner._makeResult(), expectedresult)
-
-
-class TestDiscovery(TestCase):
-
-    # Heavily mocked tests so I can avoid hitting the filesystem
-    def test_get_name_from_path(self):
-        loader = unittest.TestLoader()
-        loader._top_level_dir = '/foo'
-        name = loader._get_name_from_path('/foo/bar/baz.py')
-        self.assertEqual(name, 'bar.baz')
-
-        if not __debug__:
-            # asserts are off
-            return
-
-        with self.assertRaises(AssertionError):
-            loader._get_name_from_path('/bar/baz.py')
-
-    def test_find_tests(self):
-        loader = unittest.TestLoader()
-
-        original_listdir = os.listdir
-        def restore_listdir():
-            os.listdir = original_listdir
-        original_isfile = os.path.isfile
-        def restore_isfile():
-            os.path.isfile = original_isfile
-        original_isdir = os.path.isdir
-        def restore_isdir():
-            os.path.isdir = original_isdir
-
-        path_lists = [['test1.py', 'test2.py', 'not_a_test.py', 'test_dir',
-                       'test.foo', 'test-not-a-module.py', 'another_dir'],
-                      ['test3.py', 'test4.py', ]]
-        os.listdir = lambda path: path_lists.pop(0)
-        self.addCleanup(restore_listdir)
-
-        def isdir(path):
-            return path.endswith('dir')
-        os.path.isdir = isdir
-        self.addCleanup(restore_isdir)
-
-        def isfile(path):
-            # another_dir is not a package and so shouldn't be recursed into
-            return not path.endswith('dir') and not 'another_dir' in path
-        os.path.isfile = isfile
-        self.addCleanup(restore_isfile)
-
-        loader._get_module_from_name = lambda path: path + ' module'
-        loader.loadTestsFromModule = lambda module: module + ' tests'
-
-        loader._top_level_dir = '/foo'
-        suite = list(loader._find_tests('/foo', 'test*.py'))
-
-        expected = [name + ' module tests' for name in
-                    ('test1', 'test2')]
-        expected.extend([('test_dir.%s' % name) + ' module tests' for name in
-                    ('test3', 'test4')])
-        self.assertEqual(suite, expected)
-
-    def test_find_tests_with_package(self):
-        loader = unittest.TestLoader()
-
-        original_listdir = os.listdir
-        def restore_listdir():
-            os.listdir = original_listdir
-        original_isfile = os.path.isfile
-        def restore_isfile():
-            os.path.isfile = original_isfile
-        original_isdir = os.path.isdir
-        def restore_isdir():
-            os.path.isdir = original_isdir
-
-        directories = ['a_directory', 'test_directory', 'test_directory2']
-        path_lists = [directories, [], [], []]
-        os.listdir = lambda path: path_lists.pop(0)
-        self.addCleanup(restore_listdir)
-
-        os.path.isdir = lambda path: True
-        self.addCleanup(restore_isdir)
-
-        os.path.isfile = lambda path: os.path.basename(path) not in directories
-        self.addCleanup(restore_isfile)
-
-        class Module(object):
-            paths = []
-            load_tests_args = []
-
-            def __init__(self, path):
-                self.path = path
-                self.paths.append(path)
-                if os.path.basename(path) == 'test_directory':
-                    def load_tests(loader, tests, pattern):
-                        self.load_tests_args.append((loader, tests, pattern))
-                        return 'load_tests'
-                    self.load_tests = load_tests
-
-            def __eq__(self, other):
-                return self.path == other.path
-
-        loader._get_module_from_name = lambda name: Module(name)
-        def loadTestsFromModule(module, use_load_tests):
-            if use_load_tests:
-                raise self.failureException('use_load_tests should be False for packages')
-            return module.path + ' module tests'
-        loader.loadTestsFromModule = loadTestsFromModule
-
-        loader._top_level_dir = '/foo'
-        # this time no '.py' on the pattern so that it can match
-        # a test package
-        suite = list(loader._find_tests('/foo', 'test*'))
-
-        # We should have loaded tests from the test_directory package by calling load_tests
-        # and directly from the test_directory2 package
-        self.assertEqual(suite,
-                         ['load_tests', 'test_directory2' + ' module tests'])
-        self.assertEqual(Module.paths, ['test_directory', 'test_directory2'])
-
-        # load_tests should have been called once with loader, tests and pattern
-        self.assertEqual(Module.load_tests_args,
-                         [(loader, 'test_directory' + ' module tests', 'test*')])
-
-    def test_discover(self):
-        loader = unittest.TestLoader()
-
-        original_isfile = os.path.isfile
-        def restore_isfile():
-            os.path.isfile = original_isfile
-
-        os.path.isfile = lambda path: False
-        self.addCleanup(restore_isfile)
-
-        orig_sys_path = sys.path[:]
-        def restore_path():
-            sys.path[:] = orig_sys_path
-        self.addCleanup(restore_path)
-
-        full_path = os.path.abspath(os.path.normpath('/foo'))
-        with self.assertRaises(ImportError):
-            loader.discover('/foo/bar', top_level_dir='/foo')
-
-        self.assertEqual(loader._top_level_dir, full_path)
-        self.assertIn(full_path, sys.path)
-
-        os.path.isfile = lambda path: True
-        _find_tests_args = []
-        def _find_tests(start_dir, pattern):
-            _find_tests_args.append((start_dir, pattern))
-            return ['tests']
-        loader._find_tests = _find_tests
-        loader.suiteClass = str
-
-        suite = loader.discover('/foo/bar/baz', 'pattern', '/foo/bar')
-
-        top_level_dir = os.path.abspath(os.path.normpath('/foo/bar'))
-        start_dir = os.path.abspath(os.path.normpath('/foo/bar/baz'))
-        self.assertEqual(suite, "['tests']")
-        self.assertEqual(loader._top_level_dir, top_level_dir)
-        self.assertEqual(_find_tests_args, [(start_dir, 'pattern')])
-        self.assertIn(top_level_dir, sys.path)
-
-    def test_discover_with_modules_that_fail_to_import(self):
-        loader = unittest.TestLoader()
-
-        listdir = os.listdir
-        os.listdir = lambda _: ['test_this_does_not_exist.py']
-        isfile = os.path.isfile
-        os.path.isfile = lambda _: True
-        orig_sys_path = sys.path[:]
-        def restore():
-            os.path.isfile = isfile
-            os.listdir = listdir
-            sys.path[:] = orig_sys_path
-        self.addCleanup(restore)
-
-        suite = loader.discover('.')
-        self.assertIn(os.getcwd(), sys.path)
-        self.assertEqual(suite.countTestCases(), 1)
-        test = list(list(suite)[0])[0] # extract test from suite
-
-        with self.assertRaises(ImportError):
-            test.test_this_does_not_exist()
-
-    def test_command_line_handling_parseArgs(self):
-        # Haha - take that uninstantiable class
-        program = object.__new__(TestProgram)
-
-        args = []
-        def do_discovery(argv):
-            args.extend(argv)
-        program._do_discovery = do_discovery
-        program.parseArgs(['something', 'discover'])
-        self.assertEqual(args, [])
-
-        program.parseArgs(['something', 'discover', 'foo', 'bar'])
-        self.assertEqual(args, ['foo', 'bar'])
-
-    def test_command_line_handling_do_discovery_too_many_arguments(self):
-        class Stop(Exception):
-            pass
-        def usageExit():
-            raise Stop
-
-        program = object.__new__(TestProgram)
-        program.usageExit = usageExit
-
-        with self.assertRaises(Stop):
-            # too many args
-            program._do_discovery(['one', 'two', 'three', 'four'])
-
-
-    def test_command_line_handling_do_discovery_calls_loader(self):
-        program = object.__new__(TestProgram)
-
-        class Loader(object):
-            args = []
-            def discover(self, start_dir, pattern, top_level_dir):
-                self.args.append((start_dir, pattern, top_level_dir))
-                return 'tests'
-
-        program._do_discovery(['-v'], Loader=Loader)
-        self.assertEqual(program.verbosity, 2)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('.', 'test*.py', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['--verbose'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('.', 'test*.py', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery([], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('.', 'test*.py', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['fish'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('fish', 'test*.py', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['fish', 'eggs'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('fish', 'eggs', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['fish', 'eggs', 'ham'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('fish', 'eggs', 'ham')])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['-s', 'fish'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('fish', 'test*.py', None)])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['-t', 'fish'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('.', 'test*.py', 'fish')])
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['-p', 'fish'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('.', 'fish', None)])
-        self.assertFalse(program.failfast)
-
-        Loader.args = []
-        program = object.__new__(TestProgram)
-        program._do_discovery(['-p', 'eggs', '-s', 'fish', '-v', '-f'], Loader=Loader)
-        self.assertEqual(program.test, 'tests')
-        self.assertEqual(Loader.args, [('fish', 'eggs', None)])
-        self.assertEqual(program.verbosity, 2)
-        self.assertTrue(program.failfast)
-
-
-class TestSetups(unittest.TestCase):
-
-    def getRunner(self):
-        return unittest.TextTestRunner(resultclass=resultFactory,
-                                          stream=io.StringIO())
-    def runTests(self, *cases):
-        suite = unittest.TestSuite()
-        for case in cases:
-            tests = unittest.defaultTestLoader.loadTestsFromTestCase(case)
-            suite.addTests(tests)
-
-        runner = self.getRunner()
-
-        # creating a nested suite exposes some potential bugs
-        realSuite = unittest.TestSuite()
-        realSuite.addTest(suite)
-        # adding empty suites to the end exposes potential bugs
-        suite.addTest(unittest.TestSuite())
-        realSuite.addTest(unittest.TestSuite())
-        return runner.run(realSuite)
-
-    def test_setup_class(self):
-        class Test(unittest.TestCase):
-            setUpCalled = 0
-            @classmethod
-            def setUpClass(cls):
-                Test.setUpCalled += 1
-                unittest.TestCase.setUpClass()
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        result = self.runTests(Test)
-
-        self.assertEqual(Test.setUpCalled, 1)
-        self.assertEqual(result.testsRun, 2)
-        self.assertEqual(len(result.errors), 0)
-
-    def test_teardown_class(self):
-        class Test(unittest.TestCase):
-            tearDownCalled = 0
-            @classmethod
-            def tearDownClass(cls):
-                Test.tearDownCalled += 1
-                unittest.TestCase.tearDownClass()
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        result = self.runTests(Test)
-
-        self.assertEqual(Test.tearDownCalled, 1)
-        self.assertEqual(result.testsRun, 2)
-        self.assertEqual(len(result.errors), 0)
-
-    def test_teardown_class_two_classes(self):
-        class Test(unittest.TestCase):
-            tearDownCalled = 0
-            @classmethod
-            def tearDownClass(cls):
-                Test.tearDownCalled += 1
-                unittest.TestCase.tearDownClass()
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        class Test2(unittest.TestCase):
-            tearDownCalled = 0
-            @classmethod
-            def tearDownClass(cls):
-                Test2.tearDownCalled += 1
-                unittest.TestCase.tearDownClass()
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        result = self.runTests(Test, Test2)
-
-        self.assertEqual(Test.tearDownCalled, 1)
-        self.assertEqual(Test2.tearDownCalled, 1)
-        self.assertEqual(result.testsRun, 4)
-        self.assertEqual(len(result.errors), 0)
-
-    def test_error_in_setupclass(self):
-        class BrokenTest(unittest.TestCase):
-            @classmethod
-            def setUpClass(cls):
-                raise TypeError('foo')
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        result = self.runTests(BrokenTest)
-
-        self.assertEqual(result.testsRun, 0)
-        self.assertEqual(len(result.errors), 1)
-        error, _ = result.errors[0]
-        self.assertEqual(str(error),
-                    'classSetUp (%s.BrokenTest)' % __name__)
-
-    def test_error_in_teardown_class(self):
-        class Test(unittest.TestCase):
-            tornDown = 0
-            @classmethod
-            def tearDownClass(cls):
-                Test.tornDown += 1
-                raise TypeError('foo')
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        class Test2(unittest.TestCase):
-            tornDown = 0
-            @classmethod
-            def tearDownClass(cls):
-                Test2.tornDown += 1
-                raise TypeError('foo')
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        result = self.runTests(Test, Test2)
-        self.assertEqual(result.testsRun, 4)
-        self.assertEqual(len(result.errors), 2)
-        self.assertEqual(Test.tornDown, 1)
-        self.assertEqual(Test2.tornDown, 1)
-
-        error, _ = result.errors[0]
-        self.assertEqual(str(error),
-                    'classTearDown (%s.Test)' % __name__)
-
-    def test_class_not_torndown_when_setup_fails(self):
-        class Test(unittest.TestCase):
-            tornDown = False
-            @classmethod
-            def setUpClass(cls):
-                raise TypeError
-            @classmethod
-            def tearDownClass(cls):
-                Test.tornDown = True
-                raise TypeError('foo')
-            def test_one(self):
-                pass
-
-        self.runTests(Test)
-        self.assertFalse(Test.tornDown)
-
-    def test_class_not_setup_or_torndown_when_skipped(self):
-        class Test(unittest.TestCase):
-            classSetUp = False
-            tornDown = False
-            @classmethod
-            def setUpClass(cls):
-                Test.classSetUp = True
-            @classmethod
-            def tearDownClass(cls):
-                Test.tornDown = True
-            def test_one(self):
-                pass
-
-        Test = unittest.skip("hop")(Test)
-        self.runTests(Test)
-        self.assertFalse(Test.classSetUp)
-        self.assertFalse(Test.tornDown)
-
-    def test_setup_teardown_order_with_pathological_suite(self):
-        results = []
-
-        class Module1(object):
-            @staticmethod
-            def setUpModule():
-                results.append('Module1.setUpModule')
-            @staticmethod
-            def tearDownModule():
-                results.append('Module1.tearDownModule')
-
-        class Module2(object):
-            @staticmethod
-            def setUpModule():
-                results.append('Module2.setUpModule')
-            @staticmethod
-            def tearDownModule():
-                results.append('Module2.tearDownModule')
-
-        class Test1(unittest.TestCase):
-            @classmethod
-            def setUpClass(cls):
-                results.append('setup 1')
-            @classmethod
-            def tearDownClass(cls):
-                results.append('teardown 1')
-            def testOne(self):
-                results.append('Test1.testOne')
-            def testTwo(self):
-                results.append('Test1.testTwo')
-
-        class Test2(unittest.TestCase):
-            @classmethod
-            def setUpClass(cls):
-                results.append('setup 2')
-            @classmethod
-            def tearDownClass(cls):
-                results.append('teardown 2')
-            def testOne(self):
-                results.append('Test2.testOne')
-            def testTwo(self):
-                results.append('Test2.testTwo')
-
-        class Test3(unittest.TestCase):
-            @classmethod
-            def setUpClass(cls):
-                results.append('setup 3')
-            @classmethod
-            def tearDownClass(cls):
-                results.append('teardown 3')
-            def testOne(self):
-                results.append('Test3.testOne')
-            def testTwo(self):
-                results.append('Test3.testTwo')
-
-        Test1.__module__ = Test2.__module__ = 'Module'
-        Test3.__module__ = 'Module2'
-        sys.modules['Module'] = Module1
-        sys.modules['Module2'] = Module2
-
-        first = unittest.TestSuite((Test1('testOne'),))
-        second = unittest.TestSuite((Test1('testTwo'),))
-        third = unittest.TestSuite((Test2('testOne'),))
-        fourth = unittest.TestSuite((Test2('testTwo'),))
-        fifth = unittest.TestSuite((Test3('testOne'),))
-        sixth = unittest.TestSuite((Test3('testTwo'),))
-        suite = unittest.TestSuite((first, second, third, fourth, fifth, sixth))
-
-        runner = self.getRunner()
-        result = runner.run(suite)
-        self.assertEqual(result.testsRun, 6)
-        self.assertEqual(len(result.errors), 0)
-
-        self.assertEqual(results,
-                         ['Module1.setUpModule', 'setup 1',
-                          'Test1.testOne', 'Test1.testTwo', 'teardown 1',
-                          'setup 2', 'Test2.testOne', 'Test2.testTwo',
-                          'teardown 2', 'Module1.tearDownModule',
-                          'Module2.setUpModule', 'setup 3',
-                          'Test3.testOne', 'Test3.testTwo',
-                          'teardown 3', 'Module2.tearDownModule'])
-
-    def test_setup_module(self):
-        class Module(object):
-            moduleSetup = 0
-            @staticmethod
-            def setUpModule():
-                Module.moduleSetup += 1
-
-        class Test(unittest.TestCase):
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-        Test.__module__ = 'Module'
-        sys.modules['Module'] = Module
-
-        result = self.runTests(Test)
-        self.assertEqual(Module.moduleSetup, 1)
-        self.assertEqual(result.testsRun, 2)
-        self.assertEqual(len(result.errors), 0)
-
-    def test_error_in_setup_module(self):
-        class Module(object):
-            moduleSetup = 0
-            moduleTornDown = 0
-            @staticmethod
-            def setUpModule():
-                Module.moduleSetup += 1
-                raise TypeError('foo')
-            @staticmethod
-            def tearDownModule():
-                Module.moduleTornDown += 1
-
-        class Test(unittest.TestCase):
-            classSetUp = False
-            classTornDown = False
-            @classmethod
-            def setUpClass(cls):
-                Test.classSetUp = True
-            @classmethod
-            def tearDownClass(cls):
-                Test.classTornDown = True
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        class Test2(unittest.TestCase):
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-        Test.__module__ = 'Module'
-        Test2.__module__ = 'Module'
-        sys.modules['Module'] = Module
-
-        result = self.runTests(Test, Test2)
-        self.assertEqual(Module.moduleSetup, 1)
-        self.assertEqual(Module.moduleTornDown, 0)
-        self.assertEqual(result.testsRun, 0)
-        self.assertFalse(Test.classSetUp)
-        self.assertFalse(Test.classTornDown)
-        self.assertEqual(len(result.errors), 1)
-        error, _ = result.errors[0]
-        self.assertEqual(str(error), 'setUpModule (Module)')
-
-    def test_testcase_with_missing_module(self):
-        class Test(unittest.TestCase):
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-        Test.__module__ = 'Module'
-        sys.modules.pop('Module', None)
-
-        result = self.runTests(Test)
-        self.assertEqual(result.testsRun, 2)
-
-    def test_teardown_module(self):
-        class Module(object):
-            moduleTornDown = 0
-            @staticmethod
-            def tearDownModule():
-                Module.moduleTornDown += 1
-
-        class Test(unittest.TestCase):
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-        Test.__module__ = 'Module'
-        sys.modules['Module'] = Module
-
-        result = self.runTests(Test)
-        self.assertEqual(Module.moduleTornDown, 1)
-        self.assertEqual(result.testsRun, 2)
-        self.assertEqual(len(result.errors), 0)
-
-    def test_error_in_teardown_module(self):
-        class Module(object):
-            moduleTornDown = 0
-            @staticmethod
-            def tearDownModule():
-                Module.moduleTornDown += 1
-                raise TypeError('foo')
-
-        class Test(unittest.TestCase):
-            classSetUp = False
-            classTornDown = False
-            @classmethod
-            def setUpClass(cls):
-                Test.classSetUp = True
-            @classmethod
-            def tearDownClass(cls):
-                Test.classTornDown = True
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-
-        class Test2(unittest.TestCase):
-            def test_one(self):
-                pass
-            def test_two(self):
-                pass
-        Test.__module__ = 'Module'
-        Test2.__module__ = 'Module'
-        sys.modules['Module'] = Module
-
-        result = self.runTests(Test, Test2)
-        self.assertEqual(Module.moduleTornDown, 1)
-        self.assertEqual(result.testsRun, 4)
-        self.assertTrue(Test.classSetUp)
-        self.assertTrue(Test.classTornDown)
-        self.assertEqual(len(result.errors), 1)
-        error, _ = result.errors[0]
-        self.assertEqual(str(error), 'tearDownModule (Module)')
 
-######################################################################
-## Main
-######################################################################
 
 def test_main():
-    support.run_unittest(Test_TestCase, Test_TestLoader,
-        Test_TestSuite, Test_TestResult, Test_FunctionTestCase,
-        Test_TestSkipping, Test_Assertions, TestLongMessage,
-        Test_TestProgram, TestCleanUp, TestDiscovery, Test_TextTestRunner,
-        Test_OldTestResult, TestSetups)
+    support.run_unittest(unittest.test.suite())
+    support.reap_children()
 
 if __name__ == "__main__":
     test_main()

Modified: python/branches/py3k-jit/Lib/test/test_warnings.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_warnings.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_warnings.py	Fri Apr  2 01:59:59 2010
@@ -27,11 +27,15 @@
     except NameError:
         pass
     original_warnings = warning_tests.warnings
+    original_filters = module.filters
     try:
+        module.filters = original_filters[:]
+        module.simplefilter("once")
         warning_tests.warnings = module
         yield
     finally:
         warning_tests.warnings = original_warnings
+        module.filters = original_filters
 
 
 class BaseTest(unittest.TestCase):
@@ -194,6 +198,7 @@
     def test_message(self):
         with original_warnings.catch_warnings(record=True,
                 module=self.module) as w:
+            self.module.simplefilter("once")
             for i in range(4):
                 text = 'multi %d' %i  # Different text on each call.
                 self.module.warn(text)
@@ -206,6 +211,7 @@
         for ob in (Warning, None, 42):
             with original_warnings.catch_warnings(record=True,
                     module=self.module) as w:
+                self.module.simplefilter("once")
                 self.module.warn(ob)
                 # Don't directly compare objects since
                 # ``Warning() != Warning()``.

Modified: python/branches/py3k-jit/Lib/test/test_weakref.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_weakref.py	(original)
+++ python/branches/py3k-jit/Lib/test/test_weakref.py	Fri Apr  2 01:59:59 2010
@@ -680,6 +680,18 @@
         # No exception should be raised here
         gc.collect()
 
+    def test_classes(self):
+        # Check that classes are weakrefable.
+        class A(object):
+            pass
+        l = []
+        weakref.ref(int)
+        a = weakref.ref(A, l.append)
+        A = None
+        gc.collect()
+        self.assertEqual(a(), None)
+        self.assertEqual(l, [a])
+
 
 class SubclassableWeakrefTestCase(TestBase):
 

Modified: python/branches/py3k-jit/Lib/turtle.py
==============================================================================
--- python/branches/py3k-jit/Lib/turtle.py	(original)
+++ python/branches/py3k-jit/Lib/turtle.py	Fri Apr  2 01:59:59 2010
@@ -778,7 +778,7 @@
         # needs amendment
         if not isinstance(self.cv, ScrolledCanvas):
             return self.canvwidth, self.canvheight
-        if canvwidth is None and canvheight is None and bg is None:
+        if canvwidth is canvheight is bg is None:
             return self.cv.canvwidth, self.cv.canvheight
         if canvwidth is not None:
             self.canvwidth = canvwidth
@@ -1046,7 +1046,7 @@
         >>> mode()
         'logo'
         """
-        if mode == None:
+        if mode is None:
             return self._mode
         mode = mode.lower()
         if mode not in ["standard", "logo", "world"]:
@@ -1385,7 +1385,7 @@
         ### repeatedly pressing the up-arrow key,
         ### consequently drawing a hexagon
         """
-        if fun == None:
+        if fun is None:
             if key in self._keys:
                 self._keys.remove(key)
         elif key not in self._keys:
@@ -1418,7 +1418,7 @@
         ### or by keeping pressed the up-arrow key.
         ### consequently drawing a hexagon.
         """
-        if fun == None:
+        if fun is None:
             if key in self._keys:
                 self._keys.remove(key)
         elif key is not None and key not in self._keys:
@@ -1540,7 +1540,7 @@
     def _setmode(self, mode=None):
         """Set turtle-mode to 'standard', 'world' or 'logo'.
         """
-        if mode == None:
+        if mode is None:
             return self._mode
         if mode not in ["standard", "logo", "world"]:
             return
@@ -2795,7 +2795,7 @@
         >>> turtle.shapesize(5, 5, 12)
         >>> turtle.shapesize(outline=8)
         """
-        if stretch_wid is stretch_len is outline == None:
+        if stretch_wid is stretch_len is outline is None:
             stretch_wid, stretch_len = self._stretchfactor
             return stretch_wid, stretch_len, self._outlinewidth
         if stretch_wid == 0 or stretch_len == 0:

Modified: python/branches/py3k-jit/Lib/unittest/__init__.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/__init__.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/__init__.py	Fri Apr  2 01:59:59 2010
@@ -47,7 +47,8 @@
 __all__ = ['TestResult', 'TestCase', 'TestSuite',
            'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main',
            'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless',
-           'expectedFailure', 'TextTestResult']
+           'expectedFailure', 'TextTestResult', 'installHandler',
+           'registerResult', 'removeResult']
 
 # Expose obsolete functions for backwards compatibility
 __all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
@@ -62,6 +63,7 @@
                      findTestCases)
 from .main import TestProgram, main
 from .runner import TextTestRunner, TextTestResult
+from .signals import installHandler, registerResult, removeResult
 
 # deprecated
 _TextTestResult = TextTestResult

Modified: python/branches/py3k-jit/Lib/unittest/main.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/main.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/main.py	Fri Apr  2 01:59:59 2010
@@ -5,10 +5,14 @@
 import types
 
 from . import loader, runner
+from .signals import installHandler
 
 __unittest = True
 
 
+FAILFAST = "  -f, --failfast   Stop on first failure\n"
+CATCHBREAK = "  -c, --catch      Catch control-C and display results\n"
+
 USAGE_AS_MAIN = """\
 Usage: %(progName)s [options] [tests]
 
@@ -16,8 +20,7 @@
   -h, --help       Show this message
   -v, --verbose    Verbose output
   -q, --quiet      Minimal output
-  -f, --failfast   Stop on first failure
-
+%(failfast)s%(catchbreak)s
 Examples:
   %(progName)s test_module                       - run tests from test_module
   %(progName)s test_module.TestClass             - run tests from
@@ -31,8 +34,7 @@
 
 Options:
   -v, --verbose    Verbose output
-  -f, --failfast   Stop on first failure
-  -s directory     Directory to start discovery ('.' default)
+%(failfast)s%(catchbreak)s  -s directory     Directory to start discovery ('.' default)
   -p pattern       Pattern to match test files ('test*.py' default)
   -t directory     Top level directory of project (default to
                    start directory)
@@ -48,8 +50,7 @@
   -h, --help       Show this message
   -v, --verbose    Verbose output
   -q, --quiet      Minimal output
-  -f, --failfast   Stop on first failure
-
+%(failfast)s%(catchbreak)s
 Examples:
   %(progName)s                               - run default set of tests
   %(progName)s MyTestSuite                   - run suite 'MyTestSuite'
@@ -58,15 +59,21 @@
                                                in MyTestCase
 """
 
+
+
 class TestProgram(object):
     """A command-line program that runs a set of tests; this is primarily
        for making test modules conveniently executable.
     """
     USAGE = USAGE_FROM_MODULE
+
+    # defaults for testing
+    failfast = catchbreak = None
+
     def __init__(self, module='__main__', defaultTest=None,
                  argv=None, testRunner=None,
                  testLoader=loader.defaultTestLoader, exit=True,
-                 verbosity=1, failfast=False):
+                 verbosity=1, failfast=None, catchbreak=None):
         if isinstance(module, str):
             self.module = __import__(module)
             for part in module.split('.')[1:]:
@@ -78,6 +85,7 @@
 
         self.exit = exit
         self.failfast = failfast
+        self.catchbreak = catchbreak
         self.verbosity = verbosity
         self.defaultTest = defaultTest
         self.testRunner = testRunner
@@ -89,7 +97,12 @@
     def usageExit(self, msg=None):
         if msg:
             print(msg)
-        print(self.USAGE % self.__dict__)
+        usage = {'progName': self.progName, 'catchbreak': '', 'failfast': ''}
+        if self.failfast != False:
+            usage['failfast'] = FAILFAST
+        if self.catchbreak != False:
+            usage['catchbreak'] = CATCHBREAK
+        print(self.USAGE % usage)
         sys.exit(2)
 
     def parseArgs(self, argv):
@@ -98,9 +111,9 @@
             return
 
         import getopt
-        long_opts = ['help', 'verbose', 'quiet', 'failfast']
+        long_opts = ['help', 'verbose', 'quiet', 'failfast', 'catch']
         try:
-            options, args = getopt.getopt(argv[1:], 'hHvqf', long_opts)
+            options, args = getopt.getopt(argv[1:], 'hHvqfc', long_opts)
             for opt, value in options:
                 if opt in ('-h','-H','--help'):
                     self.usageExit()
@@ -109,7 +122,13 @@
                 if opt in ('-v','--verbose'):
                     self.verbosity = 2
                 if opt in ('-f','--failfast'):
-                    self.failfast = True
+                    if self.failfast is None:
+                        self.failfast = True
+                    # Should this raise an exception if -f is not valid?
+                if opt in ('-c','--catch'):
+                    if self.catchbreak is None:
+                        self.catchbreak = True
+                    # Should this raise an exception if -c is not valid?
             if len(args) == 0 and self.defaultTest is None:
                 # createTests will load tests from self.module
                 self.testNames = None
@@ -137,8 +156,14 @@
         parser = optparse.OptionParser()
         parser.add_option('-v', '--verbose', dest='verbose', default=False,
                           help='Verbose output', action='store_true')
-        parser.add_option('-f', '--failfast', dest='failfast', default=False,
-                          help='Stop on first fail or error', action='store_true')
+        if self.failfast != False:
+            parser.add_option('-f', '--failfast', dest='failfast', default=False,
+                              help='Stop on first fail or error',
+                              action='store_true')
+        if self.catchbreak != False:
+            parser.add_option('-c', '--catch', dest='catchbreak', default=False,
+                              help='Catch ctrl-C and display results so far',
+                              action='store_true')
         parser.add_option('-s', '--start-directory', dest='start', default='.',
                           help="Directory to start discovery ('.' default)")
         parser.add_option('-p', '--pattern', dest='pattern', default='test*.py',
@@ -153,7 +178,13 @@
         for name, value in zip(('start', 'pattern', 'top'), args):
             setattr(options, name, value)
 
-        self.failfast = options.failfast
+        # only set options from the parsing here
+        # if they weren't set explicitly in the constructor
+        if self.failfast is None:
+            self.failfast = options.failfast
+        if self.catchbreak is None:
+            self.catchbreak = options.catchbreak
+
         if options.verbose:
             self.verbosity = 2
 
@@ -165,6 +196,8 @@
         self.test = loader.discover(start_dir, pattern, top_level_dir)
 
     def runTests(self):
+        if self.catchbreak:
+            installHandler()
         if self.testRunner is None:
             self.testRunner = runner.TextTestRunner
         if isinstance(self.testRunner, type):

Modified: python/branches/py3k-jit/Lib/unittest/runner.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/runner.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/runner.py	Fri Apr  2 01:59:59 2010
@@ -4,6 +4,7 @@
 import time
 
 from . import result
+from .signals import registerResult
 
 __unittest = True
 
@@ -138,6 +139,7 @@
     def run(self, test):
         "Run the given test case or test suite."
         result = self._makeResult()
+        registerResult(result)
         result.failfast = self.failfast
         startTime = time.time()
         startTestRun = getattr(result, 'startTestRun', None)

Modified: python/branches/py3k-jit/Makefile.pre.in
==============================================================================
--- python/branches/py3k-jit/Makefile.pre.in	(original)
+++ python/branches/py3k-jit/Makefile.pre.in	Fri Apr  2 01:59:59 2010
@@ -882,7 +882,7 @@
 		importlib/test/import_ importlib/test/source \
 		setuptools setuptools/command setuptools/tests setuptools.egg-info \
 		multiprocessing multiprocessing/dummy \
-		unittest \
+		unittest unittest/test \
 		curses pydoc_data $(MACHDEPS)
 libinstall:	build_all $(srcdir)/Lib/$(PLATDIR)
 	@for i in $(SCRIPTDIR) $(LIBDEST); \

Modified: python/branches/py3k-jit/Misc/ACKS
==============================================================================
--- python/branches/py3k-jit/Misc/ACKS	(original)
+++ python/branches/py3k-jit/Misc/ACKS	Fri Apr  2 01:59:59 2010
@@ -29,7 +29,7 @@
 David Ascher
 Chris AtLee
 John Aycock
-Jan-Hein B"uhrman
+Jan-Hein Bührman
 Donovan Baarda
 Attila Babo
 Alfonso Baciero
@@ -168,6 +168,7 @@
 Laura Creighton
 Simon Cross
 Drew Csillag
+Joaquin Cuenca Abela
 John Cugini
 Tom Culliton
 Brian Curtin
@@ -374,6 +375,7 @@
 David Jacobs
 Kevin Jacobs
 Kjetil Jacobsen
+Bertrand Janin
 Geert Jansen
 Jack Jansen
 Bill Janssen
@@ -524,7 +526,7 @@
 Chad Miller
 Jay T. Miller
 Roman Milner
-Andrii V. Mishkovskyi 
+Andrii V. Mishkovskyi
 Dustin J. Mitchell
 Dom Mitchell
 Doug Moen
@@ -554,6 +556,7 @@
 Gustavo Niemeyer
 Oscar Nierstrasz
 Hrvoje Niksic
+Gregory Nofi
 Jesse Noller
 Bill Noon
 Stefan Norberg

Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS	(original)
+++ python/branches/py3k-jit/Misc/NEWS	Fri Apr  2 01:59:59 2010
@@ -12,6 +12,12 @@
 Core and Builtins
 -----------------
 
+- Issue #8211: Save/restore CFLAGS around AC_PROG_CC in configure.in, compiler
+  optimizations are disabled when --with-pydebug is used.
+
+- Issue #8226: sys.setfilesystemencoding() raises a LookupError if the encoding
+  is unknown
+
 - Issue #1583863: An str subclass can now override the __str__ method
 
 - Issue #8014: Setting a T_UINT or T_PYSSIZET attribute of an object with
@@ -240,6 +246,10 @@
 C-API
 -----
 
+- Issue #8276: PyEval_CallObject() is now only available in macro form.  The
+  function declaration, which was kept for backwards compatibility reasons,
+  is now removed (the macro was introduced in 1997!).
+
 - Issue #7767: New function PyLong_AsLongLongAndOverflow added,
   analogous to PyLong_AsLongAndOverflow.
 
@@ -287,6 +297,28 @@
 Library
 -------
 
+- Issue #8233: When run as a script, py_compile.py optionally takes a single
+  argument `-` which tells it to read files to compile from stdin.  Each line
+  is read on demand and the named file is compiled immediately.  (Original
+  patch by Piotr Ożarowski).
+
+- Backwards incompatible change: Unicode codepoints line tabulation (0x0B) and
+  form feed (0x0C) are now considered linebreaks, as specified in Unicode
+  Standard Annex #14.  See issue #7643.
+  http://www.unicode.org/reports/tr14/
+
+- Comparisons using one of <, <=, >, >= between a complex instance and
+  a Fractions instance now raise TypeError instead of returning
+  True/False.  This makes Fraction <=> complex comparisons consistent with
+  int <=> complex, float <=> complex, and complex <=> complex comparisons.
+
+- Issue #8139: ossaudiodev didn't initialize its types properly, therefore
+  some methods (such as oss_mixer_device.fileno()) were not available.
+  Initial patch by Bertrand Janin.
+
+- Issue #8205: Remove the "Modules" directory from sys.path when Python is
+  running from the build directory (POSIX only).
+
 - Issue #7512: shutil.copystat() could raise an OSError when the filesystem
   didn't support chflags() (for example ZFS under FreeBSD).  The error is
   now silenced.
@@ -294,7 +326,9 @@
 - Issue #7860: platform.uname now reports the correct 'machine' type
   when Python is running in WOW64 mode on 64 bit Windows.
 
-- Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
+- Issue #3890, #8222: Fix recv() and recv_into() on non-blocking SSL sockets.
+  Also, enable the SSL_MODE_AUTO_RETRY flag on SSL sockets, so that blocking
+  reads and writes are always retried by OpenSSL itself.
 
 - Issue #4282: Fix the main function of the profile module for a non-ASCII
   script, open the file in binary mode and not in text mode with the default
@@ -863,6 +897,9 @@
 Build
 -----
 
+- Issue #3326: Build Python without -fno-strict-aliasing when the gcc does not
+  give false warnings.
+
 - Issue #1628484: The Makefile doesn't ignore the CFLAGS environment
   variable anymore.  It also forwards the LDFLAGS settings to the linker
   when building a shared library.
@@ -933,8 +970,13 @@
 Tests
 -----
 
-- Issue #8180: Fix test_pep277 on OS X and add more tests for special Unicode
-  normalization cases.
+- Issue #8248: Add some tests for the bool type.  Patch by Gregory Nofi.
+
+- Issue #8263: Now regrtest.py will report a failure if it receives a
+  KeyboardInterrupt (SIGINT).
+
+- Issue #8180 and #8207: Fix test_pep277 on OS X and add more tests for special
+  Unicode normalization cases.
 
 - Issue #7783: test.support.open_urlresource invalidates the outdated files
   from the local cache.

Modified: python/branches/py3k-jit/Misc/developers.txt
==============================================================================
--- python/branches/py3k-jit/Misc/developers.txt	(original)
+++ python/branches/py3k-jit/Misc/developers.txt	Fri Apr  2 01:59:59 2010
@@ -20,6 +20,8 @@
 Permissions History
 -------------------
 
+- Brian Curtin was given commit access on March 24 by MvL.
+
 - Florent Xicluna was given commit access on February 25 2010 by
   MvL, based on Antoine Pitrou's recommendation.
 

Modified: python/branches/py3k-jit/Modules/_cursesmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_cursesmodule.c	(original)
+++ python/branches/py3k-jit/Modules/_cursesmodule.c	Fri Apr  2 01:59:59 2010
@@ -2543,7 +2543,7 @@
 
 	PyCursesSetupTermCalled;
 		
-	if (!PyArg_ParseTuple(args, "z", &capname))
+	if (!PyArg_ParseTuple(args, "s", &capname))
 		return NULL;
 
 	return PyLong_FromLong( (long) tigetflag( capname ) );
@@ -2556,7 +2556,7 @@
 
 	PyCursesSetupTermCalled;
 		
-	if (!PyArg_ParseTuple(args, "z", &capname))
+	if (!PyArg_ParseTuple(args, "s", &capname))
 		return NULL;
 
 	return PyLong_FromLong( (long) tigetnum( capname ) );
@@ -2569,7 +2569,7 @@
 
 	PyCursesSetupTermCalled;
 		
-	if (!PyArg_ParseTuple(args, "z", &capname))
+	if (!PyArg_ParseTuple(args, "s", &capname))
 		return NULL;
 
 	capname = tigetstr( capname );

Modified: python/branches/py3k-jit/Modules/_ssl.c
==============================================================================
--- python/branches/py3k-jit/Modules/_ssl.c	(original)
+++ python/branches/py3k-jit/Modules/_ssl.c	Fri Apr  2 01:59:59 2010
@@ -9,8 +9,6 @@
    directly.
 
    XXX should partial writes be enabled, SSL_MODE_ENABLE_PARTIAL_WRITE?
-
-   XXX what about SSL_MODE_AUTO_RETRY?
 */
 
 #include "Python.h"
@@ -371,6 +369,7 @@
 	self->ssl = SSL_new(self->ctx); /* New ssl struct */
 	PySSL_END_ALLOW_THREADS
 	SSL_set_fd(self->ssl, Sock->sock_fd);	/* Set the socket for SSL */
+	SSL_set_mode(self->ssl, SSL_MODE_AUTO_RETRY);
 
 	/* If the socket is in non-blocking mode or timeout mode, set the BIO
 	 * to non-blocking mode (blocking is the default)

Modified: python/branches/py3k-jit/Modules/ossaudiodev.c
==============================================================================
--- python/branches/py3k-jit/Modules/ossaudiodev.c	(original)
+++ python/branches/py3k-jit/Modules/ossaudiodev.c	Fri Apr  2 01:59:59 2010
@@ -986,11 +986,17 @@
 	NULL
 };
 
-PyObject*
+PyMODINIT_FUNC
 PyInit_ossaudiodev(void)
 {
     PyObject *m;
 
+    if (PyType_Ready(&OSSAudioType) < 0)
+        return NULL;
+
+    if (PyType_Ready(&OSSMixerType) < 0)
+        return NULL;
+
     m = PyModule_Create(&ossaudiodevmodule);
     if (m == NULL)
 	return NULL;

Modified: python/branches/py3k-jit/Modules/unicodedata.c
==============================================================================
--- python/branches/py3k-jit/Modules/unicodedata.c	(original)
+++ python/branches/py3k-jit/Modules/unicodedata.c	Fri Apr  2 01:59:59 2010
@@ -1,8 +1,8 @@
 /* ------------------------------------------------------------------------
 
-   unicodedata -- Provides access to the Unicode 5.1 data base.
+   unicodedata -- Provides access to the Unicode 5.2 data base.
 
-   Data was extracted from the Unicode 5.1 UnicodeData.txt file.
+   Data was extracted from the Unicode 5.2 UnicodeData.txt file.
 
    Written by Marc-Andre Lemburg (mal at lemburg.com).
    Modified for Python 2.0 by Fredrik Lundh (fredrik at pythonware.com)
@@ -1235,11 +1235,11 @@
 "This module provides access to the Unicode Character Database which\n\
 defines character properties for all Unicode characters. The data in\n\
 this database is based on the UnicodeData.txt file version\n\
-5.1.0 which is publically available from ftp://ftp.unicode.org/.\n\
+5.2.0 which is publically available from ftp://ftp.unicode.org/.\n\
 \n\
 The module uses the same names and symbols as defined by the\n\
-UnicodeData File Format 5.1.0 (see\n\
-http://www.unicode.org/Public/5.1.0/ucd/UCD.html).");
+UnicodeData File Format 5.2.0 (see\n\
+http://www.unicode.org/reports/tr44/tr44-4.html).");
 
 
 static struct PyModuleDef unicodedatamodule = {

Modified: python/branches/py3k-jit/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/unicodeobject.c	(original)
+++ python/branches/py3k-jit/Objects/unicodeobject.c	Fri Apr  2 01:59:59 2010
@@ -126,9 +126,9 @@
 /* Fast detection of the most frequent whitespace characters */
 const unsigned char _Py_ascii_whitespace[] = {
     0, 0, 0, 0, 0, 0, 0, 0,
-/*     case 0x0009: * HORIZONTAL TABULATION */
+/*     case 0x0009: * CHARACTER TABULATION */
 /*     case 0x000A: * LINE FEED */
-/*     case 0x000B: * VERTICAL TABULATION */
+/*     case 0x000B: * LINE TABULATION */
 /*     case 0x000C: * FORM FEED */
 /*     case 0x000D: * CARRIAGE RETURN */
     0, 1, 1, 1, 1, 1, 0, 0,
@@ -163,8 +163,10 @@
 static unsigned char ascii_linebreak[] = {
     0, 0, 0, 0, 0, 0, 0, 0,
 /*         0x000A, * LINE FEED */
+/*         0x000B, * LINE TABULATION */
+/*         0x000C, * FORM FEED */
 /*         0x000D, * CARRIAGE RETURN */
-    0, 0, 1, 0, 0, 1, 0, 0,
+    0, 0, 1, 1, 1, 1, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0,
 /*         0x001C, * FILE SEPARATOR */
 /*         0x001D, * GROUP SEPARATOR */

Modified: python/branches/py3k-jit/Objects/unicodetype_db.h
==============================================================================
--- python/branches/py3k-jit/Objects/unicodetype_db.h	(original)
+++ python/branches/py3k-jit/Objects/unicodetype_db.h	Fri Apr  2 01:59:59 2010
@@ -694,7 +694,7 @@
 };
 
 static unsigned char index2[] = {
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
     1, 1, 1, 1, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 
     6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 5, 5, 5, 5, 5, 5, 16, 16, 16, 16, 
     16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 
@@ -3395,13 +3395,16 @@
 #endif
 }
 
-/* Returns 1 for Unicode characters having the category 'Zl',
- * 'Zp' or type 'B', 0 otherwise.
+/* Returns 1 for Unicode characters having the line break
+ * property 'BK', 'CR', 'LF' or 'NL' or having bidirectional
+ * type 'B', 0 otherwise.
  */
 int _PyUnicode_IsLinebreak(register const Py_UNICODE ch)
 {
     switch (ch) {
     case 0x000A:
+    case 0x000B:
+    case 0x000C:
     case 0x000D:
     case 0x001C:
     case 0x001D:

Modified: python/branches/py3k-jit/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k-jit/Python/bltinmodule.c	(original)
+++ python/branches/py3k-jit/Python/bltinmodule.c	Fri Apr  2 01:59:59 2010
@@ -29,7 +29,7 @@
 int
 _Py_SetFileSystemEncoding(PyObject *s)
 {
-	PyObject *defenc;
+	PyObject *defenc, *codec;
 	if (!PyUnicode_Check(s)) {
 		PyErr_BadInternalCall();
 		return -1;
@@ -37,6 +37,10 @@
 	defenc = _PyUnicode_AsDefaultEncodedString(s, NULL);
 	if (!defenc)
 		return -1;
+	codec = _PyCodec_Lookup(PyBytes_AsString(defenc));
+	if (codec == NULL)
+		return -1;
+	Py_DECREF(codec);
 	if (!Py_HasFileSystemDefaultEncoding && Py_FileSystemDefaultEncoding)
 		/* A file system encoding was set at run-time */
 		free((char*)Py_FileSystemDefaultEncoding);

Modified: python/branches/py3k-jit/Python/ceval.c
==============================================================================
--- python/branches/py3k-jit/Python/ceval.c	(original)
+++ python/branches/py3k-jit/Python/ceval.c	Fri Apr  2 01:59:59 2010
@@ -3695,18 +3695,7 @@
 
 
 /* External interface to call any callable object.
-   The arg must be a tuple or NULL. */
-
-#undef PyEval_CallObject
-/* for backward compatibility: export this interface */
-
-PyObject *
-PyEval_CallObject(PyObject *func, PyObject *arg)
-{
-	return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL);
-}
-#define PyEval_CallObject(func,arg) \
-        PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
+   The arg must be a tuple or NULL.  The kw must be a dict or NULL. */
 
 PyObject *
 PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)

Modified: python/branches/py3k-jit/Python/import.c
==============================================================================
--- python/branches/py3k-jit/Python/import.c	(original)
+++ python/branches/py3k-jit/Python/import.c	Fri Apr  2 01:59:59 2010
@@ -661,7 +661,7 @@
 
 /* Remove name from sys.modules, if it's there. */
 static void
-_RemoveModule(const char *name)
+remove_module(const char *name)
 {
 	PyObject *modules = PyImport_GetModuleDict();
 	if (PyDict_GetItemString(modules, name) == NULL)
@@ -735,7 +735,7 @@
 	return m;
 
   error:
-	_RemoveModule(name);
+	remove_module(name);
 	return NULL;
 }
 

Modified: python/branches/py3k-jit/Tools/unicode/makeunicodedata.py
==============================================================================
--- python/branches/py3k-jit/Tools/unicode/makeunicodedata.py	(original)
+++ python/branches/py3k-jit/Tools/unicode/makeunicodedata.py	Fri Apr  2 01:59:59 2010
@@ -38,6 +38,7 @@
 UNIHAN = "Unihan%s.txt"
 DERIVED_CORE_PROPERTIES = "DerivedCoreProperties%s.txt"
 DERIVEDNORMALIZATION_PROPS = "DerivedNormalizationProps%s.txt"
+LINE_BREAK = "LineBreak%s.txt"
 
 old_versions = ["3.2.0"]
 
@@ -52,6 +53,8 @@
 
 EASTASIANWIDTH_NAMES = [ "F", "H", "W", "Na", "A", "N" ]
 
+MANDATORY_LINE_BREAKS = [ "BK", "CR", "LF", "NL" ]
+
 # note: should match definitions in Objects/unicodectype.c
 ALPHA_MASK = 0x01
 DECIMAL_MASK = 0x02
@@ -77,7 +80,8 @@
                           EASTASIAN_WIDTH % version,
                           UNIHAN % version,
                           DERIVED_CORE_PROPERTIES % version,
-                          DERIVEDNORMALIZATION_PROPS % version)
+                          DERIVEDNORMALIZATION_PROPS % version,
+                          LINE_BREAK % version)
 
     print(len(list(filter(None, unicode.table))), "characters")
 
@@ -378,7 +382,7 @@
                 flags |= ALPHA_MASK
             if category == "Ll":
                 flags |= LOWER_MASK
-            if category == "Zl" or bidirectional == "B":
+            if 'Line_Break' in properties or bidirectional == "B":
                 flags |= LINEBREAK_MASK
                 linebreaks.append(char)
             if category == "Zs" or bidirectional in ("WS", "B", "S"):
@@ -537,8 +541,9 @@
     print(file=fp)
 
     # Generate code for _PyUnicode_IsLinebreak()
-    print("/* Returns 1 for Unicode characters having the category 'Zl',", file=fp)
-    print(" * 'Zp' or type 'B', 0 otherwise.", file=fp)
+    print("/* Returns 1 for Unicode characters having the line break", file=fp)
+    print(" * property 'BK', 'CR', 'LF' or 'NL' or having bidirectional", file=fp)
+    print(" * type 'B', 0 otherwise.", file=fp)
     print(" */", file=fp)
     print('int _PyUnicode_IsLinebreak(register const Py_UNICODE ch)', file=fp)
     print('{', file=fp)
@@ -826,7 +831,8 @@
     #  derived-props] (17)
 
     def __init__(self, filename, exclusions, eastasianwidth, unihan,
-                 derivedprops, derivednormalizationprops=None, expand=1):
+                 derivedprops, derivednormalizationprops=None, linebreakprops=None,
+                 expand=1):
         self.changed = []
         file = open(filename)
         table = [None] * 0x110000
@@ -912,6 +918,19 @@
                     # apply to unassigned code points; ignore them
                     table[char][-1].add(p)
 
+        if linebreakprops:
+            for s in open(linebreakprops):
+                s = s.partition('#')[0]
+                s = [i.strip() for i in s.split(';')]
+                if len(s) < 2 or s[1] not in MANDATORY_LINE_BREAKS:
+                    continue
+                if '..' not in s[0]:
+                    first = last = int(s[0], 16)
+                else:
+                    first, last = [int(c, 16) for c in s[0].split('..')]
+                for char in range(first, last+1):
+                    table[char][-1].add('Line_Break')
+
         if derivednormalizationprops:
             quickchecks = [0] * 0x110000 # default is Yes
             qc_order = 'NFD_QC NFKD_QC NFC_QC NFKC_QC'.split()

Modified: python/branches/py3k-jit/configure
==============================================================================
--- python/branches/py3k-jit/configure	(original)
+++ python/branches/py3k-jit/configure	Fri Apr  2 01:59:59 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 78998 .
+# From configure.in Revision: 79355 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for python 3.2.
 #
@@ -2302,6 +2302,7 @@
    { (exit 1); exit 1; }; }
 fi
 
+save_CFLAGS=$CFLAGS
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3221,6 +3222,7 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+CFLAGS=$save_CFLAGS
 
 
 
@@ -4521,7 +4523,7 @@
 # tweak OPT based on compiler and platform, only if the user didn't set
 # it on the command line
 
-if test "${OPT-unset}" == "unset"
+if test "${OPT-unset}" = "unset"
 then
     case $GCC in
     yes)
@@ -4567,14 +4569,16 @@
 # tweak BASECFLAGS based on compiler and platform
 case $GCC in
 yes)
-    # Python violates C99 rules, by casting between incompatible
-    # pointer types. GCC may generate bad code as a result of that,
-    # so use -fno-strict-aliasing if supported.
-    { echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5
-echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing... $ECHO_C" >&6; }
+    # Python doesn't violate C99 aliasing rules, but older versions of
+    # GCC produce warnings for legal Python code.  Enable
+    # -fno-strict-aliasing on versions of GCC that support but produce
+    # warnings.  See Issue3326
+    { echo "$as_me:$LINENO: checking whether $CC accepts and needs -fno-strict-aliasing" >&5
+echo $ECHO_N "checking whether $CC accepts and needs -fno-strict-aliasing... $ECHO_C" >&6; }
      ac_save_cc="$CC"
      CC="$CC -fno-strict-aliasing"
-     if test "${ac_cv_no_strict_aliasing_ok+set}" = set; then
+     save_CFLAGS="$CFLAGS"
+     if test "${ac_cv_no_strict_aliasing+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4609,21 +4613,64 @@
 	 test -z "$ac_c_werror_flag" ||
 	 test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_no_strict_aliasing_ok=yes
+  CC="$ac_save_cc -fstrict-aliasing"
+         CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
+         cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_no_strict_aliasing=no
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_no_strict_aliasing=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_no_strict_aliasing_ok=no
+	ac_cv_no_strict_aliasing=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
+     CFLAGS="$save_CFLAGS"
      CC="$ac_save_cc"
-    { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5
-echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6; }
-    if test $ac_cv_no_strict_aliasing_ok = yes
+    { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing" >&5
+echo "${ECHO_T}$ac_cv_no_strict_aliasing" >&6; }
+    if test $ac_cv_no_strict_aliasing = yes
     then
       BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
     fi

Modified: python/branches/py3k-jit/configure.in
==============================================================================
--- python/branches/py3k-jit/configure.in	(original)
+++ python/branches/py3k-jit/configure.in	Fri Apr  2 01:59:59 2010
@@ -441,7 +441,9 @@
 (it is also a good idea to do 'make clean' before compiling)])
 fi
 
+save_CFLAGS=$CFLAGS
 AC_PROG_CC
+CFLAGS=$save_CFLAGS
 
 AC_SUBST(CXX)
 AC_SUBST(MAINCC)
@@ -819,7 +821,7 @@
 # tweak OPT based on compiler and platform, only if the user didn't set
 # it on the command line
 AC_SUBST(OPT)
-if test "${OPT-unset}" == "unset"
+if test "${OPT-unset}" = "unset"
 then
     case $GCC in
     yes)
@@ -865,19 +867,26 @@
 # tweak BASECFLAGS based on compiler and platform
 case $GCC in
 yes)
-    # Python violates C99 rules, by casting between incompatible
-    # pointer types. GCC may generate bad code as a result of that,
-    # so use -fno-strict-aliasing if supported.
-    AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
+    # Python doesn't violate C99 aliasing rules, but older versions of
+    # GCC produce warnings for legal Python code.  Enable
+    # -fno-strict-aliasing on versions of GCC that support but produce
+    # warnings.  See Issue3326
+    AC_MSG_CHECKING(whether $CC accepts and needs -fno-strict-aliasing)
      ac_save_cc="$CC"
      CC="$CC -fno-strict-aliasing"
-     AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
-     AC_TRY_COMPILE([],[int main() { return 0; }],
-     ac_cv_no_strict_aliasing_ok=yes,
-     ac_cv_no_strict_aliasing_ok=no))
+     save_CFLAGS="$CFLAGS"
+     AC_CACHE_VAL(ac_cv_no_strict_aliasing,
+       AC_TRY_COMPILE([],[int main() { return 0; }],
+         CC="$ac_save_cc -fstrict-aliasing"
+         CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
+         AC_TRY_COMPILE([],[void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }],
+           ac_cv_no_strict_aliasing=no,
+           ac_cv_no_strict_aliasing=yes),
+         ac_cv_no_strict_aliasing=no))
+     CFLAGS="$save_CFLAGS"
      CC="$ac_save_cc"
-    AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
-    if test $ac_cv_no_strict_aliasing_ok = yes
+    AC_MSG_RESULT($ac_cv_no_strict_aliasing)
+    if test $ac_cv_no_strict_aliasing = yes
     then
       BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
     fi


More information about the Python-checkins mailing list