diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/bad_coding2.py | 2 | ||||
-rw-r--r-- | Lib/test/test_code.py | 2 | ||||
-rw-r--r-- | Lib/test/test_exception_variations.py | 360 | ||||
-rw-r--r-- | Lib/test/test_generators.py | 2 | ||||
-rw-r--r-- | Lib/test/test_minidom.py | 6 | ||||
-rw-r--r-- | Lib/test/test_poll.py | 2 | ||||
-rw-r--r-- | Lib/test/test_quopri.py | 20 | ||||
-rw-r--r-- | Lib/test/test_xmlrpc.py | 2 |
8 files changed, 198 insertions, 198 deletions
diff --git a/Lib/test/bad_coding2.py b/Lib/test/bad_coding2.py index 604b122..cc959b0 100644 --- a/Lib/test/bad_coding2.py +++ b/Lib/test/bad_coding2.py @@ -1,2 +1,2 @@ #coding: utf8
-print '我'
\ No newline at end of file +print '我'
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index ff95c6a..52bc894 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -33,7 +33,7 @@ consts: ('None',) ... b = x - y ... c = a * b ... return c -... +... >>> dump(h.func_code) name: h argcount: 2 diff --git a/Lib/test/test_exception_variations.py b/Lib/test/test_exception_variations.py index 297a6c9..754d452 100644 --- a/Lib/test/test_exception_variations.py +++ b/Lib/test/test_exception_variations.py @@ -1,180 +1,180 @@ - -from test.test_support import run_unittest -import unittest - -class ExceptionTestCase(unittest.TestCase): - def test_try_except_else_finally(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - raise Exception, 'nyaa!' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - self.assertFalse(hit_else) - - def test_try_except_else_finally_no_exception(self): - hit_except = False - hit_else = False - hit_finally = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - self.assertTrue(hit_else) - - def test_try_except_finally(self): - hit_except = False - hit_finally = False - - try: - raise Exception, 'yarr!' - except: - hit_except = True - finally: - hit_finally = True - - self.assertTrue(hit_except) - self.assertTrue(hit_finally) - - def test_try_except_finally_no_exception(self): - hit_except = False - hit_finally = False - - try: - pass - except: - hit_except = True - finally: - hit_finally = True - - self.assertFalse(hit_except) - self.assertTrue(hit_finally) - - def test_try_except(self): - hit_except = False - - try: - raise Exception, 'ahoy!' - except: - hit_except = True - - self.assertTrue(hit_except) - - def test_try_except_no_exception(self): - hit_except = False - - try: - pass - except: - hit_except = True - - self.assertFalse(hit_except) - - def test_try_except_else(self): - hit_except = False - hit_else = False - - try: - raise Exception, 'foo!' - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_else) - self.assertTrue(hit_except) - - def test_try_except_else_no_exception(self): - hit_except = False - hit_else = False - - try: - pass - except: - hit_except = True - else: - hit_else = True - - self.assertFalse(hit_except) - self.assertTrue(hit_else) - - def test_try_finally_no_exception(self): - hit_finally = False - - try: - pass - finally: - hit_finally = True - - self.assertTrue(hit_finally) - - def test_nested(self): - hit_finally = False - hit_inner_except = False - hit_inner_finally = False - - try: - try: - raise Exception, 'inner exception' - except: - hit_inner_except = True - finally: - hit_inner_finally = True - finally: - hit_finally = True - - self.assertTrue(hit_inner_except) - self.assertTrue(hit_inner_finally) - self.assertTrue(hit_finally) - - def test_nested_else(self): - hit_else = False - hit_finally = False - hit_except = False - hit_inner_except = False - hit_inner_else = False - - try: - try: - pass - except: - hit_inner_except = True - else: - hit_inner_else = True - - raise Exception, 'outer exception' - except: - hit_except = True - else: - hit_else = True - finally: - hit_finally = True - - self.assertFalse(hit_inner_except) - self.assertTrue(hit_inner_else) - self.assertFalse(hit_else) - self.assertTrue(hit_finally) - self.assertTrue(hit_except) - -def test_main(): - run_unittest(ExceptionTestCase) - -if __name__ == '__main__': - test_main() +
+from test.test_support import run_unittest
+import unittest
+
+class ExceptionTestCase(unittest.TestCase):
+ def test_try_except_else_finally(self):
+ hit_except = False
+ hit_else = False
+ hit_finally = False
+
+ try:
+ raise Exception, 'nyaa!'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_except)
+ self.assertTrue(hit_finally)
+ self.assertFalse(hit_else)
+
+ def test_try_except_else_finally_no_exception(self):
+ hit_except = False
+ hit_else = False
+ hit_finally = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_finally)
+ self.assertTrue(hit_else)
+
+ def test_try_except_finally(self):
+ hit_except = False
+ hit_finally = False
+
+ try:
+ raise Exception, 'yarr!'
+ except:
+ hit_except = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_except)
+ self.assertTrue(hit_finally)
+
+ def test_try_except_finally_no_exception(self):
+ hit_except = False
+ hit_finally = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_finally)
+
+ def test_try_except(self):
+ hit_except = False
+
+ try:
+ raise Exception, 'ahoy!'
+ except:
+ hit_except = True
+
+ self.assertTrue(hit_except)
+
+ def test_try_except_no_exception(self):
+ hit_except = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+
+ self.assertFalse(hit_except)
+
+ def test_try_except_else(self):
+ hit_except = False
+ hit_else = False
+
+ try:
+ raise Exception, 'foo!'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+
+ self.assertFalse(hit_else)
+ self.assertTrue(hit_except)
+
+ def test_try_except_else_no_exception(self):
+ hit_except = False
+ hit_else = False
+
+ try:
+ pass
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+
+ self.assertFalse(hit_except)
+ self.assertTrue(hit_else)
+
+ def test_try_finally_no_exception(self):
+ hit_finally = False
+
+ try:
+ pass
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_finally)
+
+ def test_nested(self):
+ hit_finally = False
+ hit_inner_except = False
+ hit_inner_finally = False
+
+ try:
+ try:
+ raise Exception, 'inner exception'
+ except:
+ hit_inner_except = True
+ finally:
+ hit_inner_finally = True
+ finally:
+ hit_finally = True
+
+ self.assertTrue(hit_inner_except)
+ self.assertTrue(hit_inner_finally)
+ self.assertTrue(hit_finally)
+
+ def test_nested_else(self):
+ hit_else = False
+ hit_finally = False
+ hit_except = False
+ hit_inner_except = False
+ hit_inner_else = False
+
+ try:
+ try:
+ pass
+ except:
+ hit_inner_except = True
+ else:
+ hit_inner_else = True
+
+ raise Exception, 'outer exception'
+ except:
+ hit_except = True
+ else:
+ hit_else = True
+ finally:
+ hit_finally = True
+
+ self.assertFalse(hit_inner_except)
+ self.assertTrue(hit_inner_else)
+ self.assertFalse(hit_else)
+ self.assertTrue(hit_finally)
+ self.assertTrue(hit_except)
+
+def test_main():
+ run_unittest(ExceptionTestCase)
+
+if __name__ == '__main__':
+ test_main()
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 48c9674..4be1b4c 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -774,7 +774,7 @@ These are fine: ... try: ... 1//0 ... except ZeroDivisionError: -... yield 666 +... yield 666 ... except: ... pass ... finally: diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 2510a41..b9377ae 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -1137,9 +1137,9 @@ def testPatch1094164 (): # Check that replacing a child with itself leaves the tree unchanged elem.replaceChild(e, e) confirm(e.parentNode is elem, "After replaceChild()") - - - + + + def testReplaceWholeText(): def setup(): doc = parseString("<doc>a<e/>d</doc>") diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py index f99c37f..3a48bce 100644 --- a/Lib/test/test_poll.py +++ b/Lib/test/test_poll.py @@ -185,7 +185,7 @@ def test_poll3(): if x != 5: print 'Overflow must have occurred' print 'Poll test 3 complete' - + test_poll1() test_poll2() diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py index 50098cb..ed66dfc 100644 --- a/Lib/test/test_quopri.py +++ b/Lib/test/test_quopri.py @@ -175,18 +175,18 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') self.assert_(quopri.decodestring(e, header=True) == p) def test_scriptencode(self): - (p, e) = self.STRINGS[-1] - (cin, cout) = os.popen2("%s -mquopri" % sys.executable) - cin.write(p) - cin.close() - self.assert_(cout.read() == e) + (p, e) = self.STRINGS[-1] + (cin, cout) = os.popen2("%s -mquopri" % sys.executable) + cin.write(p) + cin.close() + self.assert_(cout.read() == e) def test_scriptdecode(self): - (p, e) = self.STRINGS[-1] - (cin, cout) = os.popen2("%s -mquopri -d" % sys.executable) - cin.write(e) - cin.close() - self.assert_(cout.read() == p) + (p, e) = self.STRINGS[-1] + (cin, cout) = os.popen2("%s -mquopri -d" % sys.executable) + cin.write(e) + cin.close() + self.assert_(cout.read() == p) def test_main(): test_support.run_unittest(QuopriTestCase) diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 0ef91dc..64d8fe8 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -78,7 +78,7 @@ class XMLRPCTestCase(unittest.TestCase): def test_bug_1164912 (self): d = xmlrpclib.DateTime() - ((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,), + ((new_d,), dummy) = xmlrpclib.loads(xmlrpclib.dumps((d,), methodresponse=True)) self.assert_(isinstance(new_d.value, str)) |