@@ -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 : 2024-01-22 21:50 +0800\n "
11
+ "PO-Revision-Date : 2024-01-23 18:41 +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 "
@@ -140,9 +140,9 @@ msgid ""
140
140
"Instances are created by *calling the class*. This means you access the "
141
141
"\" mock instance\" by looking at the return value of the mocked class."
142
142
msgstr ""
143
- "一個常見的例子是 mock 被測試的程式碼實例化的類別。 當你 patch 一個類別時,該 "
144
- "類別就會被替換為 mock。 實例是透過*呼叫類別*建立的。 這代表你可以透過查看被 "
145
- "mock 的類別的回傳值來存取「mock 實例」。"
143
+ "一個常見的使用案例是在測試的時候 mock 被程式碼實例化的類別。 當你 patch 一個類 "
144
+ "別時,該類別就會被替換為 mock。實例是透過\\ *呼叫類別*\\ 建立的。這代表你可以 "
145
+ "透過查看被 mock 的類別的回傳值來存取「mock 實例」。"
146
146
147
147
#: ../../library/unittest.mock-examples.rst:113
148
148
msgid ""
@@ -153,8 +153,8 @@ msgid ""
153
153
"return_value`. ::"
154
154
msgstr ""
155
155
"在下面的範例中,我們有一個函式 ``some_function``,它實例化 ``Foo`` 並呼叫它的"
156
- "方法。 對 :func:`patch` 的呼叫將類別 ``Foo`` 替換為一個 mock。``Foo`` 實例是 "
157
- "呼叫 mock 的結果,因此它是透過修改 mock :attr:`~Mock.return_value` 來配置"
156
+ "方法。對 :func:`patch` 的呼叫將類別 ``Foo`` 替換為一個 mock。``Foo`` 實例是呼 "
157
+ "叫 mock 的結果,因此它是透過修改 mock :attr:`~Mock.return_value` 來配置"
158
158
"的。: ::"
159
159
160
160
#: ../../library/unittest.mock-examples.rst:130
@@ -167,8 +167,8 @@ msgid ""
167
167
"the mock and can be helpful when the mock appears in test failure messages. "
168
168
"The name is also propagated to attributes or methods of the mock:"
169
169
msgstr ""
170
- "為你的 mock 命名可能會很有用。 這個名稱會顯示在 mock 的 repr 中,且當 mock 出"
171
- "現在測試的失敗訊息中時,名稱會很有幫助。 該名稱也會傳播到 mock 的屬性或方法:"
170
+ "為你的 mock 命名可能會很有用。這個名稱會顯示在 mock 的 repr 中,且當 mock 出"
171
+ "現在測試的失敗訊息中時,名稱會很有幫助。該名稱也會傳播到 mock 的屬性或方法:"
172
172
173
173
#: ../../library/unittest.mock-examples.rst:144
174
174
msgid "Tracking all Calls"
@@ -190,7 +190,7 @@ msgid ""
190
190
"well as asserting that the calls you expected have been made, you are also "
191
191
"checking that they were made in the right order and with no additional calls:"
192
192
msgstr ""
193
- "如果你對 ``mock_calls`` 做出斷言並且有任何不預期的方法被呼叫,則斷言將失敗。 "
193
+ "如果你對 ``mock_calls`` 做出斷言並且有任何不預期的方法被呼叫,則斷言將失敗。"
194
194
"這很有用,因為除了斷言你期望的呼叫已經進行之外,你還可以檢查它們是否按正確的"
195
195
"順序進行,並且沒有多餘的呼叫:"
196
196
@@ -206,8 +206,8 @@ msgid ""
206
206
"it is not possible to track nested calls where the parameters used to create "
207
207
"ancestors are important:"
208
208
msgstr ""
209
- "然而,回傳 mock 的呼叫的參數不會被記錄,這代表著無法追蹤用於建立重要的上代的 "
210
- "參數的巢狀呼叫 :"
209
+ "然而,回傳 mock 的呼叫的參數不會被記錄,這代表在巢狀呼叫中,無法追蹤用於建立 "
210
+ "上代的參數 important 的值 :"
211
211
212
212
#: ../../library/unittest.mock-examples.rst:181
213
213
msgid "Setting Return Values and Attributes"
@@ -236,8 +236,8 @@ msgid ""
236
236
"to return a list, then we have to configure the result of the nested call."
237
237
msgstr ""
238
238
"有時你想要 mock 更複雜的情況,例如 ``mock.connection.cursor()."
239
- "execute(\" SELECT 1\" )``。 如果我們希望此呼叫回傳一個串列,那麼我們就必須配置 "
240
- "巢狀呼叫的結果 。"
239
+ "execute(\" SELECT 1\" )``。如果我們希望此呼叫回傳一個串列,那麼我們就必須配置巢 "
240
+ "狀呼叫的結果 。"
241
241
242
242
#: ../../library/unittest.mock-examples.rst:214
243
243
msgid ""
@@ -338,11 +338,11 @@ msgid ""
338
338
"you refactor the first class, so that it no longer has ``some_method`` - "
339
339
"then your tests will continue to pass even though your code is now broken!"
340
340
msgstr ""
341
- "過度使用 mock 的一個問題是,它將你的測試與 mock 的實現結合在一起 ,而不是與真"
341
+ "過度使用 mock 的一個問題是,它將你的測試與 mock 的實作結合在一起 ,而不是與真"
342
342
"實的程式碼結合。假設你有一個實作 ``some_method`` 的類別,在另一個類別的測試"
343
- "中,你提供了一個 mock 的物件,其*也*提供了 ``some_method``。如果之後你重構第 "
344
- "一個類別 ,使其不再具有 ``some_method`` - 那麼即使你的程式碼已經損壞,你的測試 "
345
- "也將繼續通過 !"
343
+ "中,你提供了一個 mock 的物件,其\\ *也*\\ 提供了 ``some_method``。如果之後你 "
344
+ "重構第一個類別 ,使其不再具有 ``some_method`` - 那麼即使你的程式碼已經損壞,你 "
345
+ "的測試也將繼續通過 !"
346
346
347
347
#: ../../library/unittest.mock-examples.rst:331
348
348
msgid ""
@@ -353,7 +353,7 @@ msgid ""
353
353
"specification, then tests that use that class will start failing immediately "
354
354
"without you having to instantiate the class in those tests."
355
355
msgstr ""
356
- ":class:`Mock` 允許你使用 *spec* 關鍵字引數提供一個物件作為 mock 的規格。 對 "
356
+ ":class:`Mock` 允許你使用 *spec* 關鍵字引數提供一個物件作為 mock 的規格。對 "
357
357
"mock 存取規格物件上不存在的方法或屬性將立即引發一個屬性錯誤。如果你更改規格的"
358
358
"實作,那麼使用該類別的測試將立即失敗,而無需在這些測試中實例化該類別。"
359
359
@@ -385,7 +385,7 @@ msgstr ""
385
385
386
386
#: ../../library/unittest.mock-examples.rst:364
387
387
msgid "Using side_effect to return per file content"
388
- msgstr "使用 side_effect 回傳每一個檔案內容 "
388
+ msgstr "使用 side_effect 回傳各別檔案內容 "
389
389
390
390
#: ../../library/unittest.mock-examples.rst:366
391
391
msgid ""
@@ -394,7 +394,7 @@ msgid ""
394
394
"used to return different contents per file stored in a dictionary::"
395
395
msgstr ""
396
396
":func:`mock_open` 是用於 patch :func:`open` 方法。:attr:`~Mock.side_effect` "
397
- "可以用來在每次呼叫回傳一個新的 mock 物件。 這可以用於回傳儲存在字典中的每個檔 "
397
+ "可以用來在每次呼叫回傳一個新的 mock 物件。這可以用於回傳儲存在字典中的各別檔 "
398
398
"案的不同內容: ::"
399
399
400
400
#: ../../library/unittest.mock-examples.rst:389
@@ -435,7 +435,7 @@ msgid ""
435
435
"to patch it with."
436
436
msgstr ""
437
437
"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` 和 :"
438
- "func:`patch.dict`。``patch`` 採用單一字串 ,格式為 ``package.module.Class."
438
+ "func:`patch.dict`。``patch`` 接受單一字串 ,格式為 ``package.module.Class."
439
439
"attribute``,用來指定要 patch 的屬性。同時它也可以接受你想要替換的屬性(或類"
440
440
"別或其他)的值。``patch.object`` 接受一個物件和你想要 patch 的屬性的名稱,同"
441
441
"時接受要 patch 的值。"
@@ -556,7 +556,7 @@ msgid ""
556
556
"chained calls. Of course another alternative is writing your code in a more "
557
557
"testable way in the first place..."
558
558
msgstr ""
559
- "從這裡開始,只需一個簡單的步驟即可進行配置並對鍊接呼叫進行斷言。 當然,另一種"
559
+ "從這裡開始,只需一個簡單的步驟即可進行配置並對鍊接呼叫進行斷言。當然,另一種"
560
560
"選擇是先以更容易被測試的方式撰寫程式碼..."
561
561
562
562
#: ../../library/unittest.mock-examples.rst:549
0 commit comments