Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f97c31

Browse files
committed
docs: mock 翻譯
from rst:384 to 492
1 parent 6309010 commit 2f97c31

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

library/unittest.mock.po

Lines changed: 32 additions & 16 deletions
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-07-22 00:04+0000\n"
11-
"PO-Revision-Date: 2023-09-09 23:07+0800\n"
11+
"PO-Revision-Date: 2023-09-26 00:39+0800\n"
1212
"Last-Translator: Adrian Liaw <[email protected]>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -253,16 +253,16 @@ msgid ""
253253
"class of :class:`Mock` using the *new_callable* argument to :func:`patch`."
254254
msgstr ""
255255
":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。"
256-
"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使"
257-
"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。"
256+
"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :"
257+
"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。"
258258

259259
#: ../../library/unittest.mock.rst:231
260260
msgid ""
261261
"Create a new :class:`Mock` object. :class:`Mock` takes several optional "
262262
"arguments that specify the behaviour of the Mock object:"
263263
msgstr ""
264-
"建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 "
265-
"Mock 物件的行為:"
264+
"建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 Mock "
265+
"物件的行為:"
266266

267267
#: ../../library/unittest.mock.rst:234
268268
msgid ""
@@ -428,8 +428,8 @@ msgid ""
428428
"assert the mock has been called with the specified calls. The :attr:"
429429
"`mock_calls` list is checked for the calls."
430430
msgstr ""
431-
"斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列中的"
432-
"呼叫。"
431+
"斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列"
432+
"中的呼叫。"
433433

434434
#: ../../library/unittest.mock.rst:365
435435
msgid ""
@@ -449,15 +449,15 @@ msgstr ""
449449

450450
#: ../../library/unittest.mock.rst:384
451451
msgid "Assert the mock was never called."
452-
msgstr ""
452+
msgstr "斷言 mock 從未被呼叫。"
453453

454454
#: ../../library/unittest.mock.rst:399
455455
msgid "The reset_mock method resets all the call attributes on a mock object:"
456-
msgstr ""
456+
msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:"
457457

458458
#: ../../library/unittest.mock.rst:409
459459
msgid "Added two keyword-only arguments to the reset_mock function."
460-
msgstr ""
460+
msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。"
461461

462462
#: ../../library/unittest.mock.rst:412
463463
msgid ""
@@ -468,73 +468,89 @@ msgid ""
468468
"`side_effect`, then pass the corresponding parameter as ``True``. Child "
469469
"mocks and the return value mock (if any) are reset as well."
470470
msgstr ""
471+
"這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況下,:"
472+
"meth:`reset_mock` *不會* 清除回傳值、:attr:`side_effect` 或使用普通賦值設定的"
473+
"任何子屬性。如果你想要重置 *return_value* 或 :attr:`side_effect`,則將相應的"
474+
"參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。"
471475

472476
#: ../../library/unittest.mock.rst:420
473477
msgid "*return_value*, and :attr:`side_effect` are keyword-only arguments."
474-
msgstr ""
478+
msgstr "*return_value* 和 :attr:`side_effect` 是僅限關鍵字引數。"
475479

476480
#: ../../library/unittest.mock.rst:426
477481
msgid ""
478482
"Add a spec to a mock. *spec* can either be an object or a list of strings. "
479483
"Only attributes on the *spec* can be fetched as attributes from the mock."
480484
msgstr ""
485+
"向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of "
486+
"strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。"
481487

482488
#: ../../library/unittest.mock.rst:430
483489
msgid "If *spec_set* is true then only attributes on the spec can be set."
484-
msgstr ""
490+
msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。"
485491

486492
#: ../../library/unittest.mock.rst:435
487493
msgid ""
488494
"Attach a mock as an attribute of this one, replacing its name and parent. "
489495
"Calls to the attached mock will be recorded in the :attr:`method_calls` and :"
490496
"attr:`mock_calls` attributes of this one."
491497
msgstr ""
498+
"將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 "
499+
"mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` "
500+
"屬性中。"
492501

493502
#: ../../library/unittest.mock.rst:442
494503
msgid "Set attributes on the mock through keyword arguments."
495-
msgstr ""
504+
msgstr "透過關鍵字參數在 mock 上設定屬性。"
496505

497506
#: ../../library/unittest.mock.rst:444
498507
msgid ""
499508
"Attributes plus return values and side effects can be set on child mocks "
500509
"using standard dot notation and unpacking a dictionary in the method call:"
501510
msgstr ""
511+
"可以使用標準點記法 (dot notation) 並在使用 method(方法)呼叫時將字典拆開,"
512+
"為 child mock 設定屬性、回傳值和 side effects:"
502513

503514
#: ../../library/unittest.mock.rst:458
504515
msgid "The same thing can be achieved in the constructor call to mocks:"
505-
msgstr ""
516+
msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:"
506517

507518
#: ../../library/unittest.mock.rst:471
508519
msgid ""
509520
":meth:`configure_mock` exists to make it easier to do configuration after "
510521
"the mock has been created."
511522
msgstr ""
523+
":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。"
512524

513525
#: ../../library/unittest.mock.rst:477
514526
msgid ""
515527
":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful "
516528
"results. For mocks with a *spec* this includes all the permitted attributes "
517529
"for the mock."
518530
msgstr ""
531+
":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 "
532+
"*spec* 的 mock,這包含所有被允許的 mock 屬性。"
519533

520534
#: ../../library/unittest.mock.rst:481
521535
msgid ""
522536
"See :data:`FILTER_DIR` for what this filtering does, and how to switch it "
523537
"off."
524-
msgstr ""
538+
msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。"
525539

526540
#: ../../library/unittest.mock.rst:487
527541
msgid ""
528542
"Create the child mocks for attributes and return value. By default child "
529543
"mocks will be the same type as the parent. Subclasses of Mock may want to "
530544
"override this to customize the way child mocks are made."
531545
msgstr ""
546+
"建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相"
547+
"同的類型。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。"
532548

533549
#: ../../library/unittest.mock.rst:492
534550
msgid ""
535551
"For non-callable mocks the callable variant will be used (rather than any "
536552
"custom subclass)."
537-
msgstr ""
553+
msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。"
538554

539555
#: ../../library/unittest.mock.rst:498
540556
msgid "A boolean representing whether or not the mock object has been called:"

0 commit comments

Comments
 (0)