8000 docs: mock translate · python/python-docs-zh-tw@c3691d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3691d8

Browse files
committed
docs: mock translate
space修正
1 parent a53b900 commit c3691d8

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

library/unittest.mock.po

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line num 8000 berDiff 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-07-22 00:04+0000\n"
11-
"PO-Revision-Date: 2023-08-22 21:58+0800\n"
11+
"PO-Revision-Date: 2023-08-22 22:20+0800\n"
1212
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -33,8 +33,8 @@ msgid ""
3333
"replace parts of your system under test with mock objects and make "
3434
"assertions about how they have been used."
3535
msgstr ""
36-
":mod:`unittest.mock`\\ 在 Python 中是一個用於進行測試的函式庫。 它允許你用模"
37-
"擬物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。"
36+
":mod:`unittest.mock` 在 Python 中是一個用於進行測試的函式庫。 它允許你用模擬"
37+
"物件 (mock object) 在測試中替換部分系統,並判定它們是如何被使用的。"
3838

3939
#: ../../library/unittest.mock.rst:21
4040
msgid ""
@@ -44,10 +44,9 @@ msgid ""
4444
"and arguments they were called with. You can also specify return values and "
4545
"set needed attributes in the normal way."
4646
msgstr ""
47-
":mod:`unittest.mock`\\ 提供了一個以\\ :class:`Mock`\\ 為核心的類別,去除在測"
48-
"試中建立大量 stubs 的需求。 在執行動作之後,你可以判定哪些 method (方法)/"
49-
"屬性被使用,以及有哪些引數被呼叫。 你還可以用常規的方式指定回傳值與設定所需的"
50-
"屬性。"
47+
":mod:`unittest.mock` 提供了一個以 :class:`Mock` 為核心的類別,去除在測試中建"
48+
"立大量 stubs 的需求。 在執行動作之後,你可以判定哪些 method (方法)/屬性被"
49+
"使用,以及有哪些引數被呼叫。 你還可以用常規的方式指定回傳值與設定所需的屬性。"
5150

5251
#: ../../library/unittest.mock.rst:27
5352
msgid ""
@@ -57,18 +56,18 @@ msgid ""
5756
"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:"
5857
"`patch`."
5958
msgstr ""
60-
"此外,mock 還提供了一個\\ :func:`patch`\\ 裝飾器,用於 patching 測試範圍內對 "
61-
"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的\\ :const:"
62-
"`sentinel`\\ 。有關如何使用\\ :class:`Mock`\\\\ :class:`MagicMock`\\\\ :"
63-
"func:`patch`\\ 的一些範例,請參閱\\ `快速導引 <quick guide_>`_。"
59+
"此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 "
60+
"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:"
61+
"`sentinel`\\ 。有關如何使用 :class:`Mock`\\\\ :class:`MagicMock` 和 :func:"
62+
"`patch` 的一些範例,請參閱\\ `快速導引 <quick guide_>`_。"
6463

6564
#: ../../library/unittest.mock.rst:33
6665
msgid ""
6766
"Mock is designed for use with :mod:`unittest` and is based on the 'action -> "
6867
"assertion' pattern instead of 'record -> replay' used by many mocking "
6968
"frameworks."
7069
msgstr ""
71-
"Mock 被設計用於與\\ :mod:`unittest`\\ 一起使用,並且基於 「action(操作) -> "
70+
"Mock 被設計用於與 :mod:`unittest` 一起使用,並且基於 「action(操作) -> "
7271
"assertion(判定)」 模式,而不是許多模擬框架使用的 「record(記錄) -> replay"
7372
"(重播)」 模式。"
7473

@@ -77,8 +76,8 @@ msgid ""
7776
"There is a backport of :mod:`unittest.mock` for earlier versions of Python, "
7877
"available as `mock on PyPI <https://pypi.org/project/mock>`_."
7978
msgstr ""
80-
"對於早期版本的 Python,有一個 backport(向後移植的)\\ :mod:`unittest."
81-
"mock`\\ 可以使用,\\ `從 PyPI 下載 mock <https://pypi.org/project/mock>`_。"
79+
"對於早期版本的 Python,有一個 backport(向後移植的)\\ :mod:`unittest.mock` "
80+
"可以使用,\\ `從 PyPI 下載 mock <https://pypi.org/project/mock>`_。"
8281

