From 81ed61c49e4f5adf19b4f3aab026ffae5339b118 Mon Sep 17 00:00:00 2001 From: Payon Date: Fri, 3 Nov 2023 00:15:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?docs:=20=E7=BF=BB=E8=AD=AF=E8=87=B3rst:59?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/unittest.mock-examples.po | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index badb5f9e01..f705eafbc4 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-09-09 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:35+0000\n" +"PO-Revision-Date: 2023-11-03 00:14+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,42 +17,47 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.4\n" #: ../../library/unittest.mock-examples.rst:2 msgid ":mod:`unittest.mock` --- getting started" -msgstr "" +msgstr ":mod:`unittest.mock` --- 入門指南" #: ../../library/unittest.mock-examples.rst:27 msgid "Using Mock" -msgstr "" +msgstr "使用 Mock 的方式" #: ../../library/unittest.mock-examples.rst:30 msgid "Mock Patching Methods" -msgstr "" +msgstr "使用 Mock 來 patching methods(方法)" #: ../../library/unittest.mock-examples.rst:32 msgid "Common uses for :class:`Mock` objects include:" -msgstr "" +msgstr ":class:`Mock` 物件的常見用法包含:" #: ../../library/unittest.mock-examples.rst:34 msgid "Patching methods" -msgstr "" +msgstr "Patching 方法" #: ../../library/unittest.mock-examples.rst:35 msgid "Recording method calls on objects" -msgstr "" +msgstr "記錄在物件上的方法呼叫" #: ../../library/unittest.mock-examples.rst:37 msgid "" "You might want to replace a method on an object to check that it is called " "with the correct arguments by another part of the system:" msgstr "" +"你可能會想要取代一個物件上的方法,以便檢查系統的另一部分是否使用正確的引數呼" +"叫它:" #: ../../library/unittest.mock-examples.rst:45 msgid "" "Once our mock has been used (``real.method`` in this example) it has methods " "and attributes that allow you to make assertions about how it has been used." msgstr "" +"一旦我們的 mock 已經被使用(例如在這個範例中的 ``real.method``),它就有了方" +"法和屬性,允許你對其使用方式進行 assertions (斷言)。" #: ../../library/unittest.mock-examples.rst:50 msgid "" @@ -60,6 +65,8 @@ msgid "" "are interchangeable. As the ``MagicMock`` is the more capable class it makes " "a sensible one to use by default." msgstr "" +"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock` class(類別)是可以互換" +"的。不過由於 ``MagicMock`` 是功能更強大的類別,因此通常它是一個更好的選擇。" #: ../../library/unittest.mock-examples.rst:54 msgid "" @@ -68,12 +75,17 @@ msgid "" "or :meth:`~Mock.assert_called_once_with` method to check that it was called " "with the correct arguments." msgstr "" +"一旦 mock 被呼叫,它的 :attr:`~Mock.called` 屬性將被設定為 ``True``。更重要的" +"是,我們可以使用 :meth:`~Mock.assert_called_with` 或 :meth:`~Mock." +"assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼叫。" #: ../../library/unittest.mock-examples.rst:59 msgid "" "This example tests that calling ``ProductionClass().method`` results in a " "call to the ``something`` method:" msgstr "" +"這個範例測試呼叫 ``ProductionClass().method`` 是否導致對 ``something`` 方法的" +"呼叫:" #: ../../library/unittest.mock-examples.rst:76 msgid "Mock for Method Calls on an Object" From 27ff3e84cebf4b15d15d61b14167478786973eb4 Mon Sep 17 00:00:00 2001 From: Payon Date: Sun, 12 Nov 2023 22:08:23 +0800 Subject: [PATCH 2/4] =?UTF-8?q?docs:=20=E7=BF=BB=E8=AD=AF=E8=87=B3rst:99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/unittest.mock-examples.po | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index f705eafbc4..0d51c401e6 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-09-09 00:03+0000\n" -"PO-Revision-Date: 2023-11-03 00:14+0800\n" +"PO-Revision-Date: 2023-11-12 22:06+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -89,7 +89,7 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:76 msgid "Mock for Method Calls on an Object" -msgstr "" +msgstr "在物件上的方法呼叫時使用 mock" #: ../../library/unittest.mock-examples.rst:78 msgid "" @@ -98,18 +98,25 @@ msgid "" "method (or some part of the system under test) and then check that it is " "used in the correct way." msgstr "" +"在上一個範例中,我們直接對物件上的方法進行 patch,以檢查它是否被正確呼叫。另" +"一個常見的用法是將一個物件傳遞給一個方法(或測試系統的某一部分),然後檢查它" +"是否以正確的方式被使用。" #: ../../library/unittest.mock-examples.rst:83 msgid "" "The simple ``ProductionClass`` below has a ``closer`` method. If it is " "called with an object then it calls ``close`` on it." msgstr "" +"下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件" +"呼叫,它就會呼叫此物件中的 ``close`` 。" #: ../../library/unittest.mock-examples.rst:91 msgid "" "So to test it we need to pass in an object with a ``close`` method and check " "that it was called correctly." msgstr "" +"因此,為了對此進行測試,我們需要傳遞一個具有 ``close`` 方法的物件,並檢查它是" +"否被正確的呼叫。" #: ../../library/unittest.mock-examples.rst:99 msgid "" @@ -118,6 +125,9 @@ msgid "" "accessing it in the test will create it, but :meth:`~Mock." "assert_called_with` will raise a failure exception." msgstr "" +"我們不必為我們的 mock 提供 'close' 方法。存取 close 會建立它。因此,如果 " +"'close' 並未被呼叫過,在測試流程中存取 'close' 就會建立它,但 :meth:`~Mock." +"assert_called_with` 就會引發一個失敗的例外。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" From 3c581d0c6f8fcfdd87b2d8f89f7055ed7df6d42b Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 21 Nov 2023 22:16:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E6=A0=B9=E6=93=9Acomment=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/unittest.mock-examples.po | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 0d51c401e6..a52a2a3a49 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-09-09 00:03+0000\n" -"PO-Revision-Date: 2023-11-12 22:06+0800\n" +"PO-Revision-Date: 2023-11-21 22:16+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -29,7 +29,7 @@ msgstr "使用 Mock 的方式" #: ../../library/unittest.mock-examples.rst:30 msgid "Mock Patching Methods" -msgstr "使用 Mock 來 patching methods(方法)" +msgstr "使用 Mock 來 patching methods 方法" #: ../../library/unittest.mock-examples.rst:32 msgid "Common uses for :class:`Mock` objects include:" @@ -56,8 +56,8 @@ msgid "" "Once our mock has been used (``real.method`` in this example) it has methods " "and attributes that allow you to make assertions about how it has been used." msgstr "" -"一旦我們的 mock 已經被使用(例如在這個範例中的 ``real.method``),它就有了方" -"法和屬性,允許你對其使用方式進行 assertions (斷言)。" +"一旦我們的 mock 已經被使用(例如在這個範例中的 ``real.method``\\ ),它就有了" +"方法和屬性,允許你對其使用方式進行斷言 (assertions)。" #: ../../library/unittest.mock-examples.rst:50 msgid "" @@ -65,8 +65,8 @@ msgid "" "are interchangeable. As the ``MagicMock`` is the more capable class it makes " "a sensible one to use by default." msgstr "" -"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock` class(類別)是可以互換" -"的。不過由於 ``MagicMock`` 是功能更強大的類別,因此通常它是一個更好的選擇。" +"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock` 類別是可以互換的。不過" +"由於 ``MagicMock`` 是功能更強大的類別,因此通常它是一個更好的選擇。" #: ../../library/unittest.mock-examples.rst:54 msgid "" @@ -89,7 +89,7 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:76 msgid "Mock for Method Calls on an Object" -msgstr "在物件上的方法呼叫時使用 mock" +msgstr "對物件的方法呼叫使用 mock" #: ../../library/unittest.mock-examples.rst:78 msgid "" @@ -99,7 +99,7 @@ msgid "" "used in the correct way." msgstr "" "在上一個範例中,我們直接對物件上的方法進行 patch,以檢查它是否被正確呼叫。另" -"一個常見的用法是將一個物件傳遞給一個方法(或測試系統的某一部分),然後檢查它" +"一個常見的用法是將一個物件傳遞給一個方法(或受測系統的某一部分),然後檢查它" "是否以正確的方式被使用。" #: ../../library/unittest.mock-examples.rst:83 @@ -107,8 +107,8 @@ msgid "" "The simple ``ProductionClass`` below has a ``closer`` method. If it is " "called with an object then it calls ``close`` on it." msgstr "" -"下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件" -"呼叫,它就會呼叫此物件中的 ``close`` 。" +"下面是一個單純的 ``ProductionClass``,含有一個 ``closer`` 方法。如果它被傳入" +"一個物件,它就會呼叫此物件中的 ``close``。" #: ../../library/unittest.mock-examples.rst:91 msgid "" @@ -125,9 +125,9 @@ msgid "" "accessing it in the test will create it, but :meth:`~Mock." "assert_called_with` will raise a failure exception." msgstr "" -"我們不必為我們的 mock 提供 'close' 方法。存取 close 會建立它。因此,如果 " -"'close' 並未被呼叫過,在測試流程中存取 'close' 就會建立它,但 :meth:`~Mock." -"assert_called_with` 就會引發一個失敗的例外。" +"我們不必做任何額外的事情來為 mock 提供 'close' 方法,存取 close 會建立它。因" +"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它,但 :meth:" +"`~Mock.assert_called_with` 就會引發一個失敗的例外。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" From 9f81b297cbe0ba18eed8b6608cae0b0146a0bf5e Mon Sep 17 00:00:00 2001 From: Payon Date: Wed, 22 Nov 2023 23:21:07 +0800 Subject: [PATCH 4/4] Update library/unittest.mock-examples.po Co-authored-by: mindihx --- library/unittest.mock-examples.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index a52a2a3a49..d0479ae448 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -29,7 +29,7 @@ msgstr "使用 Mock 的方式" #: ../../library/unittest.mock-examples.rst:30 msgid "Mock Patching Methods" -msgstr "使用 Mock 來 patching methods 方法" +msgstr "使用 Mock 來 patching 方法" #: ../../library/unittest.mock-examples.rst:32 msgid "Common uses for :class:`Mock` objects include:"