def test_decode_invalid_string(): with assert_raises(ValueError): emoji.decode('__---___--Invalid__--__-Name')
def unicodeemoji2text(text): out = u'' for c in text[:]: try: c = emoji.decode(c) except: pass out = out + c return out
def test_decode(): # No aliases for name, u_code in emoji.EMOJI_UNICODE.items(): assert emoji.decode(u_code, use_aliases=False) == name
def decode_emoji(cls, handler, html): return emoji.decode(handler, html)
def test_decode_invalid_string(): try: emoji.decode('__---___--Invalid__--__-Name') raise Exception("Above line should have raised a ValueError") except ValueError: pass
def test_decode(): for name, u_code in emoji.EMOJI_UNICODE.items(): assert emoji.decode(u_code, False) == name
# -*- coding: UTF-8 -*- import emoji print(emoji.emojize('Water! :water_wave:')) print(emoji.decode(u'🌊')) # for Python 2.x # print(emoji.decode('🌊')) # for Python 3.x