def assert_no_result(self, *values): self.assertFalse(any_result(*values))
def matches(self, sentence): i = any_result(self._match_structure(sentence, s) for s in self.structures) return i
def assert_needle(self, *values): self.assertEqual(self.needle, any_result(*values))
def is_command(sentence): commands = [ReminderCommand(), WeatherCommand()] foo = ReminderCommand().matches(sentence) key = lambda x: x and x[1] return any_result(((c, c.matches(sentence)) for c in commands), key)