1

Python programming language documentation contains this sentence describing a function argument usage:

モックが特定の呼び出しで呼ばれたことをアサートします。呼び出しでは mock_calls のリストがチェックされます。

any_orderfalse の場合(デフォルト)、呼び出しは連続していなければなりません。指定された呼び出しの前、あるいは呼び出しの後に余分な呼び出しがある場合があります。

The last sentence sounds to me like having a meaning like this.

There are cases when there are extra calls before or after the specified calls.

The original English description is worded:

There can be extra calls before or after the specified calls.

Which can be understood as proposed above. Like, I specify some expected calls and there is a possibility of the mock_calls list containing some extra.

But the actual meaning of the “there can be” is different here. It means that the assertion succeeds even if there are extra calls. Like, you can use it even if there are more calls than those specified. And in this sense, the Japanese translation seems to me like it doesn’t fit.

Can “場合がある” convey this meaning of possibility of doing something under given circumstances? It it a mistranslation? I’d expect something more like

[…]余分な呼び出しがあってもいいです。

2
  • I think the original Japanese is a little clumsy (あっても構いません is the best) but not wrong, either. And I'm not sure what kind of misunderstanding you are worrying about. When you say extra calls, you refer to irrelevant items already in the mock_calls list rather than items of the calls argument, right? (i.e., assert_has_calls([calls(3), calls(9)]) must fail if the mock was called with 1, 2, 3 and 4)
    – naruto
    Nov 26, 2021 at 2:08
  • 1
    @naruto Yes, you are right in your interpretation. I can't say for Japanese, but in English it wouldn't be quite acceptable to have it written as "there are cases", because it sounds like a result or simple statement and lacks the important conclusion of permission/eligibility. I also think your version is the best, unless there is some kind of permission implied in Japanese when saying 場合がある?
    – Simon
    Nov 26, 2021 at 18:02

1 Answer 1

1

I think it's just a mistranslation. Out of context, that sentence can technically mean both. I've looked at Python's translations projects and they seem to be done by the community, so it could've been anyone. In fact, there is already an issue opened for the mock package on the Github project, so I wouldn't be surprised if there's more. You could open a new issue linking this question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .