From cf7e337c4fcb14665f71c04de70d7ceabdba6a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Tue, 15 Aug 2023 16:51:17 +0800 Subject: [PATCH 01/12] =?UTF-8?q?docs(translate-mock):=20mock=20page?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻譯rst:17與rst:21 可能需討論部分譯名(例如stub) --- library/unittest.mock.po | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 7a74c0c444..3a24a563d3 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2018-05-23 16:14+0000\n" +"PO-Revision-Date: 2023-08-15 16:47+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,6 +17,7 @@ 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.3.2\n" #: ../../library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" @@ -32,6 +33,8 @@ msgid "" "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" +":mod:`unittest.mock` 在Python中是一個用於進行測試的函式庫。 它允許你用模擬對" +"象 (mock object) 在測試中替換部分系統,並斷言 (assert) 它們是如何被使用的。" #: ../../library/unittest.mock.rst:21 msgid "" @@ -41,6 +44,10 @@ msgid "" "and arguments they were called with. You can also specify return values and " "set needed attributes in the normal way." msgstr "" +":mod:`unittest.mock` 提供了一個以 :class:`mock` 為核心的類別,去除在測試中創" +"建大量 stubs 的需求。 在執行動作之後,你可以斷言 (assert) 哪些 method (方" +"法)/ 屬性被使用,以及哪些參數被呼叫。 你還可以用常規的方式指定回傳值與設定所" +"需的屬性。" #: ../../library/unittest.mock.rst:27 msgid "" From 5d81da20e8f60f6a20e3acb6066b4702893be5de Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 15 Aug 2023 23:13:21 +0800 Subject: [PATCH 02/12] docs: mock translate translate from rst:27 to rst:42 --- library/unittest.mock.po | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 3a24a563d3..7053526b85 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-15 16:47+0800\n" +"PO-Revision-Date: 2023-08-15 22:19+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -57,6 +57,10 @@ msgid "" "some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" "`patch`." msgstr "" +"此外,mock 還提供了一個 :func:`patch` 裝飾器,用於處理修改測試範圍內對 module" +"(模組)以及 class(類別)等級的屬性,以及用於創建唯一對象的 :const:" +"`sentinel` 。有關如何使用 :class:`Mock`、:class:`MagicMock` 和 :func:`patch` " +"的一些示例,請參閱 `quick guide`_。" #: ../../library/unittest.mock.rst:33 msgid "" @@ -64,16 +68,21 @@ msgid "" "assertion' pattern instead of 'record -> replay' used by many mocking " "frameworks." msgstr "" +"Mock 被設計用於與 :mod:`unittest` 一起使用,並且基於“action(操作) -> " +"assertion(斷言)”模式,而不是許多模擬框架使用的“record(記錄) -> replay(重" +"播)”模式。" #: ../../library/unittest.mock.rst:37 msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "available as `mock on PyPI `_." msgstr "" +"對於早期版本的 Python,有一個backport(向後移植的) :mod:`unittest.mock` 可以" +"使用,`從 Pypi 下載 mock`_。" #: ../../library/unittest.mock.rst:42 msgid "Quick Guide" -msgstr "" +msgstr "快速指南" #: ../../library/unittest.mock.rst:60 msgid "" From 45fb0e27c4263c751a8e498ab139926c8c0ad44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Wed, 16 Aug 2023 16:56:02 +0800 Subject: [PATCH 03/12] =?UTF-8?q?docs(translate-mock):=20mock=20page?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻譯rst:60 --- library/unittest.mock.po | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 7053526b85..a011d39620 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-15 22:19+0800\n" +"PO-Revision-Date: 2023-08-16 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -91,6 +91,9 @@ msgid "" "can configure them, to specify return values or limit what attributes are " "available, and then make assertions about how they have been used:" msgstr "" +":class:`Mock` 和 :class:`MagicMock` 物件在你存取它們時創建所有屬性和method" +"(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定返回值或限制" +"可用的屬性,然後對它們的使用方式做出斷言:" #: ../../library/unittest.mock.rst:72 msgid "" From e7d0f73c620fc1775cb7c977a14863b4e79bd075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Tue, 22 Aug 2023 14:27:30 +0800 Subject: [PATCH 04/12] =?UTF-8?q?docs(translate-mock):=20mock=20page?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻譯rst:72至rst:201 --- library/unittest.mock.po | 78 +++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 25 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index a011d39620..7cb4461540 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-16 16:55+0800\n" +"PO-Revision-Date: 2023-08-22 14:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -21,7 +21,7 @@ msgstr "" #: ../../library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" -msgstr "" +msgstr ":mod:`unittest.mock` — 模擬物件函式庫" #: ../../library/unittest.mock.rst:13 msgid "**Source code:** :source:`Lib/unittest/mock.py`" @@ -33,8 +33,8 @@ msgid "" "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" -":mod:`unittest.mock` 在Python中是一個用於進行測試的函式庫。 它允許你用模擬對" -"象 (mock object) 在測試中替換部分系統,並斷言 (assert) 它們是如何被使用的。" +":mod:`unittest.mock`\\ 在Python中是一個用於進行測試的函式庫。 它允許你用模擬" +"物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" #: ../../library/unittest.mock.rst:21 msgid "" @@ -44,10 +44,10 @@ msgid "" "and arguments they were called with. You can also specify return values and " "set needed attributes in the normal way." msgstr "" -":mod:`unittest.mock` 提供了一個以 :class:`mock` 為核心的類別,去除在測試中創" -"建大量 stubs 的需求。 在執行動作之後,你可以斷言 (assert) 哪些 method (方" -"法)/ 屬性被使用,以及哪些參數被呼叫。 你還可以用常規的方式指定回傳值與設定所" -"需的屬性。" +":mod:`unittest.mock`\\ 提供了一個以\\ :class:`Mock`\\ 為核心的類別,去除在測" +"試中建立大量 stubs 的需求。 在執行動作之後,你可以判定哪些 method (方法)/" +"屬性被使用,以及有哪些引數被呼叫。 你還可以用常規的方式指定回傳值與設定所需的" +"屬性。" #: ../../library/unittest.mock.rst:27 msgid "" @@ -57,10 +57,10 @@ msgid "" "some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" "`patch`." msgstr "" -"此外,mock 還提供了一個 :func:`patch` 裝飾器,用於處理修改測試範圍內對 module" -"(模組)以及 class(類別)等級的屬性,以及用於創建唯一對象的 :const:" -"`sentinel` 。有關如何使用 :class:`Mock`、:class:`MagicMock` 和 :func:`patch` " -"的一些示例,請參閱 `quick guide`_。" +"此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 " +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一對象的\\ :const:" +"`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\、\\ :class:`MagicMock`\\ 和\\ :" +"func:`patch`\\ 的一些示例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:33 msgid "" @@ -68,21 +68,21 @@ msgid "" "assertion' pattern instead of 'record -> replay' used by many mocking " "frameworks." msgstr "" -"Mock 被設計用於與 :mod:`unittest` 一起使用,並且基於“action(操作) -> " -"assertion(斷言)”模式,而不是許多模擬框架使用的“record(記錄) -> replay(重" -"播)”模式。" +"Mock 被設計用於與\\ :mod:`unittest`\\ 一起使用,並且基於 “action(操作) -> " +"assertion(判定)” 模式,而不是許多模擬框架使用的 ”record(記錄) -> replay" +"(重播)” 模式。" #: ../../library/unittest.mock.rst:37 msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "available as `mock on PyPI `_." msgstr "" -"對於早期版本的 Python,有一個backport(向後移植的) :mod:`unittest.mock` 可以" -"使用,`從 Pypi 下載 mock`_。" +"對於早期版本的 Python,有一個backport(向後移植的)\\ :mod:`unittest.mock`\\ " +"可以使用,\\ `從 PyPI 下載 mock `_。" #: ../../library/unittest.mock.rst:42 msgid "Quick Guide" -msgstr "快速指南" +msgstr "快速導引" #: ../../library/unittest.mock.rst:60 msgid "" @@ -91,15 +91,16 @@ msgid "" "can configure them, to specify return values or limit what attributes are " "available, and then make assertions about how they have been used:" msgstr "" -":class:`Mock` 和 :class:`MagicMock` 物件在你存取它們時創建所有屬性和method" -"(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定返回值或限制" -"可用的屬性,然後對它們的使用方式做出斷言:" +":class:`Mock`\\ 和\\ :class:`MagicMock`\\ 物件在你存取它們時創建所有屬性和 " +"method(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值" +"或限制可用的屬性,然後對它們的使用方式做出判定:" #: ../../library/unittest.mock.rst:72 msgid "" ":attr:`side_effect` allows you to perform side effects, including raising an " "exception when a mock is called:" msgstr "" +":attr:`side_effect`\\ 允許你執行 side effects,包含在 mock 被呼叫時引發異常:" #: ../../library/unittest.mock.rst:93 msgid "" @@ -108,6 +109,9 @@ msgid "" "from another object. Attempting to access attributes or methods on the mock " "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" +"Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec*\\ 引數可以配" +"置 mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於 spec 中的屬性或" +"方法將會失敗,並出現\\ :exc:`AttributeError`\\ 。" #: ../../library/unittest.mock.rst:98 msgid "" @@ -116,6 +120,10 @@ msgid "" "with a mock (or other object) during the test and restored when the test " "ends::" msgstr "" +":func:`patch`\\ 裝飾器 / 情境管理器可以在測試中簡單的模擬模組中的類別或物件。" +"被指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" +"\n" +"::" #: ../../library/unittest.mock.rst:117 msgid "" @@ -124,6 +132,9 @@ msgid "" "decorators are applied). This means from the bottom up, so in the example " "above the mock for ``module.ClassName1`` is passed in first." msgstr "" +"當你嵌套 patch 裝飾器時,mock 會以被應用的順序傳遞到裝飾函數(裝飾器應用的正" +"常\\ *Python*\\ 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module." +"ClassName1``\\ 的 mock 會先被傳入。" #: ../../library/unittest.mock.rst:122 msgid "" @@ -131,12 +142,15 @@ msgid "" "they are looked up. This is normally straightforward, but for a quick guide " "read :ref:`where to patch `." msgstr "" +"使用\\ :func:`patch`\\ 時,需注意的是你得在被查找物件的命名空間中(in the " +"namespace where they are looked up)patch 物件。這通常很直接,但若需要快速導" +"引,請參閱\\ :ref:`該 patch 何處 `\\ 。" #: ../../library/unittest.mock.rst:126 msgid "" "As well as a decorator :func:`patch` can be used as a context manager in a " "with statement:" -msgstr "" +msgstr "裝飾器\\ :func:`patch`\\ 也可以在 with 陳述式中被用來作為情境管理器:" #: ../../library/unittest.mock.rst:136 msgid "" @@ -144,6 +158,8 @@ msgid "" "during a scope and restoring the dictionary to its original state when the " "test ends:" msgstr "" +"也有\\ :func:`patch.dict`\\ ,用於在測試範圍中設定 dictionary(字典)內的值," +"並在測試結束時將其恢復為原始狀態:" #: ../../library/unittest.mock.rst:147 msgid "" @@ -151,6 +167,8 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" +"Mock 支持對 Python的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用魔" +"術方法的方式是使用\\ :class:`MagicMock`\\ 類別。它允許你執行以下操作:" #: ../../library/unittest.mock.rst:157 msgid "" @@ -159,12 +177,15 @@ msgid "" "is just a Mock variant that has all of the magic methods pre-created for you " "(well, all the useful ones anyway)." msgstr "" +"Mock 允許你將函式(或其他 Mock 實例)分配給魔術方法,並且它們將被適當地調" +"用。\\ :class:`MagicMock`\\ 類別是一個 Mock 的變體,它為你預先建好了所有魔術" +"方法(好吧,所有有用的方法)。" #: ../../library/unittest.mock.rst:162 msgid "" "The following is an example of using magic methods with the ordinary Mock " "class:" -msgstr "" +msgstr "以下是在一般 Mock 類別中使用魔術方法的範例:" #: ../../library/unittest.mock.rst:170 msgid "" @@ -176,12 +197,17 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" +"為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`" +"自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的\\ " +"*autospec*\\ 引數或\\ :func:`create_autospec`\\ 函式來完成。自動規格創建的模" +"擬物件與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構" +"子)都具有與真實物件相同的調用簽名(call signature)。" #: ../../library/unittest.mock.rst:178 msgid "" "This ensures that your mocks will fail in the same way as your production " "code if they are used incorrectly:" -msgstr "" +msgstr "這可以確保如果使用方法錯誤,你的模擬會跟實際程式碼以相同的方式失敗:" #: ../../library/unittest.mock.rst:194 msgid "" @@ -189,10 +215,12 @@ msgid "" "signature of the ``__init__`` method, and on callable objects where it " "copies the signature of the ``__call__`` method." msgstr "" +":func:`create_autospec`\\ 也可以用在類別上,它複製了\\ ``__init__``\\ 方法的" +"簽名,它也可以用在可調用物件上,其複製了\\ ``__call__``\\ 方法的簽名。" #: ../../library/unittest.mock.rst:201 msgid "The Mock Class" -msgstr "" +msgstr "模擬類別" #: ../../library/unittest.mock.rst:212 msgid "" From e31b5e856b71c49b7768ff00a60bbfb3646a2e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Tue, 22 Aug 2023 15:04:20 +0800 Subject: [PATCH 05/12] =?UTF-8?q?docs(translate-mock):=20mock=20page?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix rst error --- library/unittest.mock.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 7cb4461540..abcca90e37 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-22 14:24+0800\n" +"PO-Revision-Date: 2023-08-22 14:58+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -60,7 +60,7 @@ msgstr "" "此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 " "module(模組)以及 class(類別)級別的屬性,以及用於建立唯一對象的\\ :const:" "`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\、\\ :class:`MagicMock`\\ 和\\ :" -"func:`patch`\\ 的一些示例,請參閱\\ `快速導引 `_。" +"func:`patch`\\ 的一些示例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:33 msgid "" From d98be6cb9d49f809ab751182488f288c6aba9411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Tue, 22 Aug 2023 15:44:38 +0800 Subject: [PATCH 06/12] =?UTF-8?q?docs(translate-mock):=20mock=20page?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix format --- library/unittest.mock.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index abcca90e37..c63a9170b7 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-22 14:58+0800\n" +"PO-Revision-Date: 2023-08-22 15:44+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -33,8 +33,8 @@ msgid "" "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" -":mod:`unittest.mock`\\ 在Python中是一個用於進行測試的函式庫。 它允許你用模擬" -"物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" +":mod:`unittest.mock`\\ 在 Python 中是一個用於進行測試的函式庫。 它允許你用模" +"擬物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" #: ../../library/unittest.mock.rst:21 msgid "" @@ -60,7 +60,7 @@ msgstr "" "此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 " "module(模組)以及 class(類別)級別的屬性,以及用於建立唯一對象的\\ :const:" "`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\、\\ :class:`MagicMock`\\ 和\\ :" -"func:`patch`\\ 的一些示例,請參閱\\ `快速導引 `_。" +"func:`patch`\\ 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:33 msgid "" @@ -77,8 +77,8 @@ msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "available as `mock on PyPI `_." msgstr "" -"對於早期版本的 Python,有一個backport(向後移植的)\\ :mod:`unittest.mock`\\ " -"可以使用,\\ `從 PyPI 下載 mock `_。" +"對於早期版本的 Python,有一個 backport(向後移植的)\\ :mod:`unittest." +"mock`\\ 可以使用,\\ `從 PyPI 下載 mock `_。" #: ../../library/unittest.mock.rst:42 msgid "Quick Guide" From a53b900c767bd97495d465fe743f72bfe87b5b59 Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 22 Aug 2023 22:07:15 +0800 Subject: [PATCH 07/12] docs: mock translate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用詞修正 --- library/unittest.mock.po | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index c63a9170b7..8db3cd5b5b 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-22 15:44+0800\n" +"PO-Revision-Date: 2023-08-22 21:58+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -58,7 +58,7 @@ msgid "" "`patch`." msgstr "" "此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一對象的\\ :const:" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的\\ :const:" "`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\、\\ :class:`MagicMock`\\ 和\\ :" "func:`patch`\\ 的一些範例,請參閱\\ `快速導引 `_。" @@ -68,9 +68,9 @@ msgid "" "assertion' pattern instead of 'record -> replay' used by many mocking " "frameworks." msgstr "" -"Mock 被設計用於與\\ :mod:`unittest`\\ 一起使用,並且基於 “action(操作) -> " -"assertion(判定)” 模式,而不是許多模擬框架使用的 ”record(記錄) -> replay" -"(重播)” 模式。" +"Mock 被設計用於與\\ :mod:`unittest`\\ 一起使用,並且基於 「action(操作) -> " +"assertion(判定)」 模式,而不是許多模擬框架使用的 「record(記錄) -> replay" +"(重播)」 模式。" #: ../../library/unittest.mock.rst:37 msgid "" @@ -91,7 +91,7 @@ msgid "" "can configure them, to specify return values or limit what attributes are " "available, and then make assertions about how they have been used:" msgstr "" -":class:`Mock`\\ 和\\ :class:`MagicMock`\\ 物件在你存取它們時創建所有屬性和 " +":class:`Mock`\\ 和\\ :class:`MagicMock`\\ 物件在你存取它們時建立所有屬性和 " "method(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值" "或限制可用的屬性,然後對它們的使用方式做出判定:" @@ -100,7 +100,7 @@ msgid "" ":attr:`side_effect` allows you to perform side effects, including raising an " "exception when a mock is called:" msgstr "" -":attr:`side_effect`\\ 允許你執行 side effects,包含在 mock 被呼叫時引發異常:" +":attr:`side_effect`\\ 允許你執行 side effects,包含在 mock 被呼叫時引發例外:" #: ../../library/unittest.mock.rst:93 msgid "" @@ -110,8 +110,8 @@ msgid "" "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" "Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec*\\ 引數可以配" -"置 mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於 spec 中的屬性或" -"方法將會失敗,並出現\\ :exc:`AttributeError`\\ 。" +"置 mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方" +"法將會失敗,並出現\\ :exc:`AttributeError`\\ 。" #: ../../library/unittest.mock.rst:98 msgid "" @@ -167,7 +167,7 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -"Mock 支持對 Python的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用魔" +"Mock 支援對 Python的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用魔" "術方法的方式是使用\\ :class:`MagicMock`\\ 類別。它允許你執行以下操作:" #: ../../library/unittest.mock.rst:157 @@ -177,8 +177,8 @@ msgid "" "is just a Mock variant that has all of the magic methods pre-created for you " "(well, all the useful ones anyway)." msgstr "" -"Mock 允許你將函式(或其他 Mock 實例)分配給魔術方法,並且它們將被適當地調" -"用。\\ :class:`MagicMock`\\ 類別是一個 Mock 的變體,它為你預先建好了所有魔術" +"Mock 允許你將函式(或其他 Mock 實例)分配給魔術方法,並且它們將被適當地呼" +"叫。\\ :class:`MagicMock`\\ 類別是一個 Mock 的變體,它為你預先建好了所有魔術" "方法(好吧,所有有用的方法)。" #: ../../library/unittest.mock.rst:162 @@ -200,8 +200,8 @@ msgstr "" "為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`" "自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的\\ " "*autospec*\\ 引數或\\ :func:`create_autospec`\\ 函式來完成。自動規格創建的模" -"擬物件與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構" -"子)都具有與真實物件相同的調用簽名(call signature)。" +"擬物件與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函" +"式)都具有與真實物件相同的調用簽名(call signature)。" #: ../../library/unittest.mock.rst:178 msgid "" From c3691d809b552639d17a3aaa4520624fbd040616 Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 22 Aug 2023 22:27:10 +0800 Subject: [PATCH 08/12] docs: mock translate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit space修正 --- library/unittest.mock.po | 75 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 8db3cd5b5b..96b8dbaac2 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-22 21:58+0800\n" +"PO-Revision-Date: 2023-08-22 22:20+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -33,8 +33,8 @@ msgid "" "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" -":mod:`unittest.mock`\\ 在 Python 中是一個用於進行測試的函式庫。 它允許你用模" -"擬物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" +":mod:`unittest.mock` 在 Python 中是一個用於進行測試的函式庫。 它允許你用模擬" +"物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" #: ../../library/unittest.mock.rst:21 msgid "" @@ -44,10 +44,9 @@ msgid "" "and arguments they were called with. You can also specify return values and " "set needed attributes in the normal way." msgstr "" -":mod:`unittest.mock`\\ 提供了一個以\\ :class:`Mock`\\ 為核心的類別,去除在測" -"試中建立大量 stubs 的需求。 在執行動作之後,你可以判定哪些 method (方法)/" -"屬性被使用,以及有哪些引數被呼叫。 你還可以用常規的方式指定回傳值與設定所需的" -"屬性。" +":mod:`unittest.mock` 提供了一個以 :class:`Mock` 為核心的類別,去除在測試中建" +"立大量 stubs 的需求。 在執行動作之後,你可以判定哪些 method (方法)/屬性被" +"使用,以及有哪些引數被呼叫。 你還可以用常規的方式指定回傳值與設定所需的屬性。" #: ../../library/unittest.mock.rst:27 msgid "" @@ -57,10 +56,10 @@ msgid "" "some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" "`patch`." msgstr "" -"此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的\\ :const:" -"`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\、\\ :class:`MagicMock`\\ 和\\ :" -"func:`patch`\\ 的一些範例,請參閱\\ `快速導引 `_。" +"此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" +"`sentinel`\\ 。有關如何使用 :class:`Mock`\\、\\ :class:`MagicMock` 和 :func:" +"`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:33 msgid "" @@ -68,7 +67,7 @@ msgid "" "assertion' pattern instead of 'record -> replay' used by many mocking " "frameworks." msgstr "" -"Mock 被設計用於與\\ :mod:`unittest`\\ 一起使用,並且基於 「action(操作) -> " +"Mock 被設計用於與 :mod:`unittest` 一起使用,並且基於 「action(操作) -> " "assertion(判定)」 模式,而不是許多模擬框架使用的 「record(記錄) -> replay" "(重播)」 模式。" @@ -77,8 +76,8 @@ msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "available as `mock on PyPI `_." msgstr "" -"對於早期版本的 Python,有一個 backport(向後移植的)\\ :mod:`unittest." -"mock`\\ 可以使用,\\ `從 PyPI 下載 mock `_。" +"對於早期版本的 Python,有一個 backport(向後移植的)\\ :mod:`unittest.mock` " +"可以使用,\\ `從 PyPI 下載 mock `_。" #: ../../library/unittest.mock.rst:42 msgid "Quick Guide" @@ -91,16 +90,16 @@ msgid "" "can configure them, to specify return values or limit what attributes are " "available, and then make assertions about how they have been used:" msgstr "" -":class:`Mock`\\ 和\\ :class:`MagicMock`\\ 物件在你存取它們時建立所有屬性和 " -"method(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值" -"或限制可用的屬性,然後對它們的使用方式做出判定:" +":class:`Mock` 和 :class:`MagicMock` 物件在你存取它們時建立所有屬性和 method" +"(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值或限制" +"可用的屬性,然後對它們的使用方式做出判定:" #: ../../library/unittest.mock.rst:72 msgid "" ":attr:`side_effect` allows you to perform side effects, including raising an " "exception when a mock is called:" msgstr "" -":attr:`side_effect`\\ 允許你執行 side effects,包含在 mock 被呼叫時引發例外:" +":attr:`side_effect` 允許你執行 side effects,包含在 mock 被呼叫時引發例外:" #: ../../library/unittest.mock.rst:93 msgid "" @@ -109,9 +108,9 @@ msgid "" "from another object. Attempting to access attributes or methods on the mock " "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" -"Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec*\\ 引數可以配" -"置 mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方" -"法將會失敗,並出現\\ :exc:`AttributeError`\\ 。" +"Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec* 引數可以配置 " +"mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將" +"會失敗,並出現 :exc:`AttributeError`\\ 。" #: ../../library/unittest.mock.rst:98 msgid "" @@ -120,8 +119,8 @@ msgid "" "with a mock (or other object) during the test and restored when the test " "ends::" msgstr "" -":func:`patch`\\ 裝飾器 / 情境管理器可以在測試中簡單的模擬模組中的類別或物件。" -"被指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" +":func:`patch` 裝飾器/情境管理器可以在測試中簡單的模擬模組中的類別或物件。被" +"指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" "\n" "::" @@ -133,8 +132,8 @@ msgid "" "above the mock for ``module.ClassName1`` is passed in first." msgstr "" "當你嵌套 patch 裝飾器時,mock 會以被應用的順序傳遞到裝飾函數(裝飾器應用的正" -"常\\ *Python*\\ 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module." -"ClassName1``\\ 的 mock 會先被傳入。" +"常 *Python* 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module." +"ClassName1`` 的 mock 會先被傳入。" #: ../../library/unittest.mock.rst:122 msgid "" @@ -142,7 +141,7 @@ msgid "" "they are looked up. This is normally straightforward, but for a quick guide " "read :ref:`where to patch `." msgstr "" -"使用\\ :func:`patch`\\ 時,需注意的是你得在被查找物件的命名空間中(in the " +"使用 :func:`patch` 時,需注意的是你得在被查找物件的命名空間中(in the " "namespace where they are looked up)patch 物件。這通常很直接,但若需要快速導" "引,請參閱\\ :ref:`該 patch 何處 `\\ 。" @@ -150,7 +149,7 @@ msgstr "" msgid "" "As well as a decorator :func:`patch` can be used as a context manager in a " "with statement:" -msgstr "裝飾器\\ :func:`patch`\\ 也可以在 with 陳述式中被用來作為情境管理器:" +msgstr "裝飾器 :func:`patch` 也可以在 with 陳述式中被用來作為情境管理器:" #: ../../library/unittest.mock.rst:136 msgid "" @@ -158,8 +157,8 @@ msgid "" "during a scope and restoring the dictionary to its original state when the " "test ends:" msgstr "" -"也有\\ :func:`patch.dict`\\ ,用於在測試範圍中設定 dictionary(字典)內的值," -"並在測試結束時將其恢復為原始狀態:" +"也有 :func:`patch.dict`\\ ,用於在測試範圍中設定 dictionary(字典)內的值,並" +"在測試結束時將其恢復為原始狀態:" #: ../../library/unittest.mock.rst:147 msgid "" @@ -168,7 +167,7 @@ msgid "" "It allows you to do things like:" msgstr "" "Mock 支援對 Python的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用魔" -"術方法的方式是使用\\ :class:`MagicMock`\\ 類別。它允許你執行以下操作:" +"術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:" #: ../../library/unittest.mock.rst:157 msgid "" @@ -178,8 +177,8 @@ msgid "" "(well, all the useful ones anyway)." msgstr "" "Mock 允許你將函式(或其他 Mock 實例)分配給魔術方法,並且它們將被適當地呼" -"叫。\\ :class:`MagicMock`\\ 類別是一個 Mock 的變體,它為你預先建好了所有魔術" -"方法(好吧,所有有用的方法)。" +"叫。\\ :class:`MagicMock` 類別是一個 Mock 的變體,它為你預先建好了所有魔術方" +"法(好吧,所有有用的方法)。" #: ../../library/unittest.mock.rst:162 msgid "" @@ -198,10 +197,10 @@ msgid "" "same call signature as the real object." msgstr "" "為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`" -"自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的\\ " -"*autospec*\\ 引數或\\ :func:`create_autospec`\\ 函式來完成。自動規格創建的模" -"擬物件與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函" -"式)都具有與真實物件相同的調用簽名(call signature)。" +"自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的 " +"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格創建的模擬物件" +"與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函式)都" +"具有與真實物件相同的調用簽名(call signature)。" #: ../../library/unittest.mock.rst:178 msgid "" @@ -215,8 +214,8 @@ msgid "" "signature of the ``__init__`` method, and on callable objects where it " "copies the signature of the ``__call__`` method." msgstr "" -":func:`create_autospec`\\ 也可以用在類別上,它複製了\\ ``__init__``\\ 方法的" -"簽名,它也可以用在可調用物件上,其複製了\\ ``__call__``\\ 方法的簽名。" +":func:`create_autospec` 也可以用在類別上,它複製了 ``__init__`` 方法的簽名," +"它也可以用在可調用物件上,其複製了 ``__call__`` 方法的簽名。" #: ../../library/unittest.mock.rst:201 msgid "The Mock Class" From 730ee55307c272ef6133e817e7fb696840e359e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Wed, 23 Aug 2023 10:10:05 +0800 Subject: [PATCH 09/12] fix(translate-mock): fix space --- library/unittest.mock.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 96b8dbaac2..9f1118eb78 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-22 22:20+0800\n" +"PO-Revision-Date: 2023-08-23 10:06+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -120,7 +120,7 @@ msgid "" "ends::" msgstr "" ":func:`patch` 裝飾器/情境管理器可以在測試中簡單的模擬模組中的類別或物件。被" -"指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" +"指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" "\n" "::" @@ -166,8 +166,8 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -"Mock 支援對 Python的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用魔" -"術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:" +"Mock 支援對 Python 的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用" +"魔術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:" #: ../../library/unittest.mock.rst:157 msgid "" From f7f8e4f49253fc9c7abfcdcc964602087e263d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Wed, 23 Aug 2023 10:36:47 +0800 Subject: [PATCH 10/12] fix(translate-mock): MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正半形冒號 --- library/unittest.mock.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 9f1118eb78..fdb372e4d2 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-23 10:06+0800\n" +"PO-Revision-Date: 2023-08-23 10:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -122,7 +122,7 @@ msgstr "" ":func:`patch` 裝飾器/情境管理器可以在測試中簡單的模擬模組中的類別或物件。被" "指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" "\n" -"::" +"::" #: ../../library/unittest.mock.rst:117 msgid "" From 89e08ac7bbd40787a44398313da4cd124a82d654 Mon Sep 17 00:00:00 2001 From: Payon Date: Wed, 23 Aug 2023 23:32:01 +0800 Subject: [PATCH 11/12] =?UTF-8?q?fix:=20=E7=94=A8=E8=A9=9E=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.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index fdb372e4d2..de15350e57 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -198,9 +198,9 @@ msgid "" msgstr "" "為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`" "自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格創建的模擬物件" -"與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函式)都" -"具有與真實物件相同的調用簽名(call signature)。" +"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的模擬物件" +"與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)都" +"具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:178 msgid "" @@ -215,7 +215,7 @@ msgid "" "copies the signature of the ``__call__`` method." msgstr "" ":func:`create_autospec` 也可以用在類別上,它複製了 ``__init__`` 方法的簽名," -"它也可以用在可調用物件上,其複製了 ``__call__`` 方法的簽名。" +"它也可以用在可呼叫物件上,其複製了 ``__call__`` 方法的簽名。" #: ../../library/unittest.mock.rst:201 msgid "The Mock Class" From f31df6cffcd89dfdad427856d7279b95aa107945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=84=AD=E5=AE=87=E8=BE=B0?= Date: Tue, 29 Aug 2023 15:34:36 +0800 Subject: [PATCH 12/12] fix(translate-mock): MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正 mock 為不翻譯 --- library/unittest.mock.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/library/unittest.mock.po b/library/unittest.mock.po index de15350e57..35249ae1b7 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-22 00:04+0000\n" -"PO-Revision-Date: 2023-08-23 10:36+0800\n" +"PO-Revision-Date: 2023-08-29 15:33+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -21,7 +21,7 @@ msgstr "" #: ../../library/unittest.mock.rst:3 msgid ":mod:`unittest.mock` --- mock object library" -msgstr ":mod:`unittest.mock` — 模擬物件函式庫" +msgstr ":mod:`unittest.mock` — mock 物件函式庫" #: ../../library/unittest.mock.rst:13 msgid "**Source code:** :source:`Lib/unittest/mock.py`" @@ -33,8 +33,8 @@ msgid "" "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" -":mod:`unittest.mock` 在 Python 中是一個用於進行測試的函式庫。 它允許你用模擬" -"物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。" +":mod:`unittest.mock` 在 Python 中是一個用於進行測試的函式庫。 它允許你用 " +"mock 物件在測試中替換部分系統,並判定它們是如何被使用的。" #: ../../library/unittest.mock.rst:21 msgid "" @@ -68,8 +68,8 @@ msgid "" "frameworks." msgstr "" "Mock 被設計用於與 :mod:`unittest` 一起使用,並且基於 「action(操作) -> " -"assertion(判定)」 模式,而不是許多模擬框架使用的 「record(記錄) -> replay" -"(重播)」 模式。" +"assertion(判定)」 模式,而不是許多 mocking 框架使用的 「record(記錄) -> " +"replay(重播)」 模式。" #: ../../library/unittest.mock.rst:37 msgid "" @@ -119,8 +119,8 @@ msgid "" "with a mock (or other object) during the test and restored when the test " "ends::" msgstr "" -":func:`patch` 裝飾器/情境管理器可以在測試中簡單的模擬模組中的類別或物件。被" -"指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" +":func:`patch` 裝飾器/情境管理器可以在測試中簡單的 mock 模組中的類別或物件。" +"被指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n" "\n" "::" @@ -166,8 +166,8 @@ msgid "" "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -"Mock 支援對 Python 的\\ :ref:`魔術方法 `\\ 的模擬。最簡單使用" -"魔術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:" +"Mock 支援對 Python 的\\ :ref:`魔術方法 `\\ 的 mocking。最簡單" +"使用魔術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:" #: ../../library/unittest.mock.rst:157 msgid "" @@ -196,17 +196,17 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`" -"自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的模擬物件" -"與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)都" -"具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" +"ref:`自動規格 `\\ 。自動規格(auto-speccing)可以通過 patch " +"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 " +"mock 物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構" +"函式)都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:178 msgid "" "This ensures that your mocks will fail in the same way as your production " "code if they are used incorrectly:" -msgstr "這可以確保如果使用方法錯誤,你的模擬會跟實際程式碼以相同的方式失敗:" +msgstr "這可以確保如果使用方法錯誤,你的 mock 會跟實際程式碼以相同的方式失敗:" #: ../../library/unittest.mock.rst:194 msgid "" @@ -219,7 +219,7 @@ msgstr "" #: ../../library/unittest.mock.rst:201 msgid "The Mock Class" -msgstr "模擬類別" +msgstr "Mock 類別" #: ../../library/unittest.mock.rst:212 msgid "" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy