def unicode(self, encoding='utf-8', errors='strict'): ''' `unicode <http://docs.python.org/library/functions.html#unicode>`_ (`str <http://docs.python.org/py3k/library/functions.html#str>`_ under Python 3) `decode() <http://docs.python.org/py3k/library/stdtypes.html #bytes.decode>`_ outgoing things. :keyword string encoding: Unicode encoding :keyword string errors: error handling for decoding issues :rtype: :const:`self` (:obj:`knife` object) >>> test = __([1], True, r't', b('i'), u('g'), None, (1,)) >>> test.unicode().oneach().peek() [u'[1]', u'True', u't', u'i', u'g', u'None', u'(1,)'] ''' self._wrapper = lambda x: tounicode(x, encoding, errors) return self
def test_unicode(self): from stuf.six import u, b, tounicode self.assertEqual( [tounicode(i) for i in [[1], True, r't', b('i'), u('g'), None, (1,)]], [u('[1]'), u('True'), u('t'), u('i'), u('g'), u('None'), u('(1,)')] )
def __unicode__(self): return u('') if self.msg is None else tounicode(self.__bytes__())