示例#1
0
 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_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)
示例#3
0
 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 _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)
示例#5
0
 def test_iscallable_string_should_not_be_callable(self):
     self.assertFalse(util.iscallable("teststring"))
示例#6
0
 def test_iscallable_method_should_be_callable(self):
     self.assertTrue(util.iscallable(self.callable_test_method))
 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))