summaryrefslogtreecommitdiffstats
path: root/Lib/test/test___all__.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2001-01-20 19:54:20 (GMT)
committerSkip Montanaro <skip@pobox.com>2001-01-20 19:54:20 (GMT)
commite99d5ea25ba994491c773d9b5872332334ccd1c5 (patch)
tree9f8fd636e123cc4a9718b7ae70ce0842dd19b755 /Lib/test/test___all__.py
parentc955f892254359194b3b1c4462156753acc4de90 (diff)
downloadcpython-e99d5ea25ba994491c773d9b5872332334ccd1c5.zip
cpython-e99d5ea25ba994491c773d9b5872332334ccd1c5.tar.gz
cpython-e99d5ea25ba994491c773d9b5872332334ccd1c5.tar.bz2
added __all__ lists to a number of Python modules
added test script and expected output file as well this closes patch 103297. __all__ attributes will be added to other modules without first submitting a patch, just adding the necessary line to the test script to verify more-or-less correct implementation.
Diffstat (limited to 'Lib/test/test___all__.py')
-rw-r--r--Lib/test/test___all__.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
new file mode 100644
index 0000000..f5e3630
--- /dev/null
+++ b/Lib/test/test___all__.py
@@ -0,0 +1,55 @@
+
+from test_support import verify, verbose, TestFailed
+import sys
+
+def check_all(_modname):
+ exec "import %s" % _modname
+ verify(hasattr(sys.modules[_modname],"__all__"),
+ "%s has no __all__ attribute" % _modname)
+ exec "del %s" % _modname
+ exec "from %s import *" % _modname
+
+ _keys = locals().keys()
+ _keys.remove("_modname")
+ _keys.sort()
+ all = list(sys.modules[_modname].__all__) # in case it's a tuple
+ all.sort()
+ verify(_keys==all,"%s != %s" % (_keys,all))
+
+check_all("BaseHTTPServer")
+check_all("Bastion")
+check_all("CGIHTTPServer")
+check_all("ConfigParser")
+check_all("Cookie")
+check_all("MimeWriter")
+check_all("Queue")
+check_all("SimpleHTTPServer")
+check_all("SocketServer")
+check_all("StringIO")
+check_all("UserDict")
+check_all("UserList")
+check_all("UserString")
+check_all("aifc")
+check_all("anydbm")
+check_all("atexit")
+check_all("audiodev")
+check_all("base64")
+check_all("bdb")
+check_all("binhex")
+check_all("bisect")
+check_all("calendar")
+check_all("cgi")
+check_all("chunk")
+check_all("cmd")
+check_all("code")
+check_all("codecs")
+check_all("codeop")
+check_all("colorsys")
+check_all("commands")
+check_all("compileall")
+check_all("copy")
+check_all("copy_reg")
+check_all("dbhash")
+check_all("dircache")
+check_all("dis")
+check_all("robotparser")