@@ -8,7 +8,7 @@ msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"POT-Creation-Date : 2023-07-22 00:04+0000\n "
11
- "PO-Revision-Date : 2023-09-09 23:07 +0800\n "
11
+ "PO-Revision-Date : 2023-09-26 00:39 +0800\n "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
@@ -253,16 +253,16 @@ msgid ""
253
253
"class of :class:`Mock` using the *new_callable* argument to :func:`patch`."
254
254
msgstr ""
255
255
":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。"
256
- "預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使 "
257
- "用 : func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。"
256
+ "預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 : "
257
+ "func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。"
258
258
259
259
#: ../../library/unittest.mock.rst:231
260
260
msgid ""
261
261
"Create a new :class:`Mock` object. :class:`Mock` takes several optional "
262
262
"arguments that specify the behaviour of the Mock object:"
263
263
msgstr ""
264
- "建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 "
265
- "Mock 物件的行為:"
264
+ "建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 Mock "
265
+ "物件的行為:"
266
266
267
267
#: ../../library/unittest.mock.rst:234
268
268
msgid ""
@@ -428,8 +428,8 @@ msgid ""
428
428
"assert the mock has been called with the specified calls. The :attr:"
429
429
"`mock_calls` list is checked for the calls."
430
430
msgstr ""
431
- "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列中的 "
432
- "呼叫 。"
431
+ "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列 "
432
+ "中的呼叫 。"
433
433
434
434
#: ../../library/unittest.mock.rst:365
435
435
msgid ""
@@ -449,15 +449,15 @@ msgstr ""
449
449
450
450
#: ../../library/unittest.mock.rst:384
451
451
msgid "Assert the mock was never called."
452
- msgstr ""
452
+ msgstr "斷言 mock 從未被呼叫。 "
453
453
454
454
#: ../../library/unittest.mock.rst:399
455
455
msgid "The reset_mock method resets all the call attributes on a mock object:"
456
- msgstr ""
456
+ msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性: "
457
457
458
458
#: ../../library/unittest.mock.rst:409
459
459
msgid "Added two keyword-only arguments to the reset_mock function."
460
- msgstr ""
460
+ msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。 "
461
461
462
462
#: ../../library/unittest.mock.rst:412
463
463
msgid ""
@@ -468,73 +468,89 @@ msgid ""
468
468
"`side_effect`, then pass the corresponding parameter as ``True``. Child "
469
469
"mocks and the return value mock (if any) are reset as well."
470
470
msgstr ""
471
+ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況下,:"
472
+ "meth:`reset_mock` *不會* 清除回傳值、:attr:`side_effect` 或使用普通賦值設定的"
473
+ "任何子屬性。如果你想要重置 *return_value* 或 :attr:`side_effect`,則將相應的"
474
+ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。"
471
475
472
476
#: ../../library/unittest.mock.rst:420
473
477
msgid "*return_value*, and :attr:`side_effect` are keyword-only arguments."
474
- msgstr ""
478
+ msgstr "*return_value* 和 :attr:`side_effect` 是僅限關鍵字引數。 "
475
479
476
480
#: ../../library/unittest.mock.rst:426
477
481
msgid ""
478
482
"Add a spec to a mock. *spec* can either be an object or a list of strings. "
479
483
"Only attributes on the *spec* can be fetched as attributes from the mock."
480
484
msgstr ""
485
+ "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of "
486
+ "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。"
481
487
482
488
#: ../../library/unittest.mock.rst:430
483
489
msgid "If *spec_set* is true then only attributes on the spec can be set."
484
- msgstr ""
490
+ msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。 "
485
491
486
492
#: ../../library/unittest.mock.rst:435
487
493
msgid ""
488
494
"Attach a mock as an attribute of this one, replacing its name and parent. "
489
495
"Calls to the attached mock will be recorded in the :attr:`method_calls` and :"
490
496
"attr:`mock_calls` attributes of this one."
491
497
msgstr ""
498
+ "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 "
499
+ "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` "
500
+ "屬性中。"
492
501
493
502
#: ../../library/unittest.mock.rst:442
494
503
msgid "Set attributes on the mock through keyword arguments."
495
- msgstr ""
504
+ msgstr "透過關鍵字參數在 mock 上設定屬性。 "
496
505
497
506
#: ../../library/unittest.mock.rst:444
498
507
msgid ""
499
508
"Attributes plus return values and side effects can be set on child mocks "
500
509
"using standard dot notation and unpacking a dictionary in the method call:"
501
510
msgstr ""
511
+ "可以使用標準點記法 (dot notation) 並在使用 method(方法)呼叫時將字典拆開,"
512
+ "為 child mock 設定屬性、回傳值和 side effects:"
502
513
503
514
#: ../../library/unittest.mock.rst:458
504
515
msgid "The same thing can be achieved in the constructor call to mocks:"
505
- msgstr ""
516
+ msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現: "
506
517
507
518
#: ../../library/unittest.mock.rst:471
508
519
msgid ""
509
520
":meth:`configure_mock` exists to make it easier to do configuration after "
510
521
"the mock has been created."
511
522
msgstr ""
523
+ ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。"
512
524
513
525
#: ../../library/unittest.mock.rst:477
514
526
msgid ""
515
527
":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful "
516
528
"results. For mocks with a *spec* this includes all the permitted attributes "
517
529
"for the mock."
518
530
msgstr ""
531
+ ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 "
532
+ "*spec* 的 mock,這包含所有被允許的 mock 屬性。"
519
533
520
534
#: ../../library/unittest.mock.rst:481
521
535
msgid ""
522
536
"See :data:`FILTER_DIR` for what this filtering does, and how to switch it "
523
537
"off."
524
- msgstr ""
538
+ msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。 "
525
539
526
540
#: ../../library/unittest.mock.rst:487
527
541
msgid ""
528
542
"Create the child mocks for attributes and return value. By default child "
529
543
"mocks will be the same type as the parent. Subclasses of Mock may want to "
530
544
"override this to customize the way child mocks are made."
531
545
msgstr ""
546
+ "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相"
547
+ "同的類型。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。"
532
548
533
549
#: ../../library/unittest.mock.rst:492
534
550
msgid ""
535
551
"For non-callable mocks the callable variant will be used (rather than any "
536
552
"custom subclass)."
537
- msgstr ""
553
+ msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。 "
538
554
539
555
#: ../../library/unittest.mock.rst:498
540
556
msgid "A boolean representing whether or not the mock object has been called:"
0 commit comments