Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e180c76

Browse files
ken71301mindihx
andcommitted
Apply suggestions from code review
Co-authored-by: mindihx <[email protected]>
1 parent 9e56c73 commit e180c76

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

library/unittest.mock-examples.po

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ msgid ""
11211121
"signature is that it takes arbitrary keyword arguments (``**kwargs``) which "
11221122
"are then passed onto the mock constructor:"
11231123
msgstr ""
1124-
"``Mock`` (及其各種形式)使用名為 ``_get_child_mock`` 的方法來為屬性和回傳值"
1124+
"``Mock``(及其各種形式)使用名為 ``_get_child_mock`` 的方法來為屬性和回傳值"
11251125
"建立這些 \"子 mock\"。你可以透過置換此方法來防止你的子類別被用為屬性。其簽名"
11261126
"是取用任意的關鍵字引數(``**kwargs``\\ ),然後將其傳遞給 mock 建構函式:"
11271127

@@ -1144,7 +1144,7 @@ msgid ""
11441144
"inside a function. These are harder to mock because they aren't using an "
11451145
"object from the module namespace that we can patch out."
11461146
msgstr ""
1147-
"可能讓 mock 會很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進"
1147+
"可能會讓 mock 很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進"
11481148
"行 mock,因為它們沒有使用我們可以 patch out 的模組命名空間中的物件。"
11491149

11501150
#: ../../library/unittest.mock-examples.rst:1134
@@ -1173,8 +1173,8 @@ msgid ""
11731173
msgstr ""
11741174
"除此之外,還有一種方法可以使用 ``mock`` 來影響 import 的結果。Import 會從 :"
11751175
"data:`sys.modules` 字典中取得一個\\ *物件*。請注意,它會取得一個\\ *物件*,而"
1176-
"該物件不一定是一個模組。初次 import 模組會導致模組物件被放入 ``sys.modules`` "
1177-
"中,因此通常當你 import 某些東西時,你會得到一個模組。但情況並非總是如此。"
1176+
"該物件不需要是一個模組。初次 import 模組會導致模組物件被放入 ``sys.modules`` "
1177+
"中,因此通常當你 import 某些東西時,你會得到一個模組。但並非一定要如此。"
11781178

11791179
#: ../../library/unittest.mock-examples.rst:1148
11801180
msgid ""
@@ -1185,7 +1185,7 @@ msgid ""
11851185
"whatever was there previously will be restored safely."
11861186
msgstr ""
11871187
"這代表你可以使用 :func:`patch.dict` 來\\ *暫時*\\ 在 :data:`sys.modules` 中原"
1188-
"地放置 mock。在這個 patch 存活時的任何 import 都會取得這個 mock。當 patch 完"
1188+
"地放置 mock。在這個 patch 作用時的任何 import 都會取得這個 mock。當 patch 完"
11891189
"成時(被裝飾的函式結束、with 陳述式主體完成或 ``patcher.stop()`` 被呼叫),那"
11901190
"麼之前在 ``sys.modules`` 中的任何內容都會被安全地復原。"
11911191

@@ -1241,7 +1241,7 @@ msgid ""
12411241
"the ``mock_calls`` attribute on the manager mock:"
12421242
msgstr ""
12431243
"之後我們可以透過與管理器 (manager) mock 上的 ``mock_calls`` 屬性進行比較來斷"
1244-
"言呼叫的順序:"
1244+
"言呼叫及其順序:"
12451245

12461246
#: ../../library/unittest.mock-examples.rst:1223
12471247
msgid ""
@@ -1293,8 +1293,8 @@ msgid ""
12931293
"Using the same basic concept as :data:`ANY` we can implement matchers to do "
12941294
"more complex assertions on objects used as arguments to mocks."
12951295
msgstr ""
1296-
"使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用作對 "
1297-
"mock 的引數的物件進行更複雜的斷言。"
1296+
"使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用來作為 "
1297+
"mock 引數的物件進行更複雜的斷言。"
12981298

12991299
#: ../../library/unittest.mock-examples.rst:1276
13001300
msgid ""
@@ -1305,8 +1305,8 @@ msgid ""
13051305
"attributes of this object then we can create a matcher that will check these "
13061306
"attributes for us."
13071307
msgstr ""
1308-
"假設我們希望將某些物件傳遞給一個 mock,預設情況下,該 mock 會根據物件識別性"
1309-
"(使用者定義類別的 Python 預設值)進行相等比較。要使用 :meth:`~Mock."
1308+
"假設我們預期某個物件會被傳進 mock,預設情況下,該 mock 會根據物件識別性"
1309+
"進行相等比較(對使用者定義類別的 Python 預設行為)。要使用 :meth:`~Mock."
13101310
"assert_called_with`,我們需要傳入完全相同的物件。如果我們只對該物件的某些屬性"
13111311
"感興趣,那麼我們可以建立一個匹配器來為我們檢查這些屬性。"
13121312

@@ -1326,7 +1326,7 @@ msgstr "對我們的 ``Foo`` 類別的比較函式看起來可能會像這樣:
13261326
msgid ""
13271327
"And a matcher object that can use comparison functions like this for its "
13281328
"equality operation would look something like this:"
1329-
msgstr "可以使用這樣的比較函式進行自身相等性運算的匹配器物件會長得像這樣:"
1329+
msgstr "而可以使用像這樣的比較函式進行其相等性運算的匹配器物件會長得像這樣:"
13301330

13311331
#: ../../library/unittest.mock-examples.rst:1321
13321332
msgid "Putting all this together:"
@@ -1342,8 +1342,8 @@ msgid ""
13421342
"raised:"
13431343
msgstr ""
13441344
"``Matcher`` 是用我們想要比較的 ``Foo`` 物件和比較函式實例化的。在 "
1345-
"``assert_called_with`` 中,``Matcher`` 相等方法將被呼叫,它將呼叫 mock 的物件"
1346-
"與我們建立匹配器的物件進行比較。如果它們匹配,則 ``assert_called_with`` 會通"
1345+
"``assert_called_with`` 中,``Matcher`` 相等方法將被呼叫,它將呼叫 mock 時傳入的物件"
1346+
"與我們建立匹配器時傳入的物件進行比較。如果它們匹配,則 ``assert_called_with`` 會通"
13471347
"過,如果它們不匹配,則會引發 :exc:`AssertionError`:"
13481348

13491349
#: ../../library/unittest.mock-examples.rst:1339
@@ -1363,7 +1363,7 @@ msgid ""
13631363
"integration/#module-hamcrest.library.integration.match_equality>`_)."
13641364
msgstr ""
13651365
"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest <https://pyhamcrest."
1366-
"readthedocs.io/>`_ 提供了類似的功能,在這裡可能有用,以其相等匹配器的形式 "
1366+
"readthedocs.io/>`_ 以其相等匹配器的形式,提供了類似的功能,在這裡可能是有用的 "
13671367
"(\\ `hamcrest.library.integration.match_equality <https://pyhamcrest."
13681368
"readthedocs.io/en/release-1.8/integration/#module-hamcrest.library."
13691369
"integration.match_equality>`_\\ )。"

0 commit comments

Comments
 (0)