cpython/Lib/dos-8x3/test_uni.py

51 lines
1.5 KiB
Python
Raw Normal View History

2000-06-29 16:35:29 -03:00
""" Test script for the unicodedata module.
2000-05-08 14:31:04 -03:00
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
2000-06-29 16:35:29 -03:00
"""#"
2000-05-08 14:31:04 -03:00
from test_support import verbose
import sys
2000-06-29 16:35:29 -03:00
# Test Unicode database APIs
import unicodedata
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
print 'Testing unicodedata module...',
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.digit(u'A',None) is None
assert unicodedata.digit(u'9') == 9
assert unicodedata.digit(u'\u215b',None) is None
assert unicodedata.digit(u'\u2468') == 9
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.numeric(u'A',None) is None
assert unicodedata.numeric(u'9') == 9
assert unicodedata.numeric(u'\u215b') == 0.125
assert unicodedata.numeric(u'\u2468') == 9.0
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.decimal(u'A',None) is None
assert unicodedata.decimal(u'9') == 9
assert unicodedata.decimal(u'\u215b',None) is None
assert unicodedata.decimal(u'\u2468',None) is None
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.category(u'\uFFFE') == 'Cn'
assert unicodedata.category(u'a') == 'Ll'
assert unicodedata.category(u'A') == 'Lu'
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.bidirectional(u'\uFFFE') == ''
assert unicodedata.bidirectional(u' ') == 'WS'
assert unicodedata.bidirectional(u'A') == 'L'
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.decomposition(u'\uFFFE') == ''
assert unicodedata.decomposition(u'\u00bc') == '<fraction> 0031 2044 0034'
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.mirrored(u'\uFFFE') == 0
assert unicodedata.mirrored(u'a') == 0
assert unicodedata.mirrored(u'\u2201') == 1
2000-05-08 14:31:04 -03:00
2000-06-29 16:35:29 -03:00
assert unicodedata.combining(u'\uFFFE') == 0
assert unicodedata.combining(u'a') == 0
assert unicodedata.combining(u'\u20e1') == 230
2000-05-08 14:31:04 -03:00
print 'done.'