我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用unicodedata.mirrored()。
def test_function_checksum(self): data = [] h = hashlib.sha1() for i in range(0x10000): char = chr(i) data = [ # Properties format(self.db.digit(char, -1), '.12g'), format(self.db.numeric(char, -1), '.12g'), format(self.db.decimal(char, -1), '.12g'), self.db.category(char), self.db.bidirectional(char), self.db.decomposition(char), str(self.db.mirrored(char)), str(self.db.combining(char)), ] h.update(''.join(data).encode("ascii")) result = h.hexdigest() self.assertEqual(result, self.expectedchecksum)
def test_function_checksum(self): data = [] h = hashlib.sha1() for i in range(0x10000): char = unichr(i) data = [ # Properties str(self.db.digit(char, -1)), str(self.db.numeric(char, -1)), str(self.db.decimal(char, -1)), self.db.category(char), self.db.bidirectional(char), self.db.decomposition(char), str(self.db.mirrored(char)), str(self.db.combining(char)), ] h.update(''.join(data)) result = h.hexdigest() self.assertEqual(result, self.expectedchecksum)
def calibrate(self): data = (u'a', u'1', u' ', u'\u1234', u'\uFFFF') len_data = len(data) digit = unicodedata.digit numeric = unicodedata.numeric decimal = unicodedata.decimal category = unicodedata.category bidirectional = unicodedata.bidirectional decomposition = unicodedata.decomposition mirrored = unicodedata.mirrored combining = unicodedata.combining for i in xrange(self.rounds): c = data[i % len_data]
def test_mirrored(self): self.assertEqual(self.db.mirrored('\uFFFE'), 0) self.assertEqual(self.db.mirrored('a'), 0) self.assertEqual(self.db.mirrored('\u2201'), 1) self.assertEqual(self.db.mirrored('\U00020000'), 0) self.assertRaises(TypeError, self.db.mirrored) self.assertRaises(TypeError, self.db.mirrored, 'xx')
def test_ucd_510(self): import unicodedata # In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0 self.assertTrue(unicodedata.mirrored("\u0f3a")) self.assertTrue(not unicodedata.ucd_3_2_0.mirrored("\u0f3a")) # Also, we now have two ways of representing # the upper-case mapping: as delta, or as absolute value self.assertTrue("a".upper()=='A') self.assertTrue("\u1d79".upper()=='\ua77d') self.assertTrue(".".upper()=='.')
def test_mirrored(self): self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) self.assertEqual(self.db.mirrored(u'a'), 0) self.assertEqual(self.db.mirrored(u'\u2201'), 1) self.assertEqual(self.db.mirrored(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.mirrored) self.assertRaises(TypeError, self.db.mirrored, u'xx')
def test_ucd_510(self): import unicodedata # In UCD 5.1.0, a mirrored property changed wrt. UCD 3.2.0 self.assertTrue(unicodedata.mirrored(u"\u0f3a")) self.assertTrue(not unicodedata.ucd_3_2_0.mirrored(u"\u0f3a")) # Also, we now have two ways of representing # the upper-case mapping: as delta, or as absolute value self.assertTrue(u"a".upper()==u'A') self.assertTrue(u"\u1d79".upper()==u'\ua77d') self.assertTrue(u".".upper()==u".")
def test(self): data = (u'a', u'1', u' ', u'\u1234', u'\uFFFF') len_data = len(data) digit = unicodedata.digit numeric = unicodedata.numeric decimal = unicodedata.decimal category = unicodedata.category bidirectional = unicodedata.bidirectional decomposition = unicodedata.decomposition mirrored = unicodedata.mirrored combining = unicodedata.combining for i in xrange(self.rounds): c = data[i % len_data] digit(c, None) numeric(c, None) decimal(c, None) category(c) bidirectional(c) decomposition(c) mirrored(c) combining(c) digit(c, None) numeric(c, None) decimal(c, None) category(c) bidirectional(c) decomposition(c) mirrored(c) combining(c) digit(c, None) numeric(c, None) decimal(c, None) category(c) bidirectional(c) decomposition(c) mirrored(c) combining(c) digit(c, None) numeric(c, None) decimal(c, None) category(c) bidirectional(c) decomposition(c) mirrored(c) combining(c) digit(c, None) numeric(c, None) decimal(c, None) category(c) bidirectional(c) decomposition(c) mirrored(c) combining(c)