diff options
| author | Jonathan Lange <jml@canonical.com> | 2010-08-04 13:53:10 +0100 |
|---|---|---|
| committer | Jonathan Lange <jml@canonical.com> | 2010-08-04 13:53:10 +0100 |
| commit | a102e886c51bc2faaf6131a4890e48e3e876a031 (patch) | |
| tree | 53451edb225036842117043d41ac2bcebf719e38 /testtools/monkey.py | |
| parent | 868f68a7ce6807cc14d3f187d9d6c60a13a1db3f (diff) | |
| download | testtools-a102e886c51bc2faaf6131a4890e48e3e876a031.tar.gz | |
Not necessary
Diffstat (limited to 'testtools/monkey.py')
| -rw-r--r-- | testtools/monkey.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/testtools/monkey.py b/testtools/monkey.py index 89f47c1..4940045 100644 --- a/testtools/monkey.py +++ b/testtools/monkey.py @@ -39,13 +39,6 @@ class MonkeyPatcher(object): """ self._patches_to_apply.append((obj, name, value)) - def _already_patched(self, obj, name): - """Has 'obj.name' already been patched by this patcher?""" - for o, n, v in self._originals: - if (o, n) == (obj, name): - return True - return False - def patch(self): """Apply all of the patches that have been specified with `add_patch`. @@ -53,8 +46,7 @@ class MonkeyPatcher(object): """ for obj, name, value in self._patches_to_apply: original_value = getattr(obj, name, self._NO_SUCH_ATTRIBUTE) - if not self._already_patched(obj, name): - self._originals.append((obj, name, original_value)) + self._originals.append((obj, name, original_value)) setattr(obj, name, value) def restore(self): |
