summaryrefslogtreecommitdiff
path: root/Lib/unittest/test/testmock/testhelpers.py
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2012-04-13 16:57:22 +0100
committerMichael Foord <michael@voidspace.org.uk>2012-04-13 16:57:22 +0100
commit9bef719feaf03d924286107269d959750d135012 (patch)
treeec6cbf19125f7f84bd0c9894d198e50493865008 /Lib/unittest/test/testmock/testhelpers.py
parent483e0bc9a34e6616c570c5a5fad2e2649d28796a (diff)
downloadcpython-9bef719feaf03d924286107269d959750d135012.tar.gz
unittest.mock.PropertyMock return value and attributes are now standard MagicMocks
Diffstat (limited to 'Lib/unittest/test/testmock/testhelpers.py')
-rw-r--r--Lib/unittest/test/testmock/testhelpers.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testhelpers.py b/Lib/unittest/test/testmock/testhelpers.py
index 3674778c6d..a2ed100307 100644
--- a/Lib/unittest/test/testmock/testhelpers.py
+++ b/Lib/unittest/test/testmock/testhelpers.py
@@ -831,5 +831,16 @@ class TestCallList(unittest.TestCase):
p.stop()
+ def test_propertymock_returnvalue(self):
+ m = MagicMock()
+ p = PropertyMock()
+ type(m).foo = p
+
+ returned = m.foo
+ p.assert_called_once_with()
+ self.assertIsInstance(returned, MagicMock)
+ self.assertNotIsInstance(returned, PropertyMock)
+
+
if __name__ == '__main__':
unittest.main()