def test_check_list(self): m = StatusMessageMatcher() r = re.compile assert m.check_list(['ready'], ['ready']) assert not m.check_list(['ready', 'ready'], ['ready']) # too few assert not m.check_list(['ready'], ['ready', 'ready']) # too many assert m.check_list(['ready', 'ready', 'ok'], ['ready', 'ok', 'ready']) assert not m.check_list(['ready', 'ready', 'ok'], ['ready', 'ok', 'ok']) assert m.check_list([r('ready(ish)?')], ['ready']) assert m.check_list([r('ready(ish)?')], ['readyish']) assert m.check_list([r('ready(ish)?'), 'ready'], ['ready', 'readyish']) # ambiguous-ish assert m.check_list([r('ready(ish)?'), 'ready'], ['readyish', 'ready']) # ambiguous-ish
def test_check(self): m = StatusMessageMatcher() m.check_messages = Mock() m.check_set = Mock() m.check_list = Mock() m.check('ready', ['ready']) m.check(re.compile('ready'), ['ready']) self.assertEqual(m.check_messages.call_count, 2) m.check({'ready'}, ['ready']) self.assertEqual(m.check_set.call_count, 1) m.check(['ready'], ['ready']) m.check(('ready',), ['ready']) self.assertEqual(m.check_list.call_count, 2)
def test_check(self): m = StatusMessageMatcher() m.check_messages = Mock() m.check_set = Mock() m.check_list = Mock() m.check('ready', ['ready']) m.check(re.compile('ready'), ['ready']) self.assertEqual(m.check_messages.call_count, 2) m.check({'ready'}, ['ready']) self.assertEqual(m.check_set.call_count, 1) m.check(['ready'], ['ready']) m.check(('ready', ), ['ready']) self.assertEqual(m.check_list.call_count, 2)