def test_encoded_string(self): for s in '', '\f', 'eggs', '''e'gg"s''': assert_equal(eval(smart_repr(s, 'ASCII')), s) assert_equal(eval(smart_repr(s, 'UTF-8')), s) for s in 'jeż', '''j'e"ż''': s_repr = smart_repr(s, 'ASCII') assert_is_instance(s_repr, str) s_repr.decode('ASCII') assert_equal(eval(s_repr), s) for s in 'jeż', '''j'e"ż''': s_repr = smart_repr(s, 'UTF-8') assert_is_instance(s_repr, str) assert_in('ż', s_repr) assert_equal(eval(s_repr), s)
def test_unicode_string(self): for s in u'', u'\f', u'eggs', u'''e'gg"s''', u'jeż', u'''j'e"ż''': assert_equal(eval(smart_repr(s)), s)
def test_byte_string(self): for s in '', '\f', 'eggs', '''e'gg"s''', 'jeż', '''j'e"ż''': assert_equal(eval(smart_repr(s)), s)