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

Skip to content

Commit d6dbedc

Browse files
[po] auto sync
1 parent 7598fdc commit d6dbedc

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "90.52%", "updated_at": "2023-09-10T07:57:17Z"}
1+
{"translation": "90.53%", "updated_at": "2023-09-10T08:57:25Z"}

library/importlib.resources.po

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,26 @@ msgid ""
154154
"a context manager for use in a :keyword:`with` statement. The context "
155155
"manager provides a :class:`pathlib.Path` object."
156156
msgstr ""
157+
"给定一个代表文件或目录的 :class:`~importlib.resources.abc.Traversable` 对象,通常是来自 "
158+
":func:`importlib.resources.files`,返回一个上下文管理器以供 :keyword:`with` 语句使用。 "
159+
"该上下文管理器提供一个 :class:`pathlib.Path` 对象。"
157160

158161
#: ../../library/importlib.resources.rst:89
159162
msgid ""
160163
"Exiting the context manager cleans up any temporary file or directory "
161164
"created when the resource was extracted from e.g. a zip file."
162-
msgstr ""
165+
msgstr "退出上下文管理器后会清除从 zip 文件等提取资源时创建的任何临时文件或目录。"
163166

164167
#: ../../library/importlib.resources.rst:92
165168
msgid ""
166169
"Use ``as_file`` when the Traversable methods (``read_text``, etc) are "
167170
"insufficient and an actual file or directory on the file system is required."
168171
msgstr ""
172+
"当 Traversable 的方法(如 ``read_text`` 等)不足以满足需要而需要文件系统中的真实文件或目录时请使用 ``as_file``。"
169173

170174
#: ../../library/importlib.resources.rst:98
171175
msgid "Added support for ``traversable`` representing a directory."
172-
msgstr ""
176+
msgstr "增加了对代表目录的 ``traversable`` 的支持。"
173177

174178
#: ../../library/importlib.resources.rst:103
175179
msgid "Deprecated functions"

library/unittest.mock-examples.po

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,9 @@ msgid ""
593593
"in C, and so I couldn't just monkey-patch out the static "
594594
":meth:`datetime.date.today` method."
595595
msgstr ""
596+
"在某些测试中我希望模拟对 :meth:`datetime.date.today` 的调用来返回一个已知的日期,但又不想阻止被测试的代码创建新的日期对象。"
597+
" 不幸的是 :class:`datetime.date` 是用 C 语言编写的,因此我不能简单地给静态 "
598+
":meth:`datetime.date.today` 方法打上猴子补丁。"
596599

597600
#: ../../library/unittest.mock-examples.rst:608
598601
msgid ""
@@ -609,6 +612,9 @@ msgid ""
609612
"date. When the mock date class is called a real date will be constructed and"
610613
" returned by ``side_effect``. ::"
611614
msgstr ""
615+
"这里使用 :func:`patch 装饰器 <patch>` 来模拟被测试模块中的 ``date`` 类。 然后将模拟 date 类的 "
616+
":attr:`~Mock.side_effect` 属性设为一个返回真实日期的 lambda 函数。 当模拟 date 类被调用时,将通过 "
617+
"``side_effect`` 构造并返回一个真实日期。 ::"
612618

613619
#: ../../library/unittest.mock-examples.rst:626
614620
msgid ""
@@ -792,6 +798,8 @@ msgid ""
792798
":meth:`~Mock.assert_called_once_with` method that also asserts that the "
793799
":attr:`~Mock.call_count` is one."
794800
msgstr ""
801+
"如果你的 mock 只会被调用一次那么你可以使用 :meth:`~Mock.assert_called_once_with` 方法,该方法也会断言 "
802+
":attr:`~Mock.call_count` 的值为一。"
795803

796804
#: ../../library/unittest.mock-examples.rst:803
797805
msgid ""
@@ -858,6 +866,9 @@ msgid ""
858866
"methods for doing the assertion. Again a helper function sets this up for "
859867
"me. ::"
860868
msgstr ""
869+
"下面是一个使用 :attr:`~Mock.side_effect` 功能的解决方案。 如果你为 mock 提供了 ``side_effect`` "
870+
"函数那么 ``side_effect`` 将附带与该 mock 相同的参数被调用。 这样我们就有机会拷贝这些参数并将其保存起来用于之后执行断言。 "
871+
"在本例中我使用了 *另一个* mock 来保存参数以便可以使用该 mock 的方法来执行断言。 在这里辅助函数再次为我设置好了这一切。 ::"
861872

862873
#: ../../library/unittest.mock-examples.rst:891
863874
msgid ""
@@ -942,6 +953,9 @@ msgid ""
942953
"``side_effect`` is called with the key (and in the case of ``__setitem__`` "
943954
"the value too). We can also control what is returned."
944955
msgstr ""
956+
"当我们的 ``MagicMock`` 的 :meth:`~object.__getitem__` 和 "
957+
":meth:`~object.__setitem__` 方法被调用(即正常的字典访问操作)时 ``side_effect`` 将附带相应的键(对于 "
958+
"``__setitem__`` 还将附带值)被调用。 我们还可以控制返回的内容。"
945959

946960
#: ../../library/unittest.mock-examples.rst:1003
947961
msgid ""

0 commit comments

Comments
 (0)