예제 #1
0
 def test_utf8_width_chop_unicode(self):
     '''utf8_width_chop with unicode input'''
     tools.ok_(utf8.utf8_width_chop(self.u_mixed) == (23, self.u_mixed))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 23) == (23, self.u_mixed))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 22) == (22, self.u_mixed[:-1]))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 19) == (18, self.u_mixed[:-4]))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 2) == (2, self.u_mixed[0]))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 1), (0, ''))
예제 #2
0
 def test_utf8_width_chop(self):
     '''utf8_width_chop with byte strings'''
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed) == (23, self.utf8_mixed))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 23) == (23, self.utf8_mixed))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 22) == (22, self.utf8_mixed[:-1]))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 19) == (18, self.u_mixed[:-4].encode('utf8')))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 2) == (2, self.u_mixed[0].encode('utf8')))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 1) == (0, b''))
예제 #3
0
 def test_utf8_width_chop_unicode(self):
     '''utf8_width_chop with unicode input'''
     tools.ok_(utf8.utf8_width_chop(self.u_mixed) == (23, self.u_mixed))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 23) == (23, self.u_mixed))
     tools.ok_(
         utf8.utf8_width_chop(self.u_mixed, 22) == (22, self.u_mixed[:-1]))
     tools.ok_(
         utf8.utf8_width_chop(self.u_mixed, 19) == (18, self.u_mixed[:-4]))
     tools.ok_(
         utf8.utf8_width_chop(self.u_mixed, 2) == (2, self.u_mixed[0]))
     tools.ok_(utf8.utf8_width_chop(self.u_mixed, 1), (0, ''))
예제 #4
0
 def test_utf8_width_chop(self):
     '''utf8_width_chop with byte strings'''
     tools.ok_(
         utf8.utf8_width_chop(self.utf8_mixed) == (23, self.utf8_mixed))
     tools.ok_(
         utf8.utf8_width_chop(self.utf8_mixed, 23) == (23, self.utf8_mixed))
     tools.ok_(
         utf8.utf8_width_chop(self.utf8_mixed, 22) == (
             22, self.utf8_mixed[:-1]))
     tools.ok_(
         utf8.utf8_width_chop(self.utf8_mixed, 19) == (
             18, self.u_mixed[:-4].encode('utf8')))
     tools.ok_(
         utf8.utf8_width_chop(self.utf8_mixed, 2) == (
             2, self.u_mixed[0].encode('utf8')))
     tools.ok_(utf8.utf8_width_chop(self.utf8_mixed, 1) == (0, b''))