diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-07-16 00:12:24 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-07-16 00:12:24 (GMT) |
commit | 6159e0956c812d66b3e8fd8bb37f0d5d1ca9fc40 (patch) | |
tree | 9925d47c09841279f70aae478935a08f78e6c8a0 /Lib | |
parent | 7aa2c8baaede627967acdfdb3da1bcca7f12660c (diff) | |
download | cpython-6159e0956c812d66b3e8fd8bb37f0d5d1ca9fc40.zip cpython-6159e0956c812d66b3e8fd8bb37f0d5d1ca9fc40.tar.gz cpython-6159e0956c812d66b3e8fd8bb37f0d5d1ca9fc40.tar.bz2 |
#4640: Add optparse tests for '-xxx' invalid when defining options.
Patch by Aaron (hac.man).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_optparse.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index d1ae757..78de278 100644 --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -318,6 +318,22 @@ class TestOptionChecks(BaseTest): ["-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() |