Skip to content

Commit b74be57

Browse files
committed
docs: mock 翻譯
translate from 254 to 369
1 parent d8e1cac commit b74be57

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

library/unittest.mock.po

+35-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: Python 3.12\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2023-07-22 00:04+0000\n"
11-
"PO-Revision-Date: 2023-09-05 00:58+0800\n"
11+
"PO-Revision-Date: 2023-09-07 23:26+0800\n"
1212
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1414
"tw)\n"
@@ -315,23 +315,29 @@ msgid ""
315315
"Alternatively *side_effect* can be an exception class or instance. In this "
316316
"case the exception will be raised when the mock is called."
317317
msgstr ""
318+
"*side_effect* 也可以是一個例外的類別或實例。在這種情況下,當呼叫 mock 時,該"
319+
"例外將被引發。"
318320

319321
#: ../../library/unittest.mock.rst:257
320322
msgid ""
321323
"If *side_effect* is an iterable then each call to the mock will return the "
322324
"next value from the iterable."
323325
msgstr ""
326+
"如果 *side_effect* 是一個可疊代物件,那麼對 mock 的每次呼叫將回傳可疊代物件中"
327+
"的下一個值。"
324328

325329
#: ../../library/unittest.mock.rst:260
326330
msgid "A *side_effect* can be cleared by setting it to ``None``."
327-
msgstr ""
331+
msgstr "*side_effect* 可以通過將其設置為 ``None`` 來清除。"
328332

329333
#: ../../library/unittest.mock.rst:262
330334
msgid ""
331335
"*return_value*: The value returned when the mock is called. By default this "
332336
"is a new Mock (created on first access). See the :attr:`return_value` "
333337
"attribute."
334338
msgstr ""
339+
"*return_value*:當呼叫 mock 時回傳的值。默認情況下,這是一個新的 Mock(在首次"
340+
"存取時建立)。參見 :attr:`return_value` 屬性。"
335341

336342
#: ../../library/unittest.mock.rst:266
337343
msgid ""
@@ -340,6 +346,9 @@ msgid ""
340346
"`AttributeError`. Passing ``unsafe=True`` will allow access to these "
341347
"attributes."
342348
msgstr ""
349+
"*unsafe*:默認情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 "
350+
"*assrt* 開頭的屬性將引發 :exc:`AttributeError`。如果傳遞 ``unsafe=True``\\ ,"
351+
"將會允許存取這些屬性。"
343352

344353
#: ../../library/unittest.mock.rst:273
345354
msgid ""
@@ -350,49 +359,59 @@ msgid ""
350359
"to access an attribute that doesn't exist will raise an :exc:"
351360
"`AttributeError`)."
352361
msgstr ""
362+
"*wraps*:被 mock 物件包裹的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將"
363+
"通過被包裹的物件(返回真實結果)。存取 mock 的屬性將會返回一個 Mock 物件,該"
364+
"物件包裹了被包裹物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:"
365+
"`AttributeError`\\ )。"
353366

354367
#: ../../library/unittest.mock.rst:280
355368
msgid ""
356369
"If the mock has an explicit *return_value* set then calls are not passed to "
357370
"the wrapped object and the *return_value* is returned instead."
358371
msgstr ""
372+
"如果 mock 已經明確設定了 *return_value*,那麼呼叫並不會被傳遞到被包裹的物件,"
373+
"而是回傳已設定好的 *return_value*。"
359374

360375
#: ../../library/unittest.mock.rst:283
361376
msgid ""
362377
"*name*: If the mock has a name then it will be used in the repr of the mock. "
363378
"This can be useful for debugging. The name is propagated to child mocks."
364379
msgstr ""
380+
"*name*:如果 mock 有一個名稱,那麼它會被用於 mock 的 repr(表示形式)。這對於"
381+
"除錯很有用。此名稱將被傳播到子 mocks。"
365382

366383
#: ../../library/unittest.mock.rst:287
367384
msgid ""
368385
"Mocks can also be called with arbitrary keyword arguments. These will be "
369386
"used to set attributes on the mock after it is created. See the :meth:"
370387
"`configure_mock` method for details."
371388
msgstr ""
389+
"Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在創建 mock 之後用"
390+
"於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。"
372391

373392
#: ../../library/unittest.mock.rst:293
374393
msgid "Assert that the mock was called at least once."
375-
msgstr ""
394+
msgstr "確認 mock 至少被呼叫一次。"
376395

377396
#: ../../library/unittest.mock.rst:304
378397
msgid "Assert that the mock was called exactly once."
379-
msgstr ""
398+
msgstr "確認 mock 只被呼叫一次。"
380399

381400
#: ../../library/unittest.mock.rst:322
382401
msgid ""
383402
"This method is a convenient way of asserting that the last call has been "
384403
"made in a particular way:"
385-
msgstr ""
404+
msgstr "這個方法是一個便利的方式,用來斷言最後一次呼叫是以特定方式進行的:"
386405

387406
#: ../../library/unittest.mock.rst:332
388407
msgid ""
389408
"Assert that the mock was called exactly once and that call was with the "
390409
"specified arguments."
391-
msgstr ""
410+
msgstr "確認 mock 只被呼叫一次,且該次呼叫使用了指定的引數。"
392411

393412
#: ../../library/unittest.mock.rst:347
394413
msgid "assert the mock has been called with the specified arguments."
395-
msgstr ""
414+
msgstr "斷言 mock 已經被使用指定的引數呼叫。"
396415

397416
#: ../../library/unittest.mock.rst:349
398417
msgid ""
@@ -401,24 +420,33 @@ msgid ""
401420
"the call is the most recent one, and in the case of :meth:"
402421
"`assert_called_once_with` it must also be the only call."
403422
msgstr ""
423+
"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :"
424+
"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:"
425+
"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。"
404426

405427
#: ../../library/unittest.mock.rst:362
406428
msgid ""
407429
"assert the mock has been called with the specified calls. The :attr:"
408430
"`mock_calls` list is checked for the calls."
409431
msgstr ""
432+
"斷言 mock 已經使用指定的呼叫所呼叫。此斷言會檢查 :attr:`mock_calls` 串列中的"
433+
"呼叫。"
410434

411435
#: ../../library/unittest.mock.rst:365
412436
msgid ""
413437
"If *any_order* is false then the calls must be sequential. There can be "
414438
"extra calls before or after the specified calls."
415439
msgstr ""
440+
"如果 *any_order* 為 false,那麼這些呼叫必須按照順序。在指定的呼叫之前或之後可"
441+
"以有額外的呼叫。"
416442

417443
#: ../../library/unittest.mock.rst:369
418444
msgid ""
419445
"If *any_order* is true then the calls can be in any order, but they must all "
420446
"appear in :attr:`mock_calls`."
421447
msgstr ""
448+
"如果 *any_order* 為 true,那麼這些乎醬可以以任何順序出現,但它們必須全部出現"
449+
"在 :attr:`mock_calls` 中。"
422450

423451
#: ../../library/unittest.mock.rst:384
424452
msgid "Assert the mock was never called."

0 commit comments

Comments
 (0)