Пример #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'))