diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-11-01 15:20:31 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-11-01 15:20:31 (GMT) |
commit | 6c5bd40a3e68b63c2406de0c165ee213bd9f91f1 (patch) | |
tree | c5fca21e651006d344961f8f8e149c7f8ac693cf /Lib/test | |
parent | 712b14fc2a41ff7a1b7a00cab0f237ef3d07939a (diff) | |
download | cpython-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.py | 12 |
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 |