def test_fails_with_sensible_default_error_message(self):
     try:
         assert_raises(ValueError, self._good_callable())
     except AssertionError as e:
         assert 'ValueError not raised!' == exception_message(e), repr(exception_message(e))
     else:
         self.fail('AssertionError not raised!')
 def test_can_specify_additional_custom_message(self):
     try:
         assert_raises(ValueError, self._good_callable(), message='Foo')
     except AssertionError as e:
         assert 'ValueError not raised! Foo' == exception_message(e), repr(exception_message(e))
     else:
         self.fail('AssertionError not raised!')
 def test_fails_with_sensible_default_error_message(self):
     try:
         assert_not_raises(Exception, self._fail_with(ValueError))
     except AssertionError as e:
         assert_equals('unexpected exception ValueError()', exception_message(e))
     else:
         self.fail('test did not catch exception!')
 def test_can_specify_additional_custom_message(self):
     try:
         assert_not_raises(Exception, self._fail_with(ValueError), message='Foo')
     except AssertionError as e:
         assert_equals('unexpected exception ValueError(): Foo', exception_message(e))
     else:
         self.fail('test did not catch exception!')
 def test_fails_with_sensible_default_error_message(self):
     e = self.assert_fail('bar', list)
     assert_equals("'bar' (str) is not an instance of list", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail(2, ['foo'], message='Bar')
     assert "2 != 1: Bar" == exception_message(e), repr(exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     e = self.assert_fail(2, ['foo'])
     assert "2 != 1" == exception_message(e), repr(exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     e = self.assert_fail(None)
     assert_equals("None is not callable", exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     # using a string here on purpose so we can check that repr is used in
     # exception message
     e = self.assert_fail('')
     assert_equals("'' is empty", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail(2, 1, message='Bar')
     assert_equals("2 >= 1: Bar", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail(1, 3, max_delta=1, message='Bar')
     assert_equals('1 != 3 +/- 1: Bar', exception_message(e))
    def test_can_specify_additional_custom_message(self):
        e = self.assert_fail({'foo': '42'}, {}, message='Bar')
        assert_equals("'foo' not in {}: Bar", exception_message(e))

        e = self.assert_fail({'foo': 21}, {'foo': 42}, message='Bar')
        assert_equals("'foo'=21 != 'foo'=42: Bar", exception_message(e))
    def test_fails_with_sensible_default_error_message(self):
        e = self.assert_fail({'foo': '42'}, {})
        assert_equals("'foo' not in {}", exception_message(e))

        e = self.assert_fail({'foo': 21}, {'foo': 42})
        assert_equals("'foo'=21 != 'foo'=42", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail('bar', message='Bar')
     assert_equals("'bar' is not callable: Bar", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail('bar', list, message='Bar')
     assert_equals("'bar' (str) is not an instance of list: Bar", exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     # using a string here on purpose so we can check that repr is used in
     # exception message
     e = assert_raises(AssertionError, lambda: assert_equals('foo', 'bar'))
     assert "'foo' != 'bar'" == exception_message(e), repr(exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     e = self.assert_fail(2, 3)
     assert_equals('2 != 3', exception_message(e))
     e = self.assert_fail(2, 4, 1)
     assert_equals('2 != 4 +/- 1', exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = assert_raises(AssertionError, lambda: assert_equals(1, 2, message='foo'))
     assert "1 != 2: foo" == exception_message(e), repr(exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     e = self.assert_fail(2, 1)
     assert_equals("2 >= 1", exception_message(e))
 def test_fails_with_sensible_default_error_message(self):
     # using a string here on purpose so we can check that repr is used in 
     # exception message
     e = self.assert_fail(u'foo')
     assert_equals(UPREFIX+"'foo' is not falseish", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail('foo', ['foo'], message='Bar')
     assert_equals("'foo' in ['foo']: Bar", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail(u'foo', message='Bar')
     assert_equals(UPREFIX+"'foo' is not falseish: Bar", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail('', message='Foo')
     assert_equals("'' is empty: Foo", exception_message(e))
 def test_can_specify_additional_custom_message(self):
     e = self.assert_fail('bar', message='Foo')
     assert_equals("False != 'bar': Foo", exception_message(e))