@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version :Python 3.12\n "
9
9
"Report-Msgid-Bugs-To :\n "
10
10
"POT-Creation-Date :2023-09-09 00:03+0000\n "
11
- "PO-Revision-Date :2023-11-03 00:14 +0800\n "
11
+ "PO-Revision-Date :2023-11-12 22:06 +0800\n "
12
12
"Last-Translator :Liang-Bo Wang <me@liang2.tw>\n "
13
13
"Language-Team :Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -89,7 +89,7 @@ msgstr ""
89
89
90
90
#: ../../library/unittest.mock-examples.rst:76
91
91
msgid "Mock for Method Calls on an Object"
92
- msgstr ""
92
+ msgstr "在物件上的方法呼叫時使用 mock "
93
93
94
94
#: ../../library/unittest.mock-examples.rst:78
95
95
msgid ""
@@ -98,18 +98,25 @@ msgid ""
98
98
"method (or some part of the system under test) and then check that it is "
99
99
"used in the correct way."
100
100
msgstr ""
101
+ "在上一個範例中,我們直接對物件上的方法進行 patch,以檢查它是否被正確呼叫。另"
102
+ "一個常見的用法是將一個物件傳遞給一個方法(或測試系統的某一部分),然後檢查它"
103
+ "是否以正確的方式被使用。"
101
104
102
105
#: ../../library/unittest.mock-examples.rst:83
103
106
msgid ""
104
107
"The simple ``ProductionClass`` below has a ``closer`` method. If it is "
105
108
"called with an object then it calls ``close`` on it."
106
109
msgstr ""
110
+ "下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件"
111
+ "呼叫,它就會呼叫此物件中的 ``close`` 。"
107
112
108
113
#: ../../library/unittest.mock-examples.rst:91
109
114
msgid ""
110
115
"So to test it we need to pass in an object with a ``close`` method and check "
111
116
"that it was called correctly."
112
117
msgstr ""
118
+ "因此,為了對此進行測試,我們需要傳遞一個具有 ``close`` 方法的物件,並檢查它是"
119
+ "否被正確的呼叫。"
113
120
114
121
#: ../../library/unittest.mock-examples.rst:99
115
122
msgid ""
@@ -118,6 +125,9 @@ msgid ""
118
125
"accessing it in the test will create it, but :meth:`~Mock."
119
126
"assert_called_with` will raise a failure exception."
120
127
msgstr ""
128
+ "我們不必為我們的 mock 提供 'close' 方法。存取 close 會建立它。因此,如果 "
129
+ "'close' 並未被呼叫過,在測試流程中存取 'close' 就會建立它,但 :meth:`~Mock."
130
+ "assert_called_with` 就會引發一個失敗的例外。"
121
131
122
132
#: ../../library/unittest.mock-examples.rst:106
123
133
msgid "Mocking Classes"