Ejemplo n.º 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)
Ejemplo n.º 2
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)
Ejemplo n.º 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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
 def test_iscallable_string_should_not_be_callable(self):
     self.assertFalse(util.iscallable("teststring"))
Ejemplo n.º 6
0
 def test_iscallable_method_should_be_callable(self):
     self.assertTrue(util.iscallable(self.callable_test_method))
Ejemplo n.º 7
0
 def test_iscallable_string_should_not_be_callable(self):
     self.assertFalse(util.iscallable("teststring"))
Ejemplo n.º 8
0
 def test_iscallable_method_should_be_callable(self):
     self.assertTrue(util.iscallable(self.callable_test_method))