File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
- {"translation" : " 80.42 %" , "updated_at" : " 2024-12-26T03:04:10Z " }
1
+ {"translation" : " 80.43 %" , "updated_at" : " 2024-12-26T06:56:05Z " }
Original file line number Diff line number Diff line change @@ -3328,6 +3328,9 @@ msgid ""
3328
3328
"methods have the same call signature as the original so they raise a "
3329
3329
":exc:`TypeError` if they are called incorrectly."
3330
3330
msgstr ""
3331
+ "自动 spec 是基于 mock 现有的 :attr:`!spec` 特性。 它将 mock 的 api 限制为原始对象(spec)的 "
3332
+ "api,但它是递归(惰性实现)的因而 mock 的属性只有与 spec 的属性相同的 api。 除此之外被模拟的函数 / "
3333
+ "方法具有与原对应物相同的调用签名因此如果它们被不正确地调用时会引发 :exc:`TypeError`。"
3331
3334
3332
3335
#: ../../library/unittest.mock.rst:2599
3333
3336
msgid "Before I explain how auto-speccing works, here's why it is needed."
@@ -3371,6 +3374,8 @@ msgid ""
3371
3374
"then you can only access attributes on the mock that exist on the real "
3372
3375
"class:"
3373
3376
msgstr ""
3377
+ ":mod:`unittest.mock` 已经提供了一个对此有帮助的特性,称为 spec 控制。 如果你使用类或实例作为一个 mock 的 "
3378
+ ":attr:`!spec` 那么你将仅能访问 mock 中只存在于实际的类中的属性:"
3374
3379
3375
3380
#: ../../library/unittest.mock.rst:2628
3376
3381
msgid ""
You can’t perform that action at this time.
0 commit comments