def do(query): try: codepoint = parse_codepoint(query) s = codepoint2unichr(codepoint) except: return make_xml(False, query, query, u'Type hexadecimal unicode codepoint') try: name = call_with_cursor([codepoint], get_name_by_code) except: return make_xml(False, query, query, u'Bad or unsuitable codepoint') else: return make_xml(True, s, u'{0}: {1}'.format(query, s), u'U+{0:04X}: {1}'.format(codepoint, name))
def do_one(query): if query.strip() == '': return make_item(None, 'Type hexadecimal unicode codepoint', '', dummy=True) try: codepoint = parse_codepoint(query) s = codepoint2unichr(codepoint) name = call_with_cursor([codepoint], get_name_by_code) except: return make_item(None, query, 'Bad or unsuitable codepoint', dummy=True) else: return make_item(s, u'{0}: {1}'.format(query, s), u'U+{0:04X}: {1}'.format(codepoint, name))
def do(query): return call_with_cursor([query], make_results)
def test_get_row_by_char(self): self.assertEqual((0xe5, 'LATIN SMALL LETTER A WITH RING ABOVE'), call_with_cursor(u'å', get_row_by_char))
def do(query): return call_with_cursor([query], make_results)
def test_get_row_by_char(self): self.assertEqual((0xe5, 'LATIN SMALL LETTER A WITH RING ABOVE'), call_with_cursor(u'å', get_row_by_char))