Merged revisions 79539 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79539 | florent.xicluna | 2010-04-01 01:01:03 +0300 (Thu, 01 Apr 2010) | 2 lines

  Replace catch_warnings with check_warnings when it makes sense.  Use assertRaises context manager to simplify some tests.
........
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index 4d029dc..c8a4591 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -1,6 +1,5 @@
 """Unit tests for contextlib.py, and other context managers."""
 
-
 import sys
 import os
 import decimal
@@ -139,7 +138,7 @@
             with nested(a(), b()) as (x, y):
                 state.append(x)
                 state.append(y)
-                1/0
+                1 // 0
         except ZeroDivisionError:
             self.assertEqual(state, [1, 4, 2, 5, 6, 3])
         else:
@@ -160,7 +159,7 @@
                     pass
         try:
             with nested(a(), b()) as (x, y):
-                1/0
+                1 // 0
         except ZeroDivisionError:
             self.assertEqual((x, y), (1, 2))
         except Exception:
@@ -181,7 +180,7 @@
                 pass
         try:
             with nested(a(), b()):
-                1/0
+                1 // 0
         except ZeroDivisionError:
             self.fail("Didn't swallow ZeroDivisionError")
 
@@ -247,7 +246,7 @@
         try:
             with closing(x) as y:
                 self.assertEqual(x, y)
-                1/0
+                1 // 0
         except ZeroDivisionError:
             self.assertEqual(state, [1])
         else:
@@ -268,7 +267,7 @@
                 with open(tfn, "r") as f:
                     self.failIf(f.closed)
                     self.assertEqual(f.read(), "Booh\n")
-                    1/0
+                    1 // 0
             except ZeroDivisionError:
                 self.failUnless(f.closed)
             else:
@@ -289,7 +288,7 @@
         try:
             with lock:
                 self.failUnless(locked())
-                1/0
+                1 // 0
         except ZeroDivisionError:
             self.failIf(locked())
         else:
@@ -333,5 +332,6 @@
 def test_main():
     test_support.run_unittest(__name__)
 
+
 if __name__ == "__main__":
     test_main()