Skip to content

Instantly share code, notes, and snippets.

@ericholscher
Created December 8, 2011 19:40
Show Gist options
  • Save ericholscher/1448223 to your computer and use it in GitHub Desktop.
Save ericholscher/1448223 to your computer and use it in GitHub Desktop.
class Mock(object):
def __init__(self, *args, **kwargs):
pass
def __getattr__(self, name):
return Mock
In [4]: m = Mock()
In [5]: m.awesome
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Volumes/Work/configdb/<ipython console> in <module>()
AttributeError: 'Mock' object has no attribute 'awesome'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment