diff options
Diffstat (limited to 'Lib/test/test_optparse.py')
-rw-r--r-- | Lib/test/test_optparse.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index 7b95612..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() @@ -631,7 +647,7 @@ class TestStandard(BaseTest): option_list=options) def test_required_value(self): - self.assertParseFail(["-a"], "-a option requires an argument") + self.assertParseFail(["-a"], "-a option requires 1 argument") def test_invalid_integer(self): self.assertParseFail(["-b", "5x"], @@ -1023,7 +1039,7 @@ class TestExtendAddTypes(BaseTest): TYPE_CHECKER["file"] = check_file def test_filetype_ok(self): - open(support.TESTFN, "w").close() + support.create_empty_file(support.TESTFN) self.assertParseOK(["--file", support.TESTFN, "-afoo"], {'file': support.TESTFN, 'a': 'foo'}, []) |