New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-29799 Adding tests for HTTP header API of urllib.request.Request class #643
bpo-29799 Adding tests for HTTP header API of urllib.request.Request class #643
Conversation
…re provided as constructor arguments
@ultimatecoder, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @orsenthil, @birkenfeld, @benjaminp and @serhiy-storchaka to be potential reviewers. |
def test_request_with_headers(self): | ||
"""Verify headers if passed as a constructor argument.""" | ||
request = self.Request("http://www.python.org", headers=self.headers) | ||
self.assertDictEqual(request.headers, self.headers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant with test_urllib2.RequestHdrsTests.test_request_headers_dict
"""Verify presence of headers is marked.""" | ||
request = self.Request("http://www.python.org", headers=self.headers) | ||
self.assertTrue(request.has_header('User-agent')) | ||
self.assertFalse(request.has_header('Content-type')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test_urllib2.RequestHdrsTests.test_request_headers_methods already tests “has_header” against a constructor-supplied header field, and also has a negative test.
self.assertListEqual( | ||
request.header_items(), | ||
list(self.headers.items()) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also covered by “test_request_headers_methods”
Description: Adding various tests for all the HTTP header related methods of
urllib.request.Request
class.BPO: http://bugs.python.org/issue29799