Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_optparse.py @ 78124:844bb753570f
#4640: Add optparse tests for '-xxx' invalid when defining options.
Patch by Aaron (hac.man).
| author | R David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Sun, 15 Jul 2012 20:12:24 -0400 |
| parents | 0c49260e85a0 |
| children | 33bdd0a985b9 |
line wrap: on
line diff
--- a/Lib/test/test_optparse.py Sun Jul 15 16:58:29 2012 -0700 +++ b/Lib/test/test_optparse.py Sun Jul 15 20:12:24 2012 -0400 @@ -318,6 +318,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()
