This repository was archived by the owner on May 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ class OperationList(list):
58
58
def lookup (self , invocation ):
59
59
if not invocation in self :
60
60
raise LookupError
61
- return filter (lambda i : i == invocation , self )[- 1 ]
61
+
62
+ return [i for i in self if i == invocation ][- 1 ]
62
63
63
64
def show (self , indent = 0 ):
64
65
if not self :
Original file line number Diff line number Diff line change @@ -174,14 +174,21 @@ def test_keyworked_or_positional_are_equivalent(self):
174
174
assert_that (self .stub .kwarg_method (6 ), is_ (6000 ))
175
175
assert_that (self .stub .kwarg_method (key_param = 6 ), is_ (6000 ))
176
176
177
- def test_uses_the_last_configuration_of_a_method_that_has_been_previously_stubbed (self ):
177
+ def test_last_stubbed_method_prevails (self ):
178
178
with self .stub :
179
179
self .stub .hello ().returns ("hi!" )
180
180
181
181
with self .stub :
182
- self .stub .hello ().returns ("Hello !" )
182
+ self .stub .hello ().returns ("bye !" )
183
183
184
- assert_that (self .stub .hello (), is_ ("Hello!" ))
184
+ assert_that (self .stub .hello (), is_ ("bye!" ))
185
+
186
+ def test_last_stubbed_method_prevails_same_with (self ):
187
+ with self .stub :
188
+ self .stub .hello ().returns ("hi!" )
189
+ self .stub .hello ().returns ("bye!" )
190
+
191
+ assert_that (self .stub .hello (), is_ ("bye!" ))
185
192
186
193
def test_returning_tuple (self ):
187
194
with self .stub :
You can’t perform that action at this time.
0 commit comments