[issue43371] Mock.assert_has_calls works strange

2022-01-15 Thread Roy Smith
Roy Smith added the comment: I agree that this is confusing and that what we need is an assertion for the top-level mock having specific calls in a specific order, and ignores any intervening extra calls to mocked functions. In other words, a version of assert_has_calls() which looks at

[issue43371] Mock.assert_has_calls works strange

2021-07-08 Thread Mardoxx
Mardoxx added the comment: This is surprising behaviour, Python 3.8.9: factory = unittest.mock.Mock() ### test example foo_obj = factory.create("foo"),do_thing() # !! MUST BE CALLED AFTER .create("foo") !! bar_obj = factory.create("bar").do_thing() ### # I set any_order to false because

[issue43371] Mock.assert_has_calls works strange

2021-03-15 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.assert_has_calls > If any_order is false then the calls must be sequential. There can be extra > calls before or after the specified calls. One way to check that the calls

[issue43371] Mock.assert_has_calls works strange

2021-03-03 Thread Kamil Turek
Change by Kamil Turek : -- nosy: +kamilturek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Dong-hee Na
Change by Dong-hee Na : -- nosy: +corona10 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43371] Mock.assert_has_calls works strange

2021-03-02 Thread Dmitriy Mironiyk
New submission from Dmitriy Mironiyk : I think that behavior of Mock.assert_has_calls is misleading. - When I call Mock.assert_has_calls with any_order=False it checks that expected calls are the same calls as performed on mock and raise an error if mock has some calls other than expected. -