Python optparse._match_abbrev() Examples

The following are 21 code examples of optparse._match_abbrev(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module optparse , or try the search function .
Example #1
Source File: test_optparse.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #2
Source File: test_optparse.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #3
Source File: test_optparse.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #4
Source File: test_optparse.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #5
Source File: test_optparse.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #6
Source File: options.py    From conary with Apache License 2.0 5 votes vote down vote up
def _match_long_opt(self, opt):
        match = optparse._match_abbrev(opt, self._long_opt)
        if not self.matchPartialOptions and opt != match:
            raise optparse.BadOptionError("no such option: %s" % opt)
        return match 
Example #7
Source File: test_optparse.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #8
Source File: test_optparse.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #9
Source File: test_optparse.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #10
Source File: test_optparse.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #11
Source File: test_optparse.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #12
Source File: test_optparse.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #13
Source File: test_optparse.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #14
Source File: test_optparse.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #15
Source File: test_optparse.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #16
Source File: test_optparse.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #17
Source File: test_optparse.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #18
Source File: test_optparse.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #19
Source File: test_optparse.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)") 
Example #20
Source File: test_optparse.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_match_abbrev(self):
        self.assertEqual(_match_abbrev("--f",
                                       {"--foz": None,
                                        "--foo": None,
                                        "--fie": None,
                                        "--f": None}),
                         "--f") 
Example #21
Source File: test_optparse.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_match_abbrev_error(self):
        s = "--f"
        wordmap = {"--foz": None, "--foo": None, "--fie": None}
        self.assertRaises(
            _match_abbrev, (s, wordmap), None,
            BadOptionError, "ambiguous option: --f (--fie, --foo, --foz?)")