summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-03-14 13:43:53 -0700
committerSenthil Kumaran <senthil@uthcode.com>2012-03-14 13:43:53 -0700
commit38b968b9131820d089e4dc68b11675c3bc98a631 (patch)
tree0595d65dfc835b6599bbb5ad9e116c4c03a53a48 /Lib/test
parentc17adf41511f7165935074bc505e09e0574f59be (diff)
downloadcpython-git-38b968b9131820d089e4dc68b11675c3bc98a631.tar.gz
deprecated the old urllib primitives in 3.3 urllib package - issue 10050
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib.py4
-rw-r--r--Lib/test/test_urllib2.py23
2 files changed, 23 insertions, 4 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 85f8f841df..22ada56d0c 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -298,6 +298,10 @@ Content-Type: text/html; charset=iso-8859-1
finally:
self.unfakehttp()
+ def test_URLopener_deprecation(self):
+ with support.check_warnings(('',DeprecationWarning)):
+ warn = urllib.request.URLopener()
+
class urlretrieve_FileTests(unittest.TestCase):
"""Test urllib.urlretrieve() on local files"""
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 0ff318157e..2161690ca2 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -553,10 +553,6 @@ class OpenerDirectorTests(unittest.TestCase):
self.assertRaises(urllib.error.URLError, o.open, req)
self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})])
-## def test_error(self):
-## # XXX this doesn't actually seem to be used in standard library,
-## # but should really be tested anyway...
-
def test_http_error(self):
# XXX http_error_default
# http errors are a special case
@@ -584,6 +580,7 @@ class OpenerDirectorTests(unittest.TestCase):
self.assertEqual((handler, method_name), got[:2])
self.assertEqual(args, got[2])
+
def test_processors(self):
# *_request / *_response methods get called appropriately
o = OpenerDirector()
@@ -619,6 +616,24 @@ class OpenerDirectorTests(unittest.TestCase):
self.assertTrue(args[1] is None or
isinstance(args[1], MockResponse))
+ def test_method_deprecations(self):
+ req = Request("http://www.example.com")
+ with support.check_warnings(('', DeprecationWarning)):
+ req.add_data("data")
+ with support.check_warnings(('', DeprecationWarning)):
+ req.has_data()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.get_data()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.get_full_url()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.get_host()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.get_selector()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.is_unverifiable()
+ with support.check_warnings(('', DeprecationWarning)):
+ req.get_origin_req_host()
def sanepathname2url(path):
try: