Example #1
0
    def testCreateWithObject(self):
        """ error: create with any object """

        class Foo:
            def __str__(self):
                return 'טעות'

        err = error.Error(Foo())
        assert str(err) == 'טעות'
Example #2
0
    def testCreateWithObject(self):
        """ error: create with any object """
        class Foo(object):
            def __unicode__(self):
                return u'טעות'

            def __str__(self):
                return 'טעות'

        err = error.Error(Foo())
        assert unicode(err) == u'טעות'
        assert str(err) == 'טעות'
Example #3
0
 def testAccessLikeDict(self):
     """ error: access error like a dict """
     test = 'value'
     err = error.Error(test)
     assert '%(message)s' % dict(message=err) == test
Example #4
0
 def testCreateWithEncodedString(self):
     """ error: create with encoded string """
     err = error.Error('טעות')
     assert unicode(err) == u'טעות'
     assert str(err) == 'טעות'
Example #5
0
 def testCreateWithUnicode(self):
     """ error: create with unicode """
     err = error.Error(u'טעות')
     assert unicode(err) == u'טעות'
     assert str(err) == 'טעות'