Last active
December 14, 2015 21:49
-
-
Save fxdgear/5153654 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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