derwiki-adroll / mock

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

assert_called_once_with doesn't see method called implicitly #220

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
`mock.assert_called_once_with` works perfectly when target is called explicitly 
like that:

    mocked = mock.Mock(wraps=Reactor())
    mocked.move("left")
    mocked.move.assert_called_once_with("left")

However, this is not true when scenario is getting a little bit complex. Please 
have a look at reproducing test case I've prepared in the attachment.

What is the expected output? What do you see instead?
I expect mock to be aware of reactors `move` method being called;

AssertionError: Expected to be called once. Called 0 times.
----------------- Captured stdout ------------------------
moving left                <------- see, it was indeed called

What version of the product are you using? On what operating system?
mock==1.0.1
Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 
5.0 (clang-500.0.68)] on darwin
pytest==2.5.1
OS X 10.9 (13A603)

Please provide any additional information below.
Test cases attached would be quite enough. Anyway, fell free to ask anything 
more if you need.

Original issue reported on code.google.com by yaskevic...@gmail.com on 31 Dec 2013 at 9:16

Attachments: