mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
issue13287 - Define __all__ for urllib.request and urllib.error and expose only
the relevant module. Other cleanup improvements. Patch by flox.
This commit is contained in:
parent
712b14fc2a
commit
6c5bd40a3e
4 changed files with 40 additions and 18 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue