From 05ef329823820be3aeac0df34e13853173b52006 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Mar 2014 19:29:30 +0530 Subject: [PATCH] test for character_name() --- src/calibre/utils/icu.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/calibre/utils/icu.py b/src/calibre/utils/icu.py index b1e01768ba..7ba9e0f1b1 100644 --- a/src/calibre/utils/icu.py +++ b/src/calibre/utils/icu.py @@ -463,6 +463,10 @@ pĂȘchĂ©''' prints('primary_find() failed with %s not in %s'%(v, k)) return + n = character_name(safe_chr(0x1f431)) + if n != u'CAT FACE': + raise ValueError('Failed to get correct character name for 0x1f431: %r != %r' % n, u'CAT FACE') + global _primary_collator orig = _primary_collator _primary_collator = _icu.Collator('es') @@ -514,6 +518,9 @@ def test_roundtrip(): raise ValueError(u'Roundtripping failed: %r != %r' % (r, rp)) def test_normalize_performance(): + import os + if not os.path.exists('t.txt'): + return raw = open('t.txt', 'rb').read().decode('utf-8') print (len(raw)) import time, unicodedata