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

Skip to content

Commit e392522

Browse files
committed
docs: mock 翻譯
from rst:652 to 817
1 parent 89ce5f0 commit e392522

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

library/unittest.mock.po

Lines changed: 44 additions & 2 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-27 00:27+0800\n"
11+
"PO-Revision-Date: 2023-10-10 21:59+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"
@@ -17,7 +17,7 @@ msgstr ""
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=1; plural=0;\n"
20-
"X-Generator: Poedit 3.3.2\n"
20+
"X-Generator: Poedit 3.4\n"
2121

2222
#: ../../library/unittest.mock.rst:3
2323
msgid ":mod:`unittest.mock` --- mock object library"
@@ -670,46 +670,61 @@ msgid ""
670670
"used for conveniently constructing lists of calls to compare with :attr:"
671671
"`call_args_list`."
672672
msgstr ""
673+
"這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。"
674+
"在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼"
675+
"叫的串列,以便與 :attr:`call_args_list` 進行比較。"
673676

674677
#: ../../library/unittest.mock.rst:674
675678
msgid ""
676679
"Members of :attr:`call_args_list` are :data:`call` objects. These can be "
677680
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
678681
"tuples <calls-as-tuples>`."
679682
msgstr ""
683+
":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元"
684+
"組,以取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
680685

681686
#: ../../library/unittest.mock.rst:681
682687
msgid ""
683688
"As well as tracking calls to themselves, mocks also track calls to methods "
684689
"and attributes, and *their* methods and attributes:"
685690
msgstr ""
691+
"除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼降,以及*它們(這些方"
692+
"法和屬性)*的方法和屬性:"
686693

687694
#: ../../library/unittest.mock.rst:692
688695
msgid ""
689696
"Members of :attr:`method_calls` are :data:`call` objects. These can be "
690697
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
691698
"tuples <calls-as-tuples>`."
692699
msgstr ""
700+
":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以"
701+
"取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
693702

694703
#: ../../library/unittest.mock.rst:699
695704
msgid ""
696705
":attr:`mock_calls` records *all* calls to the mock object, its methods, "
697706
"magic methods *and* return value mocks."
698707
msgstr ""
708+
":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及"
709+
"回傳值 mock。"
699710

700711
#: ../../library/unittest.mock.rst:717
701712
msgid ""
702713
"Members of :attr:`mock_calls` are :data:`call` objects. These can be "
703714
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
704715
"tuples <calls-as-tuples>`."
705716
msgstr ""
717+
":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以"
718+
"取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
706719

707720
#: ../../library/unittest.mock.rst:723
708721
msgid ""
709722
"The way :attr:`mock_calls` are recorded means that where nested calls are "
710723
"made, the parameters of ancestor calls are not recorded and so will always "
711724
"compare equal:"
712725
msgstr ""
726+
":attr:`mock_calls` 記錄的方式意味著在進行嵌套呼叫時,上代 (ancestor) 呼叫的參"
727+
"數不會被記錄,因此在比較時它們將始終相等:"
713728

714729
#: ../../library/unittest.mock.rst:737
715730
msgid ""
@@ -718,31 +733,42 @@ msgid ""
718733
"instead. This allows mock objects to pass :func:`isinstance` tests for the "
719734
"object they are replacing / masquerading as:"
720735
msgstr ""
736+
"通常,物件的 :attr:`__class__` 屬性會回傳它的型別。但對於擁有 :attr:`spec` "
737+
"的 mock 物件,``__class__`` 會回傳 spec 的類別。這允許 mock 物件通過對它們所"
738+
"替代或偽裝的物件進行的 :func:`isinstance` 測試:"
721739

722740
#: ../../library/unittest.mock.rst:746
723741
msgid ""
724742
":attr:`__class__` is assignable to, this allows a mock to pass an :func:"
725743
"`isinstance` check without forcing you to use a spec:"
726744
msgstr ""
745+
":attr:`__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不"
746+
"需要強制使用 spec:"
727747

728748
#: ../../library/unittest.mock.rst:756
729749
msgid ""
730750
"A non-callable version of :class:`Mock`. The constructor parameters have the "
731751
"same meaning of :class:`Mock`, with the exception of *return_value* and "
732752
"*side_effect* which have no meaning on a non-callable mock."
733753
msgstr ""
754+
":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其"
755+
"例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。"
734756

735757
#: ../../library/unittest.mock.rst:760
736758
msgid ""
737759
"Mock objects that use a class or an instance as a :attr:`spec` or :attr:"
738760
"`spec_set` are able to pass :func:`isinstance` tests:"
739761
msgstr ""
762+
"使用類別或實例作為 :attr:`spec` 或 :attr:`spec_set` 的 mock 物件能夠通過 :"
763+
"func:`isinstance` 測試:"
740764

741765
#: ../../library/unittest.mock.rst:770
742766
msgid ""
743767
"The :class:`Mock` classes have support for mocking magic methods. See :ref:"
744768
"`magic methods <magic-methods>` for the full details."
745769
msgstr ""
770+
":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 <magic-"
771+
"methods>`。"
746772

747773
#: ../../library/unittest.mock.rst:773
748774
msgid ""
@@ -751,13 +777,18 @@ msgid ""
751777
"are passed to the constructor of the mock being created. The keyword "
752778
"arguments are for configuring attributes of the mock:"
753779
msgstr ""
780+
"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:"
781+
"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用"
782+
"於配置 mock 的屬性:"
754783

755784
#: ../../library/unittest.mock.rst:784
756785
msgid ""
757786
"The return value and side effect of child mocks can be set in the same way, "
758787
"using dotted notation. As you can't use dotted names directly in a call you "
759788
"have to create a dictionary and unpack it using ``**``:"
760789
msgstr ""
790+
"Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接"
791+
"在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:"
761792

762793
#: ../../library/unittest.mock.rst:799
763794
msgid ""
@@ -766,6 +797,11 @@ msgid ""
766797
"mock. Therefore, it can match the actual call's arguments regardless of "
767798
"whether they were passed positionally or by name::"
768799
msgstr ""
800+
"在匹配對 mock 的呼叫時,使用 *spec*(或 *spec_set*)建立的可呼叫 mock 將會內"
801+
"省規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的引數,無論它們是按位"
802+
"置傳遞還是按名稱傳遞:\n"
803+
"\n"
804+
"::"
769805

770806
#: ../../library/unittest.mock.rst:812
771807
msgid ""
@@ -774,10 +810,16 @@ msgid ""
774810
"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method "
775811
"calls on the mock object."
776812
msgstr ""
813+
"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock."
814+
"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock."
815+
"assert_any_call`。在使用 :ref:`auto-speccing` ,它還適用於 mock 物件的方法呼"
816+
"叫。"
777817

778818
#: ../../library/unittest.mock.rst:817
779819
msgid "Added signature introspection on specced and autospecced mock objects."
780820
msgstr ""
821+
"對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功"
822+
"能。"
781823

782824
#: ../../library/unittest.mock.rst:823
783825
msgid ""

0 commit comments

Comments
 (0)