Skip to content

Instantly share code, notes, and snippets.

@k-bx
Created May 11, 2012 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-bx/2660237 to your computer and use it in GitHub Desktop.
Save k-bx/2660237 to your computer and use it in GitHub Desktop.
mock autospeccing harming
>>> from mock import create_autospec
>>> class A(object):
... def __init__(self, data):
... self.cleaned_data = data
...
>>> m_A = create_autospec(A)
>>> m_A({'a': 'b'}).cleaned_data
Traceback (most recent call last):
File "<ipython-input-5-66064b709d22>", line 1, in <module>
m_A({'a': 'b'}).cleaned_data
File "/home/kost/.virtualenvs/shwp/local/lib/python2.7/site-packages/mock-1.0a2-py2.7.egg/mock.py", line 631, in __getattr__
raise AttributeError("Mock object has no attribute %r" % name)
AttributeError: Mock object has no attribute 'cleaned_data'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment