def test_throws_error_if_call_to_mock_was_illegal_missing_arguments_with_no_defaults(self): mock_obj = Mock() mock_obj.say("my", "name", "is") self.assertRaisesRegexp(AssertionError, "target", mock_obj.say.smarter_assert_called_once_with, TestMockingExtensions.StubbedClass.say, who="my", connector="is")
def test_validates_specific_named_arguments_without_specifying_all_arguments(self): mock_obj = Mock() mock_obj.say(who="my", what="name", connector="is", target="dog") mock_obj.say.smarter_assert_called_once_with(TestMockingExtensions.StubbedClass.say, who="my", target="dog")
def test_throws_error_if_expected_arg_was_different_than_recorded_one(self): mock_obj = Mock() mock_obj.say(who="my", what="name", connector="is", target="bill") self.assertRaisesRegexp(AssertionError, "my" ,mock_obj.say.smarter_assert_called_once_with, TestMockingExtensions.StubbedClass.say, who="yours", target="dog")