本文整理匯總了Python中unicodedata.unidata_version方法的典型用法代碼示例。如果您正苦於以下問題:Python unicodedata.unidata_version方法的具體用法?Python unicodedata.unidata_version怎麽用?Python unicodedata.unidata_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類unicodedata
的用法示例。
在下文中一共展示了unicodedata.unidata_version方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_named_sequences_full
# 需要導入模塊: import unicodedata [as 別名]
# 或者: from unicodedata import unidata_version [as 別名]
def test_named_sequences_full(self):
# Check all the named sequences
url = ("http://www.pythontest.net/unicode/%s/NamedSequences.txt" %
unicodedata.unidata_version)
try:
testdata = support.open_urlresource(url, encoding="utf-8",
check=check_version)
except (OSError, HTTPException):
self.skipTest("Could not retrieve " + url)
self.addCleanup(testdata.close)
for line in testdata:
line = line.strip()
if not line or line.startswith('#'):
continue
seqname, codepoints = line.split(';')
codepoints = ''.join(chr(int(cp, 16)) for cp in codepoints.split())
self.assertEqual(unicodedata.lookup(seqname), codepoints)
with self.assertRaises(SyntaxError):
self.checkletter(seqname, None)
with self.assertRaises(KeyError):
unicodedata.ucd_3_2_0.lookup(seqname)
示例2: check_version
# 需要導入模塊: import unicodedata [as 別名]
# 或者: from unicodedata import unidata_version [as 別名]
def check_version(testfile):
hdr = testfile.readline()
return unidata_version in hdr