[Python-checkins] cpython (2.7): #9161: Fix test to use standard optparse test pattern (what was I thinking?)

r.david.murray python-checkins at python.org
Tue Aug 14 15:14:53 CEST 2012


http://hg.python.org/cpython/rev/ffd70c371fee
changeset:   78567:ffd70c371fee
branch:      2.7
user:        R David Murray <rdmurray at bitdance.com>
date:        Tue Aug 14 09:14:37 2012 -0400
summary:
  #9161: Fix test to use standard optparse test pattern (what was I thinking?)

files:
  Lib/test/test_optparse.py |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -769,12 +769,12 @@
         self.assertParseFail(["-test"],
                              "no such option: -e")
 
-    def test_flag_accepts_unicode(self):
-        try:
-            self.parser.add_option(u"-u", u"--unicode")
-            self.parser.parse_args()
-        except TypeError:
-            self.fail("Failed parsing flag passed to add_option() as unicode.")
+    def test_add_option_accepts_unicode(self):
+        self.parser.add_option(u"-u", u"--unicode", action="store_true")
+        self.assertParseOK(["-u"],
+                           {'a': None, 'boo': None, 'foo': None, 'unicode': True},
+                           [])
+
 
 class TestBool(BaseTest):
     def setUp(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list