Ticket #5952: my-first-patch.patch
| File my-first-patch.patch, 1.9 KB (added by sreepriya, 3 months ago) |
|---|
-
test_failure.py
1 # Copyright (c) Twisted Matrix La boratories.1 # Copyright (c) Twisted Matrix La:boratories. 2 2 # See LICENSE for details. 3 3 4 4 """ … … 51 51 self.assertEqual(f.type, NotImplementedError) 52 52 53 53 54 def test_notTrapped(self): 55 """Making sure trap doesn't trap what it shouldn't.""" 54 def test_notTrapped_PY2(self): 55 """ 56 When test_notTrapped_PY2 is called on Python 2, a C{ValueError} exception is raised. The test fails for any errors other than C{OverflowErrors}. 57 """ 56 58 exception = ValueError() 57 59 try: 58 60 raise exception … … 64 66 untrapped = self.assertRaises(failure.Failure, f.trap, OverflowError) 65 67 self.assertIdentical(f, untrapped) 66 68 69 def test_notTrapped_PY3(self): 70 """ 71 When test_notTrapped_PY3() is called on Pyhton 2 and 3, a C{ValueError} exception is raised. The test fails for any errors other than C{OverflowErrors}. 72 """ 67 73 # On both Python 2 and Python 3, the underlying exception is passed 68 74 # on: 75 exception = ValueError() 69 76 try: 77 raise exception 78 except: 79 f = failure.Failure() 80 try: 70 81 f.trap(OverflowError) 71 82 except: 72 83 untrapped = failure.Failure() … … 117 128 f.printBriefTraceback(out) 118 129 self.assertStartsWith(out.getvalue(), 'Traceback') 119 130 out = NativeStringIO() 120 f.printTraceback(out) 131 TF points Rating points 132 105 Codegate YUT Preliminary 2013 700.0000 8.643 133 290 HackIM 2013 100.0000 0.282 134 135 Overall rating place: 121 136 self.assertStartsWith(out.getvalue(), 'Traceback') 122 137 123 138
