def _get_generator(self, str_or_tuple_or_function, optionals): if util.iscallable(str_or_tuple_or_function): return actions.FunctionGenerator( str_or_tuple_or_function, \ optionals=optionals) elif isinstance(str_or_tuple_or_function, tuple): if len(str_or_tuple_or_function) == 2: return actions.TupleGenerator( str_or_tuple_or_function, \ optionals=optionals) else: return actions.StringGenerator( str_or_tuple_or_function, \ optionals=optionals)
def _get_matcher(self, cmd_or_predicate): if util.iscallable(cmd_or_predicate): return actions.FunctionMatcher(cmd_or_predicate) else: return actions.CommandMatcher(cmd_or_predicate)
def test_iscallable_string_should_not_be_callable(self): self.assertFalse(util.iscallable("teststring"))
def test_iscallable_method_should_be_callable(self): self.assertTrue(util.iscallable(self.callable_test_method))