Ticket #5952: my-first-patch.patch

File my-first-patch.patch, 1.9 KB (added by sreepriya, 3 years ago)

In the patch, the method test_notTrapped() is broken to two methods for PY3 and PY2. Docstrings are added for both the methods.

  • test_failure.py

     
    1 # Copyright (c) Twisted Matrix Laboratories.
     1# Copyright (c) Twisted Matrix La:boratories.
    22# See LICENSE for details.
    33
    44"""
     
    5151        self.assertEqual(f.type, NotImplementedError)
    5252
    5353
    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        """
    5658        exception = ValueError()
    5759        try:
    5860            raise exception
     
    6466            untrapped = self.assertRaises(failure.Failure, f.trap, OverflowError)
    6567            self.assertIdentical(f, untrapped)
    6668
     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         """
    6773        # On both Python 2 and Python 3, the underlying exception is passed
    6874        # on:
     75        exception = ValueError()
    6976        try:
     77            raise exception
     78        except:
     79            f = failure.Failure()
     80        try:
    7081            f.trap(OverflowError)
    7182        except:
    7283            untrapped = failure.Failure()
     
    117128        f.printBriefTraceback(out)
    118129        self.assertStartsWith(out.getvalue(), 'Traceback')
    119130        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:
    121136        self.assertStartsWith(out.getvalue(), 'Traceback')
    122137
    123138