python - Error when trying to use `assert not mock.method.called` -
i'm trying assert method not called using python mock. unfortunately, can't seem past error:
attributeerror: mockcallable instance has no attribute 'called'
i'm running python 2.7.1 , python mock 0.1.0 tests. google says: no results found "attributeerror: mockcallable instance has no attribute 'called'".
how can resolve error?
here's test:
import unittest2 import main mock import mock class testcli(unittest2.testcase): def setup(self): self.mockview = mock() self.mockfriendmanager = mock() self.mockedcli = main.cli(self.mockview, self.mockfriendmanager) [...] def testclidoesntgetfriendpropertieswhennotselected(self): view = mock( { "requestresponse":2 } ) friendmanager = mock() cli = main.cli(view, friendmanager) cli.outputmenu() assert not friendmanager.getfriendproperties.called, 'hello'
you must update mock
library pip
. attribute called
introduced in 0.4.0 can see in http://www.voidspace.org.uk/python/mock/changelog.html#version-0-4-0
anyway update lot of more useful facilities , tools.
Comments
Post a Comment