[Python-checkins] python/dist/src/Lib/test test_optparse.py,NONE,1.1
gward@users.sourceforge.net
gward@users.sourceforge.net
Sun, 20 Apr 2003 19:41:28 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv15486/Lib/test
Added Files:
test_optparse.py
Log Message:
Test suite for optparse. This is a slightly-edited copy of
test/test_optik.py (rev 1.19) from the Optik CVS.
--- NEW FILE: test_optparse.py ---
#!/usr/bin/python
#
# Test suite for Optik. Supplied by Johannes Gijsbers
# (taradino@softhome.net) -- translated from the original Optik
# test suite to this PyUnit-based version.
#
# $Id: test_optparse.py,v 1.1 2003/04/21 02:41:25 gward Exp $
#
import sys
import os
import copy
import unittest
from cStringIO import StringIO
from pprint import pprint
from test import test_support
[...1171 lines suppressed...]
possibilities = ", ".join(wordmap.keys())
self.assertRaises(_match_abbrev, BadOptionError,
"ambiguous option: --f (%s?)" % possibilities,
funcargs=[s, wordmap])
def _testclasses():
mod = sys.modules[__name__]
return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
def suite():
suite = unittest.TestSuite()
for testclass in _testclasses():
suite.addTest(unittest.makeSuite(testclass))
return suite
def test_main():
test_support.run_suite(suite())
if __name__ == '__main__':
unittest.main()