@@ -2192,27 +2192,31 @@ msgid ""
21922192" sentinel objects to test this. :data:`sentinel` provides a convenient way "
21932193"of creating and testing the identity of objects like this."
21942194msgstr ""
2195+ "在测试时你可能需要测试是否有一个特定的对象作为参数被传给了另一个方法,或是被其返回。 通常的做法是创建一个指定名称的 sentinel "
2196+ "对象来执行这种测试。 :data:`sentinel` 提供了一种创建和测试此类对象的标识的便捷方式。"
21952197
21962198#: ../../library/unittest.mock.rst:2203
21972199msgid ""
21982200"In this example we monkey patch ``method`` to return "
21992201"``sentinel.some_object``:"
2200- msgstr ""
2202+ msgstr "在这个示例中我们为 ``method`` 打上便捷补丁以返回 ``sentinel.some_object``: "
22012203
22022204#: ../../library/unittest.mock.rst:2215
22032205msgid "DEFAULT"
2204- msgstr ""
2206+ msgstr "DEFAULT "
22052207
22062208#: ../../library/unittest.mock.rst:2220
22072209msgid ""
22082210"The :data:`DEFAULT` object is a pre-created sentinel (actually "
22092211"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions"
22102212" to indicate that the normal return value should be used."
22112213msgstr ""
2214+ ":data:`DEFAULT` 对象是一个预先创建的 sentinel (实际为 ``sentinel.DEFAULT``)。 它可被 "
2215+ ":attr:`~Mock.side_effect` 函数用来指明其应当使用正常的返回值。"
22122216
22132217#: ../../library/unittest.mock.rst:2226
22142218msgid "call"
2215- msgstr ""
2219+ msgstr "call "
22162220
22172221#: ../../library/unittest.mock.rst:2230
22182222msgid ""
@@ -2221,12 +2225,16 @@ msgid ""
22212225":attr:`~Mock.mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can "
22222226"also be used with :meth:`~Mock.assert_has_calls`."
22232227msgstr ""
2228+ ":func:`call` 是一个可创建更简单断言的辅助对象,用于同 :attr:`~Mock.call_args`, "
2229+ ":attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` 和 "
2230+ ":attr:`~Mock.method_calls` 进行比较。 :func:`call` 也可配合 "
2231+ ":meth:`~Mock.assert_has_calls` 使用。"
22242232
22252233#: ../../library/unittest.mock.rst:2243
22262234msgid ""
22272235"For a call object that represents multiple calls, :meth:`call_list` returns "
22282236"a list of all the intermediate calls as well as the final call."
2229- msgstr ""
2237+ msgstr "对于代表多个调用的 call 对象,:meth:`call_list` 将返回一个包含所有中间调用以及最终调用的列表。 "
22302238
22312239#: ../../library/unittest.mock.rst:2247
22322240msgid ""
@@ -2235,12 +2243,14 @@ msgid ""
22352243"results in multiple entries in :attr:`~Mock.mock_calls` on a mock. Manually "
22362244"constructing the sequence of calls can be tedious."
22372245msgstr ""
2246+ "``call_list`` 特别适用于创建针对“链式调用”的断言。 链式调用是指在一行代码中执行的多个调用。 这将使得一个 mock 的中存在多个条目 "
2247+ ":attr:`~Mock.mock_calls`。 手动构造调用的序列将会很烦琐。"
22382248
22392249#: ../../library/unittest.mock.rst:2252
22402250msgid ""
22412251":meth:`~call.call_list` can construct the sequence of calls from the same "
22422252"chained call:"
2243- msgstr ""
2253+ msgstr ":meth:`~call.call_list` 可以根据同一个链式调用构造包含多个调用的序列: "
22442254
22452255#: ../../library/unittest.mock.rst:2269
22462256msgid ""
0 commit comments