Python unicodedata.mirrored() Examples
The following are 30
code examples of unicodedata.mirrored().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
unicodedata
, or try the search function
.
Example #1
Source File: test_unicodedata.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: test_unicodedata.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #3
Source File: test_regressions.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_ipy2_gh357(self): """https://github.com/IronLanguages/ironpython2/issues/357""" import unicodedata if is_cli: self.assertEqual(unicodedata.name(u'\u4e2d'), '<CJK IDEOGRAPH, FIRST>..<CJK IDEOGRAPH, LAST>') else: self.assertEqual(unicodedata.name(u'\u4e2d'), 'CJK UNIFIED IDEOGRAPH-4E2D') self.assertRaises(ValueError, unicodedata.decimal, u'\u4e2d') self.assertEqual(unicodedata.decimal(u'\u4e2d', 0), 0) self.assertRaises(ValueError, unicodedata.digit, u'\u4e2d') self.assertEqual(unicodedata.digit(u'\u4e2d', 0), 0) self.assertRaises(ValueError, unicodedata.numeric, u'\u4e2d') self.assertEqual(unicodedata.numeric(u'\u4e2d', 0), 0) self.assertEqual(unicodedata.category(u'\u4e2d'), 'Lo') self.assertEqual(unicodedata.bidirectional(u'\u4e2d'), 'L') self.assertEqual(unicodedata.combining(u'\u4e2d'), 0) self.assertEqual(unicodedata.east_asian_width(u'\u4e2d'), 'W') self.assertEqual(unicodedata.mirrored(u'\u4e2d'), 0) self.assertEqual(unicodedata.decomposition(u'\u4e2d'), '')
Example #4
Source File: test_unicodedata.py From ironpython2 with Apache License 2.0 | 6 votes |
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)
Example #5
Source File: test_unicodedata.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
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)
Example #6
Source File: test_unicodedata.py From ironpython3 with Apache License 2.0 | 6 votes |
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)
Example #7
Source File: test_unicodedata.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
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)
Example #8
Source File: test_unicodedata.py From oss-ftp with MIT License | 6 votes |
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)
Example #9
Source File: test_unicodedata.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
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)
Example #10
Source File: test_unicodedata.py From BinderFilter with MIT License | 6 votes |
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)
Example #11
Source File: test_regressions.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_ipy2_gh357(self): """https://github.com/IronLanguages/ironpython2/issues/357""" import unicodedata if is_cli: self.assertEqual(unicodedata.name(u'\u4e2d'), '<CJK IDEOGRAPH, FIRST>..<CJK IDEOGRAPH, LAST>') else: self.assertEqual(unicodedata.name(u'\u4e2d'), 'CJK UNIFIED IDEOGRAPH-4E2D') self.assertRaises(ValueError, unicodedata.decimal, u'\u4e2d') self.assertEqual(unicodedata.decimal(u'\u4e2d', 0), 0) self.assertRaises(ValueError, unicodedata.digit, u'\u4e2d') self.assertEqual(unicodedata.digit(u'\u4e2d', 0), 0) self.assertRaises(ValueError, unicodedata.numeric, u'\u4e2d') self.assertEqual(unicodedata.numeric(u'\u4e2d', 0), 0) self.assertEqual(unicodedata.category(u'\u4e2d'), 'Lo') self.assertEqual(unicodedata.bidirectional(u'\u4e2d'), 'L') self.assertEqual(unicodedata.combining(u'\u4e2d'), 0) self.assertEqual(unicodedata.east_asian_width(u'\u4e2d'), 'W') self.assertEqual(unicodedata.mirrored(u'\u4e2d'), 0) self.assertEqual(unicodedata.decomposition(u'\u4e2d'), '')
Example #12
Source File: test_unicodedata.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
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')
Example #13
Source File: test_unicodedata.py From ironpython3 with Apache License 2.0 | 5 votes |
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()=='.')
Example #14
Source File: test_unicodedata.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
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".")
Example #15
Source File: test_unicodedata.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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()=='.')
Example #16
Source File: test_unicodedata.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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')
Example #17
Source File: test_unicodedata.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
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')
Example #18
Source File: test_unicodedata.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
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".")
Example #19
Source File: test_unicodedata.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
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".")
Example #20
Source File: test_unicodedata.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
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')
Example #21
Source File: glyphIgo.py From glyphIgo with MIT License | 5 votes |
def __print_Unicode_info(self, char, short): name = unicodedata.name(char, "UNKNOWN") decCodepoint = ord(char) hexCodepoint = hex(decCodepoint) lower = char.lower() upper = char.upper() category = unicodedata.category(char) bidirectional = unicodedata.bidirectional(char) mirrored = True if (unicodedata.mirrored(char) == 1) else False nfc = unicodedata.normalize("NFC", char) nfd = unicodedata.normalize("NFD", char) if (short): print char + "\t" + name + " (U+" + str(hexCodepoint).upper().replace("0X", "") + ")" else: print "Name " + name print "Character " + char print "Dec Codepoint " + str(decCodepoint) print "Hex Codepoint " + str(hexCodepoint) print "Lowercase " + lower print "Uppercase " + upper print "Category " + category print "Bidirectional " + bidirectional print "Mirrored " + str(mirrored) print "NFC " + nfc print "NFD " + nfd print "=============" # helper: perform a lookup for the given query
Example #22
Source File: test_unicodedata.py From ironpython3 with Apache License 2.0 | 5 votes |
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')
Example #23
Source File: test_unicodedata.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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()=='.')
Example #24
Source File: test_unicodedata.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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')
Example #25
Source File: test_unicodedata.py From oss-ftp with MIT License | 5 votes |
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".")
Example #26
Source File: test_unicodedata.py From oss-ftp with MIT License | 5 votes |
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')
Example #27
Source File: test_unicodedata.py From BinderFilter with MIT License | 5 votes |
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".")
Example #28
Source File: test_unicodedata.py From BinderFilter with MIT License | 5 votes |
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')
Example #29
Source File: test_unicodedata.py From ironpython2 with Apache License 2.0 | 5 votes |
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".")
Example #30
Source File: test_unicodedata.py From ironpython2 with Apache License 2.0 | 5 votes |
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')