@@ -1121,7 +1121,7 @@ msgid ""
1121
1121
"signature is that it takes arbitrary keyword arguments (``**kwargs``) which "
1122
1122
"are then passed onto the mock constructor:"
1123
1123
msgstr ""
1124
- "``Mock`` (及其各種形式)使用名為 ``_get_child_mock`` 的方法來為屬性和回傳值"
1124
+ "``Mock``(及其各種形式)使用名為 ``_get_child_mock`` 的方法來為屬性和回傳值"
1125
1125
"建立這些 \" 子 mock\" 。你可以透過置換此方法來防止你的子類別被用為屬性。其簽名"
1126
1126
"是取用任意的關鍵字引數(``**kwargs``\\ ),然後將其傳遞給 mock 建構函式:"
1127
1127
@@ -1144,7 +1144,7 @@ msgid ""
1144
1144
"inside a function. These are harder to mock because they aren't using an "
1145
1145
"object from the module namespace that we can patch out."
1146
1146
msgstr ""
1147
- "可能讓 mock 會很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進"
1147
+ "可能會讓 mock 很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進"
1148
1148
"行 mock,因為它們沒有使用我們可以 patch out 的模組命名空間中的物件。"
1149
1149
1150
1150
#: ../../library/unittest.mock-examples.rst:1134
@@ -1173,8 +1173,8 @@ msgid ""
1173
1173
msgstr ""
1174
1174
"除此之外,還有一種方法可以使用 ``mock`` 來影響 import 的結果。Import 會從 :"
1175
1175
"data:`sys.modules` 字典中取得一個\\ *物件*。請注意,它會取得一個\\ *物件*,而"
1176
- "該物件不一定是一個模組 。初次 import 模組會導致模組物件被放入 ``sys.modules`` "
1177
- "中,因此通常當你 import 某些東西時,你會得到一個模組。但情況並非總是如此 。"
1176
+ "該物件不需要是一個模組 。初次 import 模組會導致模組物件被放入 ``sys.modules`` "
1177
+ "中,因此通常當你 import 某些東西時,你會得到一個模組。但並非一定要如此 。"
1178
1178
1179
1179
#: ../../library/unittest.mock-examples.rst:1148
1180
1180
msgid ""
@@ -1185,7 +1185,7 @@ msgid ""
1185
1185
"whatever was there previously will be restored safely."
1186
1186
msgstr ""
1187
1187
"這代表你可以使用 :func:`patch.dict` 來\\ *暫時*\\ 在 :data:`sys.modules` 中原"
1188
- "地放置 mock。在這個 patch 存活時的任何 import 都會取得這個 mock。當 patch 完"
1188
+ "地放置 mock。在這個 patch 作用時的任何 import 都會取得這個 mock。當 patch 完"
1189
1189
"成時(被裝飾的函式結束、with 陳述式主體完成或 ``patcher.stop()`` 被呼叫),那"
1190
1190
"麼之前在 ``sys.modules`` 中的任何內容都會被安全地復原。"
1191
1191
@@ -1241,7 +1241,7 @@ msgid ""
1241
1241
"the ``mock_calls`` attribute on the manager mock:"
1242
1242
msgstr ""
1243
1243
"之後我們可以透過與管理器 (manager) mock 上的 ``mock_calls`` 屬性進行比較來斷"
1244
- "言呼叫的順序 :"
1244
+ "言呼叫及其順序 :"
1245
1245
1246
1246
#: ../../library/unittest.mock-examples.rst:1223
1247
1247
msgid ""
@@ -1293,8 +1293,8 @@ msgid ""
1293
1293
"Using the same basic concept as :data:`ANY` we can implement matchers to do "
1294
1294
"more complex assertions on objects used as arguments to mocks."
1295
1295
msgstr ""
1296
- "使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用作對 "
1297
- "mock 的引數的物件進行更複雜的斷言 。"
1296
+ "使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用來作為 "
1297
+ "mock 引數的物件進行更複雜的斷言 。"
1298
1298
1299
1299
#: ../../library/unittest.mock-examples.rst:1276
1300
1300
msgid ""
@@ -1305,8 +1305,8 @@ msgid ""
1305
1305
"attributes of this object then we can create a matcher that will check these "
1306
1306
"attributes for us."
1307
1307
msgstr ""
1308
- "假設我們希望將某些物件傳遞給一個 mock,預設情況下,該 mock 會根據物件識別性"
1309
- "(使用者定義類別的 Python 預設值)進行相等比較 。要使用 :meth:`~Mock."
1308
+ "假設我們預期某個物件會被傳進 mock,預設情況下,該 mock 會根據物件識別性"
1309
+ "進行相等比較(對使用者定義類別的 Python 預設行為) 。要使用 :meth:`~Mock."
1310
1310
"assert_called_with`,我們需要傳入完全相同的物件。如果我們只對該物件的某些屬性"
1311
1311
"感興趣,那麼我們可以建立一個匹配器來為我們檢查這些屬性。"
1312
1312
@@ -1326,7 +1326,7 @@ msgstr "對我們的 ``Foo`` 類別的比較函式看起來可能會像這樣:
1326
1326
msgid ""
1327
1327
"And a matcher object that can use comparison functions like this for its "
1328
1328
"equality operation would look something like this:"
1329
- msgstr "可以使用這樣的比較函式進行自身相等性運算的匹配器物件會長得像這樣 :"
1329
+ msgstr "而可以使用像這樣的比較函式進行其相等性運算的匹配器物件會長得像這樣 :"
1330
1330
1331
1331
#: ../../library/unittest.mock-examples.rst:1321
1332
1332
msgid "Putting all this together:"
@@ -1342,8 +1342,8 @@ msgid ""
1342
1342
"raised:"
1343
1343
msgstr ""
1344
1344
"``Matcher`` 是用我們想要比較的 ``Foo`` 物件和比較函式實例化的。在 "
1345
- "``assert_called_with`` 中,``Matcher`` 相等方法將被呼叫,它將呼叫 mock 的物件 "
1346
- "與我們建立匹配器的物件進行比較 。如果它們匹配,則 ``assert_called_with`` 會通"
1345
+ "``assert_called_with`` 中,``Matcher`` 相等方法將被呼叫,它將呼叫 mock 時傳入的物件 "
1346
+ "與我們建立匹配器時傳入的物件進行比較 。如果它們匹配,則 ``assert_called_with`` 會通"
1347
1347
"過,如果它們不匹配,則會引發 :exc:`AssertionError`:"
1348
1348
1349
1349
#: ../../library/unittest.mock-examples.rst:1339
@@ -1363,7 +1363,7 @@ msgid ""
1363
1363
"integration/#module-hamcrest.library.integration.match_equality>`_)."
1364
1364
msgstr ""
1365
1365
"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest <https://pyhamcrest."
1366
- "readthedocs.io/>`_ 提供了類似的功能,在這裡可能有用,以其相等匹配器的形式 "
1366
+ "readthedocs.io/>`_ 以其相等匹配器的形式, 提供了類似的功能,在這裡可能是有用的 "
1367
1367
"(\\ `hamcrest.library.integration.match_equality <https://pyhamcrest."
1368
1368
"readthedocs.io/en/release-1.8/integration/#module-hamcrest.library."
1369
1369
"integration.match_equality>`_\\ )。"
0 commit comments