示例#1
0
    def test_get_keywords_exists(self):
        cmd = Command()

        cmd.append('command_1', ['keyword_1', 'keyword_2'])
        cmd.append('command_2', ['keyword_3', 'keyword_4'])
        self.assertEqual('command_1', cmd.get('keyword_1'))
        self.assertEqual('command_1', cmd.get('keyword_2'))
        self.assertEqual('command_2', cmd.get('keyword_3'))
        self.assertEqual('command_2', cmd.get('keyword_4'))
示例#2
0
    def test_append(self):
        cmd = Command()
        self.assertEqual(0, len(cmd._commands))

        cmd.append('command_1', ['keyword_1', 'keyword_2'])
        self.assertEqual(2, len(cmd._commands))
示例#3
0
    def test_parse(self):
        keywords, command = Command._parse('    [   matchlist, list, ml  ]   :   $m_list_req  ')

        self.assertEqual(['matchlist, list, ml'], keywords)
        self.assertEqual('$m_list_req', command)
示例#4
0
    def test_get_keywords_do_not_exist(self):
        cmd = Command()

        self.assertIsNone(cmd.get('keyword_1'))
        self.assertIsNone(cmd.get('keyword_2'))