@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"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 "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -17,7 +17,7 @@ msgstr ""
17
17
"Content-Type : text/plain; charset=UTF-8\n "
18
18
"Content-Transfer-Encoding : 8bit\n "
19
19
"Plural-Forms : nplurals=1; plural=0;\n "
20
- "X-Generator : Poedit 3.3.2 \n "
20
+ "X-Generator : Poedit 3.4 \n "
21
21
22
22
#: ../../library/unittest.mock.rst:3
23
23
msgid ":mod:`unittest.mock` --- mock object library"
@@ -670,46 +670,61 @@ msgid ""
670
670
"used for conveniently constructing lists of calls to compare with :attr:"
671
671
"`call_args_list`."
672
672
msgstr ""
673
+ "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。"
674
+ "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼"
675
+ "叫的串列,以便與 :attr:`call_args_list` 進行比較。"
673
676
674
677
#: ../../library/unittest.mock.rst:674
675
678
msgid ""
676
679
"Members of :attr:`call_args_list` are :data:`call` objects. These can be "
677
680
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
678
681
"tuples <calls-as-tuples>`."
679
682
msgstr ""
683
+ ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元"
684
+ "組,以取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
680
685
681
686
#: ../../library/unittest.mock.rst:681
682
687
msgid ""
683
688
"As well as tracking calls to themselves, mocks also track calls to methods "
684
689
"and attributes, and *their* methods and attributes:"
685
690
msgstr ""
691
+ "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼降,以及*它們(這些方"
692
+ "法和屬性)*的方法和屬性:"
686
693
687
694
#: ../../library/unittest.mock.rst:692
688
695
msgid ""
689
696
"Members of :attr:`method_calls` are :data:`call` objects. These can be "
690
697
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
691
698
"tuples <calls-as-tuples>`."
692
699
msgstr ""
700
+ ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以"
701
+ "取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
693
702
694
703
#: ../../library/unittest.mock.rst:699
695
704
msgid ""
696
705
":attr:`mock_calls` records *all* calls to the mock object, its methods, "
697
706
"magic methods *and* return value mocks."
698
707
msgstr ""
708
+ ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及"
709
+ "回傳值 mock。"
699
710
700
711
#: ../../library/unittest.mock.rst:717
701
712
msgid ""
702
713
"Members of :attr:`mock_calls` are :data:`call` objects. These can be "
703
714
"unpacked as tuples to get at the individual arguments. See :ref:`calls as "
704
715
"tuples <calls-as-tuples>`."
705
716
msgstr ""
717
+ ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以"
718
+ "取得各個引數。參見 :ref:`calls as tuples <calls-as-tuples>`。"
706
719
707
720
#: ../../library/unittest.mock.rst:723
708
721
msgid ""
709
722
"The way :attr:`mock_calls` are recorded means that where nested calls are "
710
723
"made, the parameters of ancestor calls are not recorded and so will always "
711
724
"compare equal:"
712
725
msgstr ""
726
+ ":attr:`mock_calls` 記錄的方式意味著在進行嵌套呼叫時,上代 (ancestor) 呼叫的參"
727
+ "數不會被記錄,因此在比較時它們將始終相等:"
713
728
714
729
#: ../../library/unittest.mock.rst:737
715
730
msgid ""
@@ -718,31 +733,42 @@ msgid ""
718
733
"instead. This allows mock objects to pass :func:`isinstance` tests for the "
719
734
"object they are replacing / masquerading as:"
720
735
msgstr ""
736
+ "通常,物件的 :attr:`__class__` 屬性會回傳它的型別。但對於擁有 :attr:`spec` "
737
+ "的 mock 物件,``__class__`` 會回傳 spec 的類別。這允許 mock 物件通過對它們所"
738
+ "替代或偽裝的物件進行的 :func:`isinstance` 測試:"
721
739
722
740
#: ../../library/unittest.mock.rst:746
723
741
msgid ""
724
742
":attr:`__class__` is assignable to, this allows a mock to pass an :func:"
725
743
"`isinstance` check without forcing you to use a spec:"
726
744
msgstr ""
745
+ ":attr:`__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不"
746
+ "需要強制使用 spec:"
727
747
728
748
#: ../../library/unittest.mock.rst:756
729
749
msgid ""
730
750
"A non-callable version of :class:`Mock`. The constructor parameters have the "
731
751
"same meaning of :class:`Mock`, with the exception of *return_value* and "
732
752
"*side_effect* which have no meaning on a non-callable mock."
733
753
msgstr ""
754
+ ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其"
755
+ "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。"
734
756
735
757
#: ../../library/unittest.mock.rst:760
736
758
msgid ""
737
759
"Mock objects that use a class or an instance as a :attr:`spec` or :attr:"
738
760
"`spec_set` are able to pass :func:`isinstance` tests:"
739
761
msgstr ""
762
+ "使用類別或實例作為 :attr:`spec` 或 :attr:`spec_set` 的 mock 物件能夠通過 :"
763
+ "func:`isinstance` 測試:"
740
764
741
765
#: ../../library/unittest.mock.rst:770
742
766
msgid ""
743
767
"The :class:`Mock` classes have support for mocking magic methods. See :ref:"
744
768
"`magic methods <magic-methods>` for the full details."
745
769
msgstr ""
770
+ ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 <magic-"
771
+ "methods>`。"
746
772
747
773
#: ../../library/unittest.mock.rst:773
748
774
msgid ""
@@ -751,13 +777,18 @@ msgid ""
751
777
"are passed to the constructor of the mock being created. The keyword "
752
778
"arguments are for configuring attributes of the mock:"
753
779
msgstr ""
780
+ "Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:"
781
+ "`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用"
782
+ "於配置 mock 的屬性:"
754
783
755
784
#: ../../library/unittest.mock.rst:784
756
785
msgid ""
757
786
"The return value and side effect of child mocks can be set in the same way, "
758
787
"using dotted notation. As you can't use dotted names directly in a call you "
759
788
"have to create a dictionary and unpack it using ``**``:"
760
789
msgstr ""
790
+ "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接"
791
+ "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:"
761
792
762
793
#: ../../library/unittest.mock.rst:799
763
794
msgid ""
@@ -766,6 +797,11 @@ msgid ""
766
797
"mock. Therefore, it can match the actual call's arguments regardless of "
767
798
"whether they were passed positionally or by name::"
768
799
msgstr ""
800
+ "在匹配對 mock 的呼叫時,使用 *spec*(或 *spec_set*)建立的可呼叫 mock 將會內"
801
+ "省規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的引數,無論它們是按位"
802
+ "置傳遞還是按名稱傳遞:\n"
803
+ "\n"
804
+ "::"
769
805
770
806
#: ../../library/unittest.mock.rst:812
771
807
msgid ""
@@ -774,10 +810,16 @@ msgid ""
774
810
"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method "
775
811
"calls on the mock object."
776
812
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
+ "叫。"
777
817
778
818
#: ../../library/unittest.mock.rst:817
779
819
msgid "Added signature introspection on specced and autospecced mock objects."
780
820
msgstr ""
821
+ "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功"
822
+ "能。"
781
823
782
824
#: ../../library/unittest.mock.rst:823
783
825
msgid ""
0 commit comments