def test_always_returns_identity(self): fn = always(sentinel.RESULT_VALUE) assert fn() is sentinel.RESULT_VALUE assert fn(1, key='value') is sentinel.RESULT_VALUE
def assert_not_any_call(self, *args, **kwargs): assert len(self.__calls_matching(*args, **kwargs)) is 0 def __calls_matching(self, *args, **kwargs): calls_match = lambda other_call: call(*args, **kwargs) == other_call return list(filter(calls_match, self.call_args_list)) ########NEW FILE######## __FILENAME__ = objects from __future__ import absolute_import def always(value): return lambda *a, **k: value noop = no_op = always(None) ########NEW FILE######## __FILENAME__ = dummy #: Module purely exists to test patching things. thing = True it = lambda: False def get_thing(): global thing return thing def get_it(): global it