{"action":"created","issue":{"url":"https://api.github.com/repos/manahl/mockextras/issues/6","repository_url":"https://api.github.com/repos/manahl/mockextras","labels_url":"https://api.github.com/repos/manahl/mockextras/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/manahl/mockextras/issues/6/comments","events_url":"https://api.github.com/repos/manahl/mockextras/issues/6/events","html_url":"https://github.com/manahl/mockextras/issues/6","id":145499504,"number":6,"title":"unhelpful KeyError raised when mismatch on calls","user":{"login":"paul-hammant","id":82182,"avatar_url":"https://avatars.githubusercontent.com/u/82182?v=3","gravatar_id":"","url":"https://api.github.com/users/paul-hammant","html_url":"https://github.com/paul-hammant","followers_url":"https://api.github.com/users/paul-hammant/followers","following_url":"https://api.github.com/users/paul-hammant/following{/other_user}","gists_url":"https://api.github.com/users/paul-hammant/gists{/gist_id}","starred_url":"https://api.github.com/users/paul-hammant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paul-hammant/subscriptions","organizations_url":"https://api.github.com/users/paul-hammant/orgs","repos_url":"https://api.github.com/users/paul-hammant/repos","events_url":"https://api.github.com/users/paul-hammant/events{/privacy}","received_events_url":"https://api.github.com/users/paul-hammant/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-03T13:25:02Z","updated_at":"2016-04-03T22:50:24Z","closed_at":null,"body":"```\r\nfrom unittest import TestCase\r\n\r\nfrom mock import Mock, call\r\nfrom mockextras import stub\r\n\r\n\r\nclass Appender:\r\n\r\n    def __init__(self):\r\n        self.appended = []\r\n\r\n    def append(self, message):\r\n        self.appended.append(message)\r\n        return True\r\n\r\nclass AppenderTest(TestCase):\r\n\r\n    def test_this_one_works(self):\r\n\r\n        foo = Mock()\r\n        appended = \"a\"\r\n        foo.append.side_effect = stub((call(appended), True))\r\n        foo.append(\"a\")\r\n        self.assertEquals(foo.mock_calls, [call.append(appended)])\r\n\r\n    def test_this_one_barfs_with_KeyError_but_should_really_be_more_helpful(self):\r\n\r\n        foo = Mock()\r\n        appended = \"a a\"\r\n        foo.append.side_effect = stub((call(appended), True))\r\n        foo.append(\"a\")\r\n        self.assertEquals(foo.mock_calls, [call.append(appended)])\r\n```\r\n\r\nHelp could be calls that were close but not exact. In this case the intended and actual call were (re a string param) different by a couple of chars. It'd be a huge help for a string diff to be shown.  Sure that's if the param in question is diffable. Even if not, there's a kinder way of raising an error:\r\n\r\n```\r\nappend(\"a\") called, yet there were no stubs to match that. Instead, these were available for matching:\r\nappend(\"a a\")\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/manahl/mockextras/issues/comments/205070011","html_url":"https://github.com/manahl/mockextras/issues/6#issuecomment-205070011","issue_url":"https://api.github.com/repos/manahl/mockextras/issues/6","id":205070011,"user":{"login":"paul-hammant","id":82182,"avatar_url":"https://avatars.githubusercontent.com/u/82182?v=3","gravatar_id":"","url":"https://api.github.com/users/paul-hammant","html_url":"https://github.com/paul-hammant","followers_url":"https://api.github.com/users/paul-hammant/followers","following_url":"https://api.github.com/users/paul-hammant/following{/other_user}","gists_url":"https://api.github.com/users/paul-hammant/gists{/gist_id}","starred_url":"https://api.github.com/users/paul-hammant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paul-hammant/subscriptions","organizations_url":"https://api.github.com/users/paul-hammant/orgs","repos_url":"https://api.github.com/users/paul-hammant/repos","events_url":"https://api.github.com/users/paul-hammant/events{/privacy}","received_events_url":"https://api.github.com/users/paul-hammant/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T22:50:24Z","updated_at":"2016-04-03T22:50:24Z","body":"thx for working on this :)"}}