8382
#: ../../library/unittest.mock.rst:42
8483
msgid "Quick Guide"
@@ -91,16 +90,16 @@ msgid ""
9190
"can configure them, to specify return values or limit what attributes are "
9291
"available, and then make assertions about how they have been used:"
9392
msgstr ""
94-
":class:`Mock`\\\\ :class:`MagicMock`\\ 物件在你存取它們時建立所有屬性和 "
95-
"method(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值"
96-
"或限制可用的屬性,然後對它們的使用方式做出判定:"
93+
":class:`Mock` :class:`MagicMock` 物件在你存取它們時建立所有屬性和 method"
94+
"(方法),並儲存它們如何被使用的詳細訊息。你可以配置它們,以指定回傳值或限制"
95+
"可用的屬性,然後對它們的使用方式做出判定:"
9796

9897
#: ../../library/unittest.mock.rst:72
9998
msgid ""
10099
":attr:`side_effect` allows you to perform side effects, including raising an "
101100
"exception when a mock is called:"
102101
msgstr ""
103-
":attr:`side_effect`\\ 允許你執行 side effects,包含在 mock 被呼叫時引發例外:"
102+
":attr:`side_effect` 允許你執行 side effects,包含在 mock 被呼叫時引發例外:"
104103

105104
#: ../../library/unittest.mock.rst:93
106105
msgid ""
@@ -109,9 +108,9 @@ msgid ""
109108
"from another object. Attempting to access attributes or methods on the mock "
110109
"that don't exist on the spec will fail with an :exc:`AttributeError`."
111110
msgstr ""
112-
"Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec*\\ 引數可以配"
113-
"mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方"
114-
"法將會失敗,並出現\\ :exc:`AttributeError`\\ 。"
111+
"Mock 有許多其他方法可以讓你配置與控制它的行為。例如,\\ *spec* 引數可以配置 "
112+
"mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將"
113+
"會失敗,並出現 :exc:`AttributeError`\\ 。"
115114

116115
#: ../../library/unittest.mock.rst:98
117116
msgid ""
@@ -120,8 +119,8 @@ msgid ""
120119
"with a mock (or other object) during the test and restored when the test "
121120
"ends::"
122121
msgstr ""
123-
":func:`patch`\\ 裝飾器 / 情境管理器可以在測試中簡單的模擬模組中的類別或物件。"
124-
"被指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n"
122+
":func:`patch` 裝飾器情境管理器可以在測試中簡單的模擬模組中的類別或物件。"
123+
"指定的物件在測試期間會被替換為 mock(或其他物件),並在測試結束時恢復:\n"
125124
"\n"
126125
"::"
127126

@@ -133,33 +132,33 @@ msgid ""
133132
"above the mock for ``module.ClassName1`` is passed in first."
134133
msgstr ""
135134
"當你嵌套 patch 裝飾器時,mock 會以被應用的順序傳遞到裝飾函數(裝飾器應用的正"
136-
"常\\ *Python*\\ 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module."
137-
"ClassName1``\\ 的 mock 會先被傳入。"
135+
"常 *Python* 順序)。這意味著由下而上,因此在上面的範例中,\\ ``module."
136+
"ClassName1`` 的 mock 會先被傳入。"
138137

139138
#: ../../library/unittest.mock.rst:122
140139
msgid ""
141140
"With :func:`patch` it matters that you patch objects in the namespace where "
142141
"they are looked up. This is normally straightforward, but for a quick guide "
143142
"read :ref:`where to patch <where-to-patch>`."
144143
msgstr ""
145-
"使用\\ :func:`patch`\\ 時,需注意的是你得在被查找物件的命名空間中(in the "
144+
"使用 :func:`patch` 時,需注意的是你得在被查找物件的命名空間中(in the "
146145
"namespace where they are looked up)patch 物件。這通常很直接,但若需要快速導"
147146
"引,請參閱\\ :ref:`該 patch 何處 <where-to-patch>`\\ 。"
148147

149148
#: ../../library/unittest.mock.rst:126
150149
msgid ""
151150
"As well as a decorator :func:`patch` can be used as a context manager in a "
152151
"with statement:"
153-
msgstr "裝飾器\\ :func:`patch`\\ 也可以在 with 陳述式中被用來作為情境管理器:"
152+
msgstr "裝飾器 :func:`patch` 也可以在 with 陳述式中被用來作為情境管理器:"
154153

155154
#: ../../library/unittest.mock.rst:136
156155
msgid ""
157156
"There is also :func:`patch.dict` for setting values in a dictionary just "
158157
"during a scope and restoring the dictionary to its original state when the "
159158
"test ends:"
160159
msgstr ""
161-
"也有\\ :func:`patch.dict`\\ ,用於在測試範圍中設定 dictionary(字典)內的值,"
162-
"並在測試結束時將其恢復為原始狀態:"
160+
"也有 :func:`patch.dict`\\ ,用於在測試範圍中設定 dictionary(字典)內的值,"
161+
"在測試結束時將其恢復為原始狀態:"
163162

164163
#: ../../library/unittest.mock.rst:147
165164
msgid ""
@@ -168,7 +167,7 @@ msgid ""
168167
"It allows you to do things like:"
169168
msgstr ""
170169
"Mock 支援對 Python的\\ :ref:`魔術方法 <magic-methods>`\\ 的模擬。最簡單使用魔"
171-
"術方法的方式是使用\\ :class:`MagicMock`\\ 類別。它允許你執行以下操作:"
170+
"術方法的方式是使用 :class:`MagicMock` 類別。它允許你執行以下操作:"
172171

173172
#: ../../library/unittest.mock.rst:157
174173
msgid ""
@@ -178,8 +177,8 @@ msgid ""
178177
"(well, all the useful ones anyway)."
179178
msgstr ""
180179
"Mock 允許你將函式(或其他 Mock 實例)分配給魔術方法,並且它們將被適當地呼"
181-
"叫。\\ :class:`MagicMock`\\ 類別是一個 Mock 的變體,它為你預先建好了所有魔術"
182-
"方法(好吧,所有有用的方法)。"
180+
"叫。\\ :class:`MagicMock` 類別是一個 Mock 的變體,它為你預先建好了所有魔術方"
181+
"(好吧,所有有用的方法)。"
183182

184183
#: ../../library/unittest.mock.rst:162
185184
msgid ""
@@ -198,10 +197,10 @@ msgid ""
198197
"same call signature as the real object."
199198
msgstr ""
200199
"為了確保測試中的模擬物件與它們要替換的物件具有相同的 api,你可以使用\\ :ref:`"
201-
"自動規格 <auto-speccing>`\\ 。自動規格(auto-speccing)可以通過 patch 的\\ "
202-
"*autospec*\\ 引數或\\ :func:`create_autospec`\\ 函式來完成。自動規格創建的模"
203-
"擬物件與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函"
204-
"式)都具有與真實物件相同的調用簽名(call signature)。"
200+
"自動規格 <auto-speccing>`\\ 。自動規格(auto-speccing)可以通過 patch 的 "
201+
"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格創建的模擬物件"
202+
"與它們要替換的對象具有相同的屬性和方法,並且任何函式和方法(包括建構函式)都"
203+
"具有與真實物件相同的調用簽名(call signature)。"
205204

206205
#: ../../library/unittest.mock.rst:178
207206
msgid ""
@@ -215,8 +214,8 @@ msgid ""
215214
"signature of the ``__init__`` method, and on callable objects where it "
216215
"copies the signature of the ``__call__`` method."
217216
msgstr ""
218-
":func:`create_autospec`\\ 也可以用在類別上,它複製了\\ ``__init__``\\ 方法的"
219-
"簽名,它也可以用在可調用物件上,其複製了\\ ``__call__``\\ 方法的簽名。"
217+
":func:`create_autospec` 也可以用在類別上,它複製了 ``__init__`` 方法的簽名,"
218+
"它也可以用在可調用物件上,其複製了 ``__call__`` 方法的簽名。"
220219

221220
#: ../../library/unittest.mock.rst:201
222221
msgid "The Mock Class"

0 commit comments

Comments
 (0)
0