jsatt / mock

Automatically exported from code.google.com/p/mock
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

assert_has_calls does NOT consider order #248

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When asserting the order of calls, the mock framework ALWAYS returns true, 
since the internal "_CallList" is used for "contains" checks:

mock = Mock()
mock.tell(bye_evt)
mock.tell(hello_evt)

mock.tell.assert_has_calls([call(bye_evt), call(hello_evt)])
>> TRUE
mock.tell.assert_has_calls([call(hello_evt), call(bye_evt)])
>> TRUE

2. Both of the above will return true, REGARDLESS of the order of calls.

What is the expected output? What do you see instead?

It should be TRUE for the first assert, and FALSE for the second!

What version of the product are you using? On what operating system?
1.0.1

How has this passed ANY tests? Arrgggh.. this took me forever to figure out.

Original issue reported on code.google.com by dro...@gmail.com on 19 Mar 2015 at 10:19

GoogleCodeExporter commented 8 years ago
This is the documented behaviour. Please read the documentation for this assert 
method. There is an optional argument for enforcing the order.

Original comment by fuzzyman on 7 Apr 2015 at 9:25