Example #1
0
 def test_last_call_to_returns_last_call_to_given_func(self):
     stub = EmptyFake()
     stub.func = lambda *a, **k: None
     spy = MasterSpy(stub)
     planted_args = (4, 5)
     planted_kwargs = {"foo": 77, "bar": "soap"}
     spy.func(spam=1, eggs=2)
     spy.func(*planted_args, **planted_kwargs)
     expect(spy.last_call_to("func")).to(
         equal((planted_args, planted_kwargs)))
 def test_last_call_to_returns_last_call_to_given_func(self):
     stub = EmptyFake()
     stub.func = lambda *a, **k: None
     spy = MasterSpy(stub)
     planted_args = (4, 5)
     planted_kwargs = {'foo': 77, 'bar': 'soap'}
     spy.func(spam=1, eggs=2)
     spy.func(*planted_args, **planted_kwargs)
     expect(spy.last_call_to('func')).to(
         equal((planted_args, planted_kwargs)))
Example #3
0
 def test_saves_first_function_call(self):
     planted_args = (1, 4, 5)
     planted_kwargs = {"spam": 32, "eggs": object()}
     stub = EmptyFake()
     stub.func = lambda *a, **k: None
     spy = MasterSpy(stub)
     spy.func(*planted_args, **planted_kwargs)
     spy.func(5, 7, 2, bruces=4, michaels=1)
     expect(spy.attribute_spies["func"].call_history[0]).to(
         equal((planted_args, planted_kwargs)))
 def test_saves_last_function_call(self):
     planted_args = (1, 4, 5)
     planted_kwargs = {'spam': 32, 'eggs': object()}
     stub = EmptyFake()
     stub.func = lambda *a, **k: None
     spy = MasterSpy(stub)
     spy.func(5, 7, 2, bruces=4, michaels=1)
     spy.func()
     spy.func(*planted_args, **planted_kwargs)
     expect(spy.attribute_spies['func'].call_history[-1]).to(
         equal((planted_args, planted_kwargs)))