[Python-checkins] python/dist/src/Lib/test test_optparse.py, 1.2.8.1, 1.2.8.2
Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12994/Lib/test Modified Files: Tag: release23-maint test_optparse.py Log Message: Fix support for the "prog" keyword to the OptionParser constructor, as well as directly setting the .prog attribute (which should be supported based on the class docstring). Closes SF bug #850964. Index: test_optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_optparse.py,v retrieving revision 1.2.8.1 retrieving revision 1.2.8.2 diff -C2 -d -r1.2.8.1 -r1.2.8.2 *** test_optparse.py 4 Aug 2003 22:49:42 -0000 1.2.8.1 --- test_optparse.py 1 Apr 2004 07:38:49 -0000 1.2.8.2 *************** *** 613,616 **** --- 613,632 ---- sys.argv[0] = oldargv + def test_version_with_prog_keyword(self): + oldargv = sys.argv[0] + sys.argv[0] = "./foo/bar" + self.parser = OptionParser(usage=SUPPRESS_USAGE, version="%prog 0.1", + prog="splat") + self.assertStdoutEquals(["--version"], "splat 0.1\n") + sys.argv[0] = oldargv + + def test_version_with_prog_attribute(self): + oldargv = sys.argv[0] + sys.argv[0] = "./foo/bar" + self.parser = OptionParser(usage=SUPPRESS_USAGE, version="%prog 0.1") + self.parser.prog = "splat" + self.assertStdoutEquals(["--version"], "splat 0.1\n") + sys.argv[0] = oldargv + def test_no_version(self): self.parser = OptionParser(usage=SUPPRESS_USAGE)
participants (1)
-
fdrake@users.sourceforge.net