Example #1
0
class TestHelpParser(unittest.TestCase):
    def setUp(self):
        self.command_parser = HelpCommandParser()

    def tearDown(self):
        self.command_parser = None

    def test_support_true(self):
        assert self.command_parser.support('help sh') == True

    def test_support_alias(self):
        assert self.command_parser.support('h sh') == True
        assert self.command_parser.support('he sh') == True
        assert self.command_parser.support('hel sh') == True

    def test_support_false(self):
        assert self.command_parser.support('non-help sh') == False

    def test_parse_help_itself(self):
        text = "help help"
        cmd_help = self.command_parser.parse(text)
        assert isinstance(cmd_help, HelpCommand)

    def test_parse_help_default(self):
        text = "help"
        cmd_help = self.command_parser.parse(text)
        assert isinstance(cmd_help, HelpCommand)
Example #2
0
 def setUp(self):
     self.command_parser = HelpCommandParser()