8000 [po] auto sync · python/python-docs-zh-cn@8f0a5b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f0a5b6

Browse files
[po] auto sync
1 parent c25ace1 commit 8f0a5b6

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "80.42%", "updated_at": "2024-12-26T02:19:12Z"}
1+
{"translation": "80.42%", "updated_at": "2024-12-26T03:04:10Z"}

library/unittest.mock.po

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,6 +3222,8 @@ msgid ""
32223222
"The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather"
32233223
" than returning it on each call."
32243224
msgstr ""
3225+
"增加了对 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支持。 对 "
3226+
":meth:`~io.RawIOBase.read` 的模拟被改为消耗 *read_data* 而不是每次调用时返回它。"
32253227

32263228
#: ../../library/unittest.mock.rst:2543
32273229
msgid "*read_data* is now reset on each call to the *mock*."
@@ -3572,6 +3574,10 @@ msgid ""
35723574
"... thing.a = 33\n"
35733575
"..."
35743576
msgstr ""
3577+
">>> with patch('__main__.Something', autospec=True):\n"
3578+
"... thing = Something()\n"
3579+
"... thing.a = 33\n"
3580+
"..."
35753581

35763582
#: ../../library/unittest.mock.rst:2733
35773583
msgid ""
@@ -3646,6 +3652,17 @@ msgid ""
36463652
">>> mock.a\n"
36473653
"<NonCallableMagicMock name='Something.a' spec='int' id='...'>"
36483654
msgstr ""
3655+
">>> class Something:\n"
3656+
"... def __init__(self):\n"
3657+
"... self.a = 33\n"
3658+
"...\n"
3659+
">>> class SomethingForTest(Something):\n"
3660+
"... a = 33\n"
3661+
"...\n"
3662+
">>> p = patch('__main__.Something', autospec=SomethingForTest)\n"
3663+
">>> mock = p.start()\n"
3664+
">>> mock.a\n"
3665+
"<NonCallableMagicMock name='Something.a' spec='int' id='...'>"
36493666

36503667
#: ../../library/unittest.mock.rst:2793
36513668
msgid ""
@@ -3686,6 +3703,13 @@ msgid ""
36863703
">>> mock.submock.attribute2 # This will raise AttributeError.\n"
36873704
">>> mock.not_submock.attribute2 # This won't raise."
36883705
msgstr ""
3706+
">>> mock = Mock()\n"
3707+
">>> mock.submock.attribute1 = 2\n"
3708+
">>> mock.not_submock = mock.Mock(name=\"sample_name\")\n"
3709+
">>> seal(mock)\n"
3710+
">>> mock.new_attribute # 这将引发 AttributeError。\n"
3711+
">>> mock.submock.attribute2 # 这将引发 AttributeError。\n"
3712+
">>> mock.not_submock.attribute2 # 这不会引发异常。"
36893713

36903714
#: ../../library/unittest.mock.rst:2826
36913715
msgid ""

0 commit comments

Comments
 (0)
0