Skip to content

Commit dee8055

Browse files
committed
Ensure false-y replacement "new" objects are allowed.
1 parent 19af306 commit dee8055

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

umock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ def __enter__(self):
651651
If self.new is None, a new Mock object is created with the supplied
652652
kwargs and bound to self.new before the target is replaced.
653653
"""
654-
self.new = self.new or Mock(**self.kwargs)
654+
if self.new is None:
655+
self.new = Mock(**self.kwargs)
655656
self._old = patch_target(self.target, self.new)
656657
return self.new
657658

0 commit comments

Comments
 (0)