8000 [po] auto sync · python/python-docs-zh-cn@e3ec14c · GitHub
[go: up one dir, main page]

Skip to content

Commit e3ec14c

Browse files
[po] auto sync
1 parent 8f0a5b6 commit e3ec14c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "80.42%", "updated_at": "2024-12-26T03:04:10Z"}
1+
{"translation": "80.43%", "updated_at": "2024-12-26T06:56:05Z"}

library/unittest.mock.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3328,6 +3328,9 @@ msgid ""
33283328
"methods have the same call signature as the original so they raise a "
33293329
":exc:`TypeError` if they are called incorrectly."
33303330
msgstr ""
3331+
"自动 spec 是基于 mock 现有的 :attr:`!spec` 特性。 它将 mock 的 api 限制为原始对象(spec)的 "
3332+
"api,但它是递归(惰性实现)的因而 mock 的属性只有与 spec 的属性相同的 api。 除此之外被模拟的函数 / "
3333+
"方法具有与原对应物相同的调用签名因此如果它们被不正确地调用时会引发 :exc:`TypeError`。"
33313334

33323335
#: ../../library/unittest.mock.rst:2599
33333336
msgid "Before I explain how auto-speccing works, here's why it is needed."
@@ -3371,6 +3374,8 @@ msgid ""
33713374
"then you can only access attributes on the mock that exist on the real "
33723375
"class:"
33733376
msgstr ""
3377+
":mod:`unittest.mock` 已经提供了一个对此有帮助的特性,称为 spec 控制。 如果你使用类或实例作为一个 mock 的 "
3378+
":attr:`!spec` 那么你将仅能访问 mock 中只存在于实际的类中的属性:"
33743379

33753380
#: ../../library/unittest.mock.rst:2628
33763381
msgid ""

0 commit comments

Comments
 (0)
0