Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Translate mock example to rst:99#705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mattwang44 merged 4 commits intopython:3.12fromken71301:translate-mock-example
Nov 29, 2023

Conversation

ken71301
Copy link
Collaborator

@mattwang44
Copy link
Collaborator

Hi@mindihx
would you please review this PR when you're available?

mindihx reacted with eyes emoji

Copy link
Collaborator

@mindihxmindihx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

抱歉有點晚看到所以比較晚回...

@@ -17,49 +17,56 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.4\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這一行 poedit 產生的可以拿掉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這我覺得不修改沒關係,畢竟是自動產生的、也不會影響到翻譯內容

mindihx reacted with thumbs up emoji

#: ../../library/unittest.mock-examples.rst:45
msgid ""
"Once our mock has been used (``real.method`` in this example) it has methods "
"and attributes that allow you to make assertions about how it has been used."
msgstr ""
"一旦我們的 mock 已經被使用(例如在這個範例中的 ``real.method``),它就有了方"
"法和屬性,允許你對其使用方式進行 assertions (斷言)。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

建議可以先翻中文再附註英文,以下同理

Suggested change
"法和屬性,允許你對其使用方式進行assertions (斷言)"
"法和屬性,允許你對其使用方式進行斷言 (assertions)"

@@ -68,16 +75,21 @@ msgid ""
"or :meth:`~Mock.assert_called_once_with` method to check that it was called "
"with the correct arguments."
msgstr ""
"一旦 mock 被呼叫,它的 :attr:`~Mock.called` 屬性將被設定為 ``True``。更重要的"
"是,我們可以使用 :meth:`~Mock.assert_called_with` 或 :meth:`~Mock."
"assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼叫。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這樣可能會簡潔一點?
來檢查它是否以正確的引數呼叫

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這邊我的話還是想把被動式翻出來(be called with)

mindihx reacted with thumbs up emoji
@@ -86,18 +98,25 @@ msgid ""
"method (or some part of the system under test) and then check that it is "
"used in the correct way."
msgstr ""
"在上一個範例中,我們直接對物件上的方法進行 patch,以檢查它是否被正確呼叫。另"
"一個常見的用法是將一個物件傳遞給一個方法(或測試系統的某一部分),然後檢查它"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這邊用受測系統會不會比較明確一點?

Suggested change
"一個常見的用法是將一個物件傳遞給一個方法(或測試系統的某一部分),然後檢查它"
"一個常見的用法是將一個物件傳遞給一個方法(或受測系統的某一部分),然後檢查它"


#: ../../library/unittest.mock-examples.rst:83
msgid ""
"The simple ``ProductionClass`` below has a ``closer`` method. If it is "
"called with an object then it calls ``close`` on it."
msgstr ""
"下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

這邊應該不是被一個物件呼叫,而是傳入一個物件?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

主要是called 能不能翻成傳入吧? 雖然感覺是比較順沒錯

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

我先用傳入吧,用物件呼叫確實怪怪的

Comment on lines 128 to 130
"我們不必為我們的 mock 提供 'close' 方法。存取 close 會建立它。因此,如果 "
"'close' 並未被呼叫過,在測試流程中存取 'close' 就會建立它,但 :meth:`~Mock."
"assert_called_with` 就會引發一個失敗的例外。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
"我們不必為我們的 mock 提供 'close' 方法存取 close會建立它。因此,如果"
"'close' 並未被呼叫過,在測試流程中存取 'close'就會建立它,但 :meth:`~Mock."
"assert_called_with` 就會引發一個失敗的例外。"
"我們不必做任何額外的事情來為 mock 提供 'close' 方法存取 close就會建立它。因此,如果"
"'close' 並未被呼叫過,在測試中存取 'close'會建立它,但 :meth:`~Mock."
"assert_called_with` 就會引發一個失敗的例外。"


#: ../../library/unittest.mock-examples.rst:30
msgid "Mock Patching Methods"
msgstr ""
msgstr "使用 Mock 來 patching methods(方法)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

建議這裡可以翻 patch 然後再以英文加註
e.g.使用 Mock 來修補 (patching) 方法
但我也不太確定 patch 怎麼翻比較好也或者就統一都不翻,可能可以在哪邊 (e.g. discord) 討論一下?
cc@mattwang44

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

discussion那邊是暫定不翻
#591

mindihx reacted with thumbs up emoji
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@ken71301
如果 patch 不翻的話這邊感覺可以寫成使用 Mock 來 patch 方法~?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

可以的,mock & patch 一起加上去好了~


#: ../../library/unittest.mock-examples.rst:50
msgid ""
"In most of these examples the :class:`Mock` and :class:`MagicMock` classes "
"are interchangeable. As the ``MagicMock`` is the more capable class it makes "
"a sensible one to use by default."
msgstr ""
"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock` class(類別)是可以互換"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

不過類別算是蠻常見的詞,不一定需要附註

Suggested change
"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock`class(類別)是可以互換"
"在大多數的範例中,:class:`Mock` 和 :class:`MagicMock`類別 (class)是可以互換"

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

mindihx reacted with thumbs up emoji
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@mattwang44
確認一下class 我們需要翻成class(類別)
如果只需要翻成類別 或者類別 (class) 的話那 wiki 要不要也調整一下
再順便確認一下翻譯的時候是翻成中文再附註英文對嗎,因為 wiki 那頁看起來都是英文再附註中文,README 那邊則是提到

在翻譯名稱不常用或不確定的情形,宜用括號註解或直接保留原文。單頁只要首次出現有註解即可。例如:正規表示式 (regular expression)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

我也覺得不一定要附註,就請你們直接更改 wiki 🙏🏽


#: ../../library/unittest.mock-examples.rst:76
msgid "Mock for Method Calls on an Object"
msgstr ""
msgstr "在物件上的方法呼叫時使用 mock"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
msgstr "在物件上的方法呼叫時使用 mock"
msgstr "對物件的方法呼叫使用 mock"


#: ../../library/unittest.mock-examples.rst:83
msgid ""
"The simple ``ProductionClass`` below has a ``closer`` method. If it is "
"called with an object then it calls ``close`` on it."
msgstr ""
"下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

因為英文裡前文最後提到 closer 方法,所以比較明確後文的 it 是指 closer 方法
但目前中文的翻譯這個 會比較像是指 ProductionClass

Suggested change
"下面是一個含有 ``closer`` 方法的單純的 ``ProductionClass``。如果它被一個物件"
"下面是一個單純的 ``ProductionClass``,含有一個 ``closer`` 方法。如果它傳入一個物件"

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

是指哪個it ?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

歐我了解你意思了 沒事 :D

mindihx
mindihx previously approved these changesNov 22, 2023
Co-authored-by: mindihx <ymhuang.ymh@gmail.com>
@mattwang44mattwang44 merged commit4dbeab8 intopython:3.12Nov 29, 2023
isabellechiu pushed a commit to isabellechiu/python-docs-zh-tw that referenced this pull requestDec 5, 2023
Co-authored-by: mindihx <ymhuang.ymh@gmail.com>
beccalzh pushed a commit to beccalzh/python-docs-zh-tw that referenced this pull requestSep 4, 2024
Co-authored-by: mindihx <ymhuang.ymh@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mattwang44mattwang44mattwang44 left review comments

@mindihxmindihxmindihx approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@ken71301@mattwang44@mindihx

[8]ページ先頭

©2009-2025 Movatter.jp