From b3b0dc6ccb62bbe8a0ab57bba8c6e786ced6d59f Mon Sep 17 00:00:00 2001 From: Tahir Jalilov Date: Mon, 6 Dec 2021 15:00:58 +0400 Subject: [PATCH] small fixes --- CHANGES.md | 7 ++++++- emoji/__init__.py | 2 +- tests/test_core.py | 5 +++-- tests/test_dict.py | 3 +++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0880d87d..fb47dbfd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ emoji ===== +1.6.2 +----- +* Improve performance of demojize() +* Added more tests +* Added warning when someone uses any other language than 'en' with use_aliases=True in emojize() + 1.6.1 ----- * Allow multiple aliases @@ -14,7 +20,6 @@ emoji * emoji.version(string) method added * Included 'variant' in the dict of dicts - 1.5.0 ----- * Emojis of English version updated to the Emoji Charts v14.0 diff --git a/emoji/__init__.py b/emoji/__init__.py index 9edc0293..ce1f6e89 100644 --- a/emoji/__init__.py +++ b/emoji/__init__.py @@ -30,7 +30,7 @@ 'EMOJI_ALIAS_UNICODE_ENGLISH', 'UNICODE_EMOJI_ALIAS_ENGLISH', 'EMOJI_DATA', ] -__version__ = '1.6.1' +__version__ = '1.6.2' __author__ = 'Taehoon Kim, Kevin Wurster and Tahir Jalilov' __email__ = 'carpedm20@gmail.com' # and wursterk@gmail.com, tahir.jalilov@gmail.com diff --git a/tests/test_core.py b/tests/test_core.py index 7cef4b08..b3386d16 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -116,6 +116,7 @@ def test_emojize_invalid_emoji(): string = ':: baby:: :_: : : : : :-: :+:' assert emoji.emojize(string, False) == string + def test_alias(): # When use_aliases=False aliases should be passed through untouched assert emoji.emojize(':soccer:', use_aliases=False) == ':soccer:' @@ -165,7 +166,7 @@ def test_invalid_alias(): assert emoji.emojize(':tester:', use_aliases=True) == ':tester:' assert emoji.emojize(':footbal:', use_aliases=True) == ':footbal:' assert emoji.emojize(':socer:', use_aliases=True) == ':socer:' - emoji.emojize(':socer:', use_aliases=True, + assert emoji.emojize(':socer:', use_aliases=True, variant="text_type") == ':socer:' @@ -192,6 +193,7 @@ def test_alias_wrong_language(): assert emoji.demojize(thailand, use_aliases=False, language="alias") == ':flag_for_Thailand:' assert emoji.demojize(thailand, use_aliases=True, language="alias") == ':flag_for_Thailand:' + def test_demojize_name_only(): for emj, item in emoji.EMOJI_DATA.items(): if item['status'] != emoji.STATUS['fully_qualified']: @@ -284,7 +286,6 @@ def test_long_emoji(): assert emoji.demojize(emoji.demojize(s)) == s - def test_untranslated(): for emj, item in emoji.EMOJI_DATA.items(): if item['status'] != emoji.STATUS['fully_qualified']: diff --git a/tests/test_dict.py b/tests/test_dict.py index 9460bda6..d1afe0d9 100644 --- a/tests/test_dict.py +++ b/tests/test_dict.py @@ -8,6 +8,8 @@ import emoji _all_languages = None + + def all_languages(): """List of all language keys in EMOJI_DATA""" @@ -48,6 +50,7 @@ def check_duplicate_names(lang): assert name not in seen seen[name] = 0 + def test_duplicate_names(): """Check that there are no duplicate names in the fully_qualified except for differnt variants""" for lang in all_languages():