Skip to content

Commit 71c603d

Browse files
committed
feat: to rst:1828
1 parent e6ef3ad commit 71c603d

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

library/unittest.mock.po

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: Python 3.12\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2023-12-16 00:03+0000\n"
10-
"PO-Revision-Date: 2024-01-20 00:30+0800\n"
10+
"PO-Revision-Date: 2024-01-20 22:16+0800\n"
1111
"Last-Translator: Adrian Liaw <[email protected]>\n"
1212
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1313
"tw)\n"
@@ -130,8 +130,8 @@ msgid ""
130130
"decorators are applied). This means from the bottom up, so in the example "
131131
"above the mock for ``module.ClassName1`` is passed in first."
132132
msgstr ""
133-
"當你嵌套 patch 裝飾器時,mock 會以被應用的順序傳遞到裝飾函數(裝飾器應用的正"
134-
" *Python* 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module."
133+
"當你巢狀使用 patch 裝飾器時,mock 會以被應用的順序傳遞到裝飾函數(裝飾器應用"
134+
"的正常 *Python* 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module."
135135
"ClassName1`` 的 mock 會先被傳入。"
136136

137137
#: ../../library/unittest.mock.rst:122
@@ -722,7 +722,7 @@ msgid ""
722722
"made, the parameters of ancestor calls are not recorded and so will always "
723723
"compare equal:"
724724
msgstr ""
725-
":attr:`mock_calls` 記錄的方式意味著在進行嵌套呼叫時,上代 (ancestor) 呼叫的參"
725+
":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參"
726726
"數不會被記錄,因此在比較時它們將始終相等:"
727727

728728
#: ../../library/unittest.mock.rst:737
@@ -1611,7 +1611,7 @@ msgid ""
16111611
"details about how to change the value of see :ref:`test-prefix`."
16121612
msgstr ""
16131613
"如果你想在測試中使用不同的前綴,你可以透過設定 ``patch.TEST_PREFIX`` 來告知 "
1614-
"patch 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內"
1614+
"patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內"
16151615
"容。"
16161616

16171617
#: ../../library/unittest.mock.rst:1628
@@ -1705,8 +1705,8 @@ msgid ""
17051705
"put arguments passed by keyword *after* any of the standard arguments "
17061706
"created by :func:`patch`::"
17071707
msgstr ""
1708-
":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器嵌套,但需要將透過關鍵字傳"
1709-
"遞的引數放在 :func:`patch` 建立的任何標準引數/ *之後*/ : ::"
1708+
":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵"
1709+
"字傳遞的引數放在 :func:`patch` 建立的任何標準引數/ *之後*/ : ::"
17101710

17111711
#: ../../library/unittest.mock.rst:1739
17121712
msgid ""
@@ -1727,6 +1727,9 @@ msgid ""
17271727
"simpler to do patching in ``setUp`` methods or where you want to do multiple "
17281728
"patches without nesting decorators or with statements."
17291729
msgstr ""
1730+
"所有的 patcher 都有 :meth:`start` 與 :meth:`stop` 方法。這使得在 ``setUp`` 方"
1731+
"法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多個 "
1732+
"patch 時變得更簡單。"
17301733

17311734
#: ../../library/unittest.mock.rst:1759
17321735
msgid ""
@@ -1735,18 +1738,25 @@ msgid ""
17351738
"then call :meth:`start` to put the patch in place and :meth:`stop` to undo "
17361739
"it."
17371740
msgstr ""
1741+
"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:"
1742+
"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:"
1743+
"`start` 將 patch 準備就緒,並呼叫 :meth:`stop` 來取消 patch。"
17381744

17391745
#: ../../library/unittest.mock.rst:1763
17401746
msgid ""
17411747
"If you are using :func:`patch` to create a mock for you then it will be "
17421748
"returned by the call to ``patcher.start``. ::"
17431749
msgstr ""
1750+
"如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回"
1751+
"傳。: ::"
17441752

17451753
#: ../../library/unittest.mock.rst:1777
17461754
msgid ""
17471755
"A typical use case for this might be for doing multiple patches in the "
17481756
"``setUp`` method of a :class:`TestCase`::"
17491757
msgstr ""
1758+
"一個典型的用法是在一個 :class:`TestCase` 的 ``setUp`` 方法中執行多個 "
1759+
"patch: ::"
17501760

17511761
#: ../../library/unittest.mock.rst:1799
17521762
msgid ""
@@ -1755,26 +1765,29 @@ msgid ""
17551765
"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:"
17561766
"`unittest.TestCase.addCleanup` makes this easier::"
17571767
msgstr ""
1768+
"如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比"
1769+
"你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就"
1770+
"不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::"
17581771

17591772
#: ../../library/unittest.mock.rst:1814
17601773
msgid ""
17611774
"As an added bonus you no longer need to keep a reference to the ``patcher`` "
17621775
"object."
1763-
msgstr ""
1776+
msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。"
17641777

17651778
#: ../../library/unittest.mock.rst:1817
17661779
msgid ""
17671780
"It is also possible to stop all patches which have been started by using :"
17681781
"func:`patch.stopall`."
1769-
msgstr ""
1782+
msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。"
17701783

17711784
#: ../../library/unittest.mock.rst:1822
17721785
msgid "Stop all active patches. Only stops patches started with ``start``."
1773-
msgstr ""
1786+
msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。"
17741787

17751788
#: ../../library/unittest.mock.rst:1828
17761789
msgid "patch builtins"
1777-
msgstr ""
1790+
msgstr "patch 內建函式"
17781791

17791792
#: ../../library/unittest.mock.rst:1829
17801793
msgid ""

0 commit comments

Comments
 (0)