예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 def test_byte_string(self):
     for s in '', '\f', 'eggs', '''e'gg"s''', 'jeż', '''j'e"ż''':
         assert_equal(eval(smart_repr(s)), s)