diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-23 15:48:45 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-23 15:48:45 (GMT) |
commit | 88ba360c88c412c0fe5a75ca50cf11bba08e636b (patch) | |
tree | 5663f9b8330fd997b0c377c92f5718c03244d0e6 /Doc | |
parent | 4f4913b38bba5e01fc0e7a26f4840bf342365d3d (diff) | |
parent | ca647ef60aa74e3dea81a399ded20c648a69e742 (diff) | |
download | cpython-88ba360c88c412c0fe5a75ca50cf11bba08e636b.zip cpython-88ba360c88c412c0fe5a75ca50cf11bba08e636b.tar.gz cpython-88ba360c88c412c0fe5a75ca50cf11bba08e636b.tar.bz2 |
Issue #21750: Further fixup to be styled like other mock APIs.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/unittest.mock.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index f76c301..f31beea 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -2037,9 +2037,11 @@ mock_open :meth:`~io.IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to return. Calls to those methods will take data from *read_data* until it is depleted. The mock of these methods is pretty - simplistic. If you need more control over the data that you are feeding to - the tested code you will need to customize this mock for yourself. - *read_data* is an empty string by default. + simplistic: every time the *mock* is called, the *read_data* is rewound to + the start. If you need more control over the data that you are feeding to + the tested code you will need to customize this mock for yourself. When that + is insufficient, one of the in-memory filesystem packages on `PyPI + <https://pypi.python.org/pypi>`_ can offer a realistic filesystem for testing. Using :func:`open` as a context manager is a great way to ensure your file handles are closed properly and is becoming common:: |