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.
This commit is contained in:
Mario Corchero 2018-10-19 22:57:37 +01:00 committed by Victor Stinner
parent 5a30620e68
commit 96200eb2ff
2 changed files with 9 additions and 9 deletions

View file

@ -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):