summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Fatyga <dawid.fatyga@gmail.com>2012-04-24 22:22:38 +0200
committerDawid Fatyga <dawid.fatyga@gmail.com>2012-04-24 22:22:38 +0200
commit4bf088ce24e8eb0c8c3a34595eda71267b03d797 (patch)
treebd205ddc69b666613ca1e70d2c34a84ee5e00e1d
parent89f703dc855dd81f0b25ded8136695e10e19fae6 (diff)
downloadpymox-4bf088ce24e8eb0c8c3a34595eda71267b03d797.tar.gz
Fixed a bug when dir() called on MockObject was not returning attributes of a mocked class (Python3).
-rwxr-xr-xmox.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mox.py b/mox.py
index fd68fdf..b2c671f 100755
--- a/mox.py
+++ b/mox.py
@@ -576,7 +576,7 @@ class MockObject(MockAnything):
self._known_vars = set()
self._class_to_mock = class_to_mock
- if inspect.isclass(self._class_to_mock):
+ if inspect.isclass(class_to_mock):
self._class_to_bind = self._class_to_mock
else:
self._class_to_bind = class_to_bind
@@ -817,6 +817,10 @@ class MockObject(MockAnything):
"""Return the name that is being mocked."""
return self._description
+ def __dir__(self):
+ """Return only attributes of a class to mock """
+ return dir(self._class_to_mock)
+
class _MockObjectFactory(MockObject):
"""A MockObjectFactory creates mocks and verifies __init__ params.