From 39cebae0010db75299b6263501d2d3734753302c Mon Sep 17 00:00:00 2001 From: Shardul Deshpande Date: Sat, 13 Jun 2026 20:34:01 +0530 Subject: [PATCH] Fix documented default of read_data in unittest.mock.mock_open The documented signature showed read_data=None, but the actual default is the empty string -- Lib/unittest/mock.py, the function's docstring, and inspect.signature all agree. The code default changed from None to '' in 2012 (0dccf657b51); the docs were never updated. --- Doc/library/unittest.mock.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst index 6ba1b87ea942a90..5e28a8ada595ef1 100644 --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -2539,7 +2539,7 @@ Alternatively you can just use ``vars(my_mock)`` (instance members) and mock_open ~~~~~~~~~ -.. function:: mock_open(mock=None, read_data=None) +.. function:: mock_open(mock=None, read_data='') A helper function to create a mock to replace the use of :func:`open`. It works for :func:`open` called directly or used as a context manager.