# -*- coding: utf-8 -*-

d = {
    'name': u'יוניקוד'
}

class U:
    def __str__(self):
        print '%s.__str__ called' % self.__class__.__name__
        return 'string'
    def __unicode__(self):
        print '%s.__unicode__ called' % self.__class__.__name__
        return u'יוניקוד'

        
print 'insert unicode from dict into unicode'       
assert u'%(name)s' % d == u'יוניקוד'

print 'insert unicode from string literal into unicode'
assert u'%s' % u'יוניקוד' == u'יוניקוד'

print 'insert unicode from variable into unicode'
var = u'יוניקוד'
assert u'%s' % var == u'יוניקוד'

print 'insert unicode from object into unicode'
var = U()
assert u'%s' % unicode(var) == u'יוניקוד'

print 'insert unicode from dict into string'       
assert '%(name)s' % d == u'יוניקוד'

print 'insert unicode from string literal into string'
assert '%s' % u'יוניקוד' == u'יוניקוד'

print 'insert unicode from variable into string'
var = u'יוניקוד'
assert '%s' % var == u'יוניקוד'

print 'insert unicode from object into string'
var = U()
assert '%s' % unicode(var) == u'יוניקוד'
