Ticket #6120: 6120.2.patch

File 6120.2.patch, 1.8 KB (added by moijes12, 9 years ago)

Please ignore the previous patch but the comments remain the same.

  • twisted/web/test/test_http.py

     
    16531653        self.assertRaises(RuntimeError, req.finish)
    16541654
    16551655
     1656    def test_repr(self):
     1657        """
     1658        L{Request.__repr__} returns the method, uri and client protocol of the
     1659        C{Request} instance as a C{String} in the form <METHOD URI PROTOCOL>.
     1660        """
     1661        request = http.Request(DummyChannel(), False)
     1662        request.clientproto = b"HTTP/1.0"
     1663        request.method = b"GET"
     1664        request.uri = b"/foo/bar"
     1665        self.assertEqual(repr(request), "<" +request.method + " " + request.uri + " " + request.clientproto + ">")     
    16561666
     1667
     1668
    16571669class MultilineHeadersTestCase(unittest.TestCase):
    16581670    """
    16591671    Tests to exercise handling of multiline headers by L{HTTPClient}.  RFCs 1945
  • twisted/web/topfiles/6120.bugfix

     
     1twisted.web.test_http.RequestTests.test_repr has been added as a test for twisted.web.http.Request.__repr__.
  • twisted/web/http.py

     
    791791
    792792
    793793    def __repr__(self):
     794        """
     795        Return the method, uri and client protocol of the C{Request} instance
     796        as a C{String} in the form <METHOD URI PROTOCOL>.
     797
     798        @return: C{String} in the form <METHOD URI PROTOCOL>.
     799        @rtype: C{String}.
     800        """
    794801        return '<%s %s %s>'% (self.method, self.uri, self.clientproto)
    795802
    796803    def process(self):