diff options
| author | Senthil Kumaran <senthil@uthcode.com> | 2011-11-01 23:20:31 +0800 |
|---|---|---|
| committer | Senthil Kumaran <senthil@uthcode.com> | 2011-11-01 23:20:31 +0800 |
| commit | 6c5bd40a3e68b63c2406de0c165ee213bd9f91f1 (patch) | |
| tree | c5fca21e651006d344961f8f8e149c7f8ac693cf /Lib/test/test_urllib2.py | |
| parent | 712b14fc2a41ff7a1b7a00cab0f237ef3d07939a (diff) | |
| download | cpython-git-6c5bd40a3e68b63c2406de0c165ee213bd9f91f1.tar.gz | |
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/test_urllib2.py')
| -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 84a058a7d8..e55140e1d8 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 |
