Skip to content

Instantly share code, notes, and snippets.

@fxdgear
Last active December 14, 2015 21:49
Show Gist options
  • Select an option

  • Save fxdgear/5153654 to your computer and use it in GitHub Desktop.

Select an option

Save fxdgear/5153654 to your computer and use it in GitHub Desktop.
class Foo(object):
def __init__(*args, **kwargs):
self.a = kwargs.get('a')
self.b = kwargs.get('b')
self.c = kwargs.get('c')
@property
def prop_1(self):
return self.a + self.b
@property
def prop_2(self):
return self.prop_1 + self.c
foo = Foo(*args, **kwargs) # big class
mock_foo = Mock(a="some", b="value", c="OMG")
mock_foo.prop_1 = "some value"
mock_foo.prop_2 = "some value OMG"
assertEqual(foo.prop_1, mock_foo.prop_1)
assertEqual(foo.prop_2, mock_foo.prop_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment