summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorMario Corchero <mariocj89@gmail.com>2018-10-19 21:57:37 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-10-19 21:57:37 (GMT)
commit96200eb2ffcda05de14099cf23f60d5091366e3e (patch)
tree7291dfed16ede85b754e6c7ca28df4cadb5145cc /Lib/unittest
parent5a30620e68ebb911eef4d583de3776d782148637 (diff)
downloadcpython-96200eb2ffcda05de14099cf23f60d5091366e3e.zip
cpython-96200eb2ffcda05de14099cf23f60d5091366e3e.tar.gz
cpython-96200eb2ffcda05de14099cf23f60d5091366e3e.tar.bz2
unittest.mock doc: Fix references to recursive seal of Mocks (GH-9028)
The docs in `library/unittest.mock` have been updated to remove confusing terms about submock and be explicit about the behavior expected.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/mock.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 83026e6..6b7f293 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2425,15 +2425,14 @@ class PropertyMock(Mock):
def seal(mock):
- """Disable the automatic generation of "submocks"
+ """Disable the automatic generation of child mocks.
Given an input Mock, seals it to ensure no further mocks will be generated
when accessing an attribute that was not already defined.
- Submocks are defined as all mocks which were created DIRECTLY from the
- parent. If a mock is assigned to an attribute of an existing mock,
- it is not considered a submock.
-
+ The operation recursively seals the mock passed in, meaning that
+ the mock itself, any mocks generated by accessing one of its attributes,
+ and all assigned mocks without a name or spec will be sealed.
"""
mock._mock_sealed = True
for attr in dir(mock):