(original) (raw)
diff -r ab22ffa6fb2e Lib/test/test_optparse.py --- a/Lib/test/test_optparse.py Sun Jul 08 17:35:26 2012 -0400 +++ b/Lib/test/test_optparse.py Mon Jul 09 21:56:38 2012 -0400 @@ -322,6 +322,22 @@ ["-b"], {'action': 'store', 'callback_kwargs': 'foo'}) + def test_no_single_dash(self): + self.assertOptionError( + "invalid long option string '-debug': " + "must start with --, followed by non-dash", + ["-debug"]) + + self.assertOptionError( + "option -d: invalid long option string '-debug': must start with" + " --, followed by non-dash", + ["-d", "-debug"]) + + self.assertOptionError( + "invalid long option string '-debug': " + "must start with --, followed by non-dash", + ["-debug", "--debug"]) + class TestOptionParser(BaseTest): def setUp(self): self.parser = OptionParser()