summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-11-01 15:20:31 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-11-01 15:20:31 (GMT)
commit6c5bd40a3e68b63c2406de0c165ee213bd9f91f1 (patch)
treec5fca21e651006d344961f8f8e149c7f8ac693cf /Lib/test
parent712b14fc2a41ff7a1b7a00cab0f237ef3d07939a (diff)
downloadcpython-6c5bd40a3e68b63c2406de0c165ee213bd9f91f1.zip
cpython-6c5bd40a3e68b63c2406de0c165ee213bd9f91f1.tar.gz
cpython-6c5bd40a3e68b63c2406de0c165ee213bd9f91f1.tar.bz2
issue13287 - Define __all__ for urllib.request and urllib.error and expose only
the relevant module. Other cleanup improvements. Patch by flox.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_urllib2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 84a058a..e55140e 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -19,6 +19,18 @@ import urllib.error
# parse_keqv_list, parse_http_list, HTTPDigestAuthHandler
class TrivialTests(unittest.TestCase):
+
+ def test___all__(self):
+ # Verify which names are exposed
+ for module in 'request', 'response', 'parse', 'error', 'robotparser':
+ context = {}
+ exec('from urllib.%s import *' % module, context)
+ del context['__builtins__']
+ for k, v in context.items():
+ self.assertEqual(v.__module__, 'urllib.%s' % module,
+ "%r is exposed in 'urllib.%s' but defined in %r" %
+ (k, module, v.__module__))
+
def test_trivial(self):
# A couple trivial tests