Export to GitHub

mock - issue #243

Unexpected behaviour of assert_has_calls with empty list as argument


Posted on Jan 9, 2015 by Happy Horse

What steps will reproduce the problem? Example: import mock

mmock = mock.MagicMock()
mmock.foobar("baz")
mmock.assert_has_calls([]) # No exception raised. Why?
mmock.assert_has_calls(['x']) # Exception raised as expected.

What is the expected output? What do you see instead? Expected an exception when called assert_has_calls with empty list.

What version of the product are you using? On what operating system? mock==1.0.1 Ubuntu 14.04.1 LTS

Please provide any additional information below. _CallList -> contains might check for empty list as value?

Status: New

Labels:
Type-Defect Priority-Medium