Skip to content

Commit 65003c6

Browse files
committed
fix: for first review
1 parent 421a0fb commit 65003c6

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

library/unittest.mock-examples.po

+22-22
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"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"
1212
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -140,9 +140,9 @@ msgid ""
140140
"Instances are created by *calling the class*. This means you access the "
141141
"\"mock instance\" by looking at the return value of the mocked class."
142142
msgstr ""
143-
"一個常見的例子是 mock 被測試的程式碼實例化的類別。 當你 patch 一個類別時,該"
144-
"類別就會被替換為 mock。 實例是透過*呼叫類別*建立的。 這代表你可以透過查看被 "
145-
"mock 的類別的回傳值來存取「mock 實例」。"
143+
"一個常見的使用案例是在測試的時候 mock 被程式碼實例化的類別。當你 patch 一個類"
144+
"別時,該類別就會被替換為 mock。實例是透過\\ *呼叫類別*\\ 建立的。這代表你可以"
145+
"透過查看被 mock 的類別的回傳值來存取「mock 實例」。"
146146

147147
#: ../../library/unittest.mock-examples.rst:113
148148
msgid ""
@@ -153,8 +153,8 @@ msgid ""
153153
"return_value`. ::"
154154
msgstr ""
155155
"在下面的範例中,我們有一個函式 ``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` 來配置"
158158
"的。: ::"
159159

160160
#: ../../library/unittest.mock-examples.rst:130
@@ -167,8 +167,8 @@ msgid ""
167167
"the mock and can be helpful when the mock appears in test failure messages. "
168168
"The name is also propagated to attributes or methods of the mock:"
169169
msgstr ""
170-
"為你的 mock 命名可能會很有用。 這個名稱會顯示在 mock 的 repr 中,且當 mock 出"
171-
"現在測試的失敗訊息中時,名稱會很有幫助。 該名稱也會傳播到 mock 的屬性或方法:"
170+
"為你的 mock 命名可能會很有用。這個名稱會顯示在 mock 的 repr 中,且當 mock 出"
171+
"現在測試的失敗訊息中時,名稱會很有幫助。該名稱也會傳播到 mock 的屬性或方法:"
172172

173173
#: ../../library/unittest.mock-examples.rst:144
174174
msgid "Tracking all Calls"
@@ -190,7 +190,7 @@ msgid ""
190190
"well as asserting that the calls you expected have been made, you are also "
191191
"checking that they were made in the right order and with no additional calls:"
192192
msgstr ""
193-
"如果你對 ``mock_calls`` 做出斷言並且有任何不預期的方法被呼叫,則斷言將失敗。 "
193+
"如果你對 ``mock_calls`` 做出斷言並且有任何不預期的方法被呼叫,則斷言將失敗。"
194194
"這很有用,因為除了斷言你期望的呼叫已經進行之外,你還可以檢查它們是否按正確的"
195195
"順序進行,並且沒有多餘的呼叫:"
196196

@@ -206,8 +206,8 @@ msgid ""
206206
"it is not possible to track nested calls where the parameters used to create "
207207
"ancestors are important:"
208208
msgstr ""
209-
"然而,回傳 mock 的呼叫的參數不會被記錄,這代表著無法追蹤用於建立重要的上代的"
210-
"參數的巢狀呼叫:"
209+
"然而,回傳 mock 的呼叫的參數不會被記錄,這代表在巢狀呼叫中,無法追蹤用於建立"
210+
"上代的參數 important 的值:"
211211

212212
#: ../../library/unittest.mock-examples.rst:181
213213
msgid "Setting Return Values and Attributes"
@@ -236,8 +236,8 @@ msgid ""
236236
"to return a list, then we have to configure the result of the nested call."
237237
msgstr ""
238238
"有時你想要 mock 更複雜的情況,例如 ``mock.connection.cursor()."
239-
"execute(\"SELECT 1\")``。 如果我們希望此呼叫回傳一個串列,那麼我們就必須配置"
240-
"巢狀呼叫的結果。"
239+
"execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一個串列,那麼我們就必須配置巢"
240+
"狀呼叫的結果。"
241241

242242
#: ../../library/unittest.mock-examples.rst:214
243243
msgid ""
@@ -338,11 +338,11 @@ msgid ""
338338
"you refactor the first class, so that it no longer has ``some_method`` - "
339339
"then your tests will continue to pass even though your code is now broken!"
340340
msgstr ""
341-
"過度使用 mock 的一個問題是,它將你的測試與 mock 的實現結合在一起,而不是與真"
341+
"過度使用 mock 的一個問題是,它將你的測試與 mock 的實作結合在一起,而不是與真"
342342
"實的程式碼結合。假設你有一個實作 ``some_method`` 的類別,在另一個類別的測試"
343-
"中,你提供了一個 mock 的物件,其*也*提供了 ``some_method``。如果之後你重構第"
344-
"一個類別,使其不再具有 ``some_method`` - 那麼即使你的程式碼已經損壞,你的測試"
345-
"也將繼續通過!"
343+
"中,你提供了一個 mock 的物件,其\\ *也*\\ 提供了 ``some_method``。如果之後你"
344+
"重構第一個類別,使其不再具有 ``some_method`` - 那麼即使你的程式碼已經損壞,"
345+
"的測試也將繼續通過!"
346346

347347
#: ../../library/unittest.mock-examples.rst:331
348348
msgid ""
@@ -353,7 +353,7 @@ msgid ""
353353
"specification, then tests that use that class will start failing immediately "
354354
"without you having to instantiate the class in those tests."
355355
msgstr ""
356-
":class:`Mock` 允許你使用 *spec* 關鍵字引數提供一個物件作為 mock 的規格。 對 "
356+
":class:`Mock` 允許你使用 *spec* 關鍵字引數提供一個物件作為 mock 的規格。對 "
357357
"mock 存取規格物件上不存在的方法或屬性將立即引發一個屬性錯誤。如果你更改規格的"
358358
"實作,那麼使用該類別的測試將立即失敗,而無需在這些測試中實例化該類別。"
359359

@@ -385,7 +385,7 @@ msgstr ""
385385

386386
#: ../../library/unittest.mock-examples.rst:364
387387
msgid "Using side_effect to return per file content"
388-
msgstr "使用 side_effect 回傳每一個檔案內容"
388+
msgstr "使用 side_effect 回傳各別檔案內容"
389389

390390
#: ../../library/unittest.mock-examples.rst:366
391391
msgid ""
@@ -394,7 +394,7 @@ msgid ""
394394
"used to return different contents per file stored in a dictionary::"
395395
msgstr ""
396396
":func:`mock_open` 是用於 patch :func:`open` 方法。:attr:`~Mock.side_effect` "
397-
"可以用來在每次呼叫回傳一個新的 mock 物件。 這可以用於回傳儲存在字典中的每個檔"
397+
"可以用來在每次呼叫回傳一個新的 mock 物件。這可以用於回傳儲存在字典中的各別檔"
398398
"案的不同內容: ::"
399399

400400
#: ../../library/unittest.mock-examples.rst:389
@@ -435,7 +435,7 @@ msgid ""
435435
"to patch it with."
436436
msgstr ""
437437
"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` 和 :"
438-
"func:`patch.dict`。``patch`` 採用單一字串,格式為 ``package.module.Class."
438+
"func:`patch.dict`。``patch`` 接受單一字串,格式為 ``package.module.Class."
439439
"attribute``,用來指定要 patch 的屬性。同時它也可以接受你想要替換的屬性(或類"
440440
"別或其他)的值。``patch.object`` 接受一個物件和你想要 patch 的屬性的名稱,同"
441441
"時接受要 patch 的值。"
@@ -556,7 +556,7 @@ msgid ""
556556
"chained calls. Of course another alternative is writing your code in a more "
557557
"testable way in the first place..."
558558
msgstr ""
559-
"從這裡開始,只需一個簡單的步驟即可進行配置並對鍊接呼叫進行斷言。 當然,另一種"
559+
"從這裡開始,只需一個簡單的步驟即可進行配置並對鍊接呼叫進行斷言。當然,另一種"
560560
"選擇是先以更容易被測試的方式撰寫程式碼..."
561561

562562
#: ../../library/unittest.mock-examples.rst:549

0 commit comments

Comments
 (0)