Lines Matching full:symbol
135 def __init__(self, symbol, return_obj, *args, **dargs): argument
137 self.symbol = symbol
168 return _dump_function_call(self.symbol, self.args, self.dargs)
172 def __init__(self, symbol, return_val, *args, **dargs): argument
173 super(function_mapping, self).__init__(symbol, return_val, *args,
192 def __init__(self, symbol, default_return_val=None, argument
198 self.symbol = symbol
201 self.__name__ = symbol
209 return self.playback(self.symbol, *args, **dargs)
215 mapping = function_mapping(self.symbol, None, *args, **dargs)
224 mapping = function_any_args_mapping(self.symbol, None)
232 def __init__(self, symbol, original_function, default_return_val=None, argument
234 super(mask_function, self).__init__(symbol,
251 for symbol in dir(cls):
252 if symbol.startswith("_"):
255 orig_symbol = getattr(cls, symbol)
257 f_name = "%s.%s" % (self.__name, symbol)
260 setattr(self, symbol, func)
262 setattr(self, symbol, orig_symbol)
324 for symbol in dir(obj):
325 if (symbol.startswith("__") and
326 symbol.endswith("__")):
329 if isinstance(getattr(typ, symbol, None), property):
332 orig_symbol = getattr(obj, symbol)
335 (obj_name, symbol))
340 setattr(obj, symbol, func)
342 setattr(obj, symbol,
362 def create_mock_function(self, symbol, default_return_val=None): argument
364 create a mock_function with name symbol and default return
367 return mock_function(symbol, default_return_val,
377 for symbol in dir(obj):
378 if symbol.startswith("__"):
381 orig_symbol = getattr(obj, symbol)
383 f_name = "%s.%s" % (name, symbol)
388 setattr(obj, symbol, func)
391 def stub_with(self, namespace, symbol, new_attribute): argument
392 original_attribute = getattr(namespace, symbol,
400 symbol not in namespace.__dict__)
404 newstub = (namespace, symbol, original_attribute, new_attribute)
406 setattr(namespace, symbol, new_attribute)
409 def stub_function(self, namespace, symbol): argument
410 mock_attribute = self.create_mock_function(symbol)
411 self.stub_with(namespace, symbol, mock_attribute)
414 def stub_class_method(self, cls, symbol): argument
415 mock_attribute = self.create_mock_function(symbol)
416 self.stub_with(cls, symbol, staticmethod(mock_attribute))
419 def stub_class(self, namespace, symbol): argument
420 attr = getattr(namespace, symbol)
421 mock_class = self.create_mock_class_obj(attr, symbol)
422 self.stub_with(namespace, symbol, mock_class)
425 def stub_function_to_return(self, namespace, symbol, object_to_return): argument
429 @param symbol The attribute within the namespace to stub out.
433 self.stub_with(namespace, symbol,
438 namespace, symbol, orig_attr, new_attr = stub
440 delattr(namespace, symbol)
442 setattr(namespace, symbol, orig_attr)
445 def unstub(self, namespace, symbol): argument
447 if (namespace, symbol) == (stub[0], stub[1]):
462 def __method_playback(self, symbol, *args, **dargs): argument
465 _dump_function_call(symbol, args, dargs))
469 if func_call.symbol != symbol:
471 % (_dump_function_call(symbol, args, dargs),
478 % (_dump_function_call(symbol, args, dargs),
491 % (_dump_function_call(symbol, args, dargs)))
568 def _dump_function_call(symbol, args, dargs): argument
574 return "%s(%s)" % (symbol, ', '.join(arg_vec))