#!/usr/bin/env python3.2 # -*- coding: UTF-8 -*- from __future__ import print_function from __future__ import unicode_literals import sys import unicodedata if unicodedata.unidata_version < "6.0.0": print("WARNING: Your old UCD is out of date, expected 6.0.0 but got", unicodedata.unidata_version) wide_enough = (sys.maxunicode > 65536) if not wide_enough: print("WARNING: Narrow build detected, your Python lacks full Unicode support!!") data_rows = [ [ "\u0527", "\u0527", "\u0526", "\u0526" ], [ "\u0526", "\u0527", "\u0526", "\u0526" ], ['\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413'], ['\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413'], ['\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413', '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b', '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413'] ] total, bad = 0, 0 for orig, lower_want, title_want, upper_want in data_rows: total = total + 1 for want,label in ((lower_want, 'lower'), (title_want, 'title'), (upper_want, 'upper')): have = getattr(orig, label)() if want != have: bad += 1 print("FAIL test", total, label+"case:", "\norig ", ascii(orig), "\nwrong", ascii(have), "\nright", ascii(want)) print("\nfailed", bad, "of", total*3, "tests") ######################################## ##FAIL test 3 titlecase: ##orig '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##wrong '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##right '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##FAIL test 3 uppercase: ##orig '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##wrong '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##right '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##FAIL test 4 lowercase: ##orig '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##wrong '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##right '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##FAIL test 4 uppercase: ##orig '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##wrong '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##right '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##FAIL test 5 lowercase: ##orig '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##wrong '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##right '\U0001043c\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ##FAIL test 5 titlecase: ##orig '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##wrong '\U00010414\U00010407\U0001041d\U00010400\U00010421\U00010407\U00010413' ##right '\U00010414\U0001042f\U00010445\U00010428\U00010449\U0001042f\U0001043b' ## ##failed 6 of 15 tests