From 4a6524295d2c3b4ded90bc33365306f89967dc0f Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 8 Sep 2013 13:03:40 -0400 Subject: [PATCH] Issue #18978: Add tests to capture expected behavior for class-level method overrides. --- Lib/test/test_urllib2.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index b3659f442e4..9c71abfae4a 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1466,16 +1466,25 @@ class MiscTests(unittest.TestCase): self.assertEqual(str(err), expected_errmsg) class RequestTests(unittest.TestCase): + class PutRequest(Request): + method='PUT' def setUp(self): self.get = Request("http://www.python.org/~jeremy/") self.post = Request("http://www.python.org/~jeremy/", "data", headers={"X-Test": "test"}) + self.head = Request("http://www.python.org/~jeremy/", method='HEAD') + self.put = self.PutRequest("http://www.python.org/~jeremy/") + self.force_post = self.PutRequest("http://www.python.org/~jeremy/", + method="POST") def test_method(self): self.assertEqual("POST", self.post.get_method()) self.assertEqual("GET", self.get.get_method()) + self.assertEquil("HEAD", self.head.get_method()) + self.assertEqual("PUT", self.put.get_method()) + self.assertEqual("POST", self.force_post.get_method()) def test_data(self): self.assertFalse(self.get.data)