summaryrefslogtreecommitdiff
path: root/docs/mock.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/mock.txt')
-rw-r--r--docs/mock.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/mock.txt b/docs/mock.txt
index 432f5a9..e5dcd60 100644
--- a/docs/mock.txt
+++ b/docs/mock.txt
@@ -602,6 +602,19 @@ have to create a dictionary and unpack it using `**`:
>>> mock_foo.mock_calls
[call(), call(6)]
+Because of the way mock attributes are stored you can't directly attach a
+`PropertyMock` to a mock object. Instead you can attach it to the mock type
+object:
+
+.. doctest::
+
+ >>> m = MagicMock()
+ >>> p = PropertyMock(return_value=3)
+ >>> type(m).foo = p
+ >>> m.foo
+ 3
+ >>> p.assert_called_once_with()
+
.. index:: __call__
.. index:: calling