OLD | NEW |
1 # mock.py | 1 # mock.py |
2 # Test tools for mocking and patching. | 2 # Test tools for mocking and patching. |
3 # Copyright (C) 2007-2012 Michael Foord & the mock team | 3 # Copyright (C) 2007-2012 Michael Foord & the mock team |
4 # E-mail: fuzzyman AT voidspace DOT org DOT uk | 4 # E-mail: fuzzyman AT voidspace DOT org DOT uk |
5 | 5 |
6 # mock 1.0 | 6 # mock 1.0 |
7 # http://www.voidspace.org.uk/python/mock/ | 7 # http://www.voidspace.org.uk/python/mock/ |
8 | 8 |
9 # Released subject to the BSD License | 9 # Released subject to the BSD License |
10 # Please see http://www.voidspace.org.uk/python/license.shtml | 10 # Please see http://www.voidspace.org.uk/python/license.shtml |
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 Fetching a `PropertyMock` instance from an object calls the mock, with | 2358 Fetching a `PropertyMock` instance from an object calls the mock, with |
2359 no args. Setting it calls the mock with the value being set. | 2359 no args. Setting it calls the mock with the value being set. |
2360 """ | 2360 """ |
2361 def _get_child_mock(self, **kwargs): | 2361 def _get_child_mock(self, **kwargs): |
2362 return MagicMock(**kwargs) | 2362 return MagicMock(**kwargs) |
2363 | 2363 |
2364 def __get__(self, obj, obj_type): | 2364 def __get__(self, obj, obj_type): |
2365 return self() | 2365 return self() |
2366 def __set__(self, obj, val): | 2366 def __set__(self, obj, val): |
2367 self(val) | 2367 self(val) |
OLD | NEW |