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'))
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))
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)
def test_get_keywords_do_not_exist(self): cmd = Command() self.assertIsNone(cmd.get('keyword_1')) self.assertIsNone(cmd.get('keyword_2'))