Skip to content

Commit

Permalink
Test for emoji_list, distinct_emoji_list
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Feb 16, 2022
1 parent d7f72a4 commit 1aedfda
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,23 @@ def test_distinct_emoji_lis():
assert emoji.distinct_emoji_lis('Hi, I am fine. 😁😁😁😁') == ['😁']


def test_emoji_list():
assert emoji.emoji_list('Hi, I am πŸ‘Œ test')[0]['match_start'] == 9
assert emoji.emoji_list('Hi') == []
if len('Hello πŸ‡«πŸ‡·πŸ‘Œ') < 10: # skip these tests on python with UCS-2 as the string length/positions are different
assert emoji.emoji_list('Hi, I am fine. 😁') == [
{'match_start': 15, 'match_end': 16, 'emoji': '😁'}]
assert emoji.emoji_list('Hello πŸ‡«πŸ‡·πŸ‘Œ') == [
{'emoji': 'πŸ‡«πŸ‡·', 'match_start': 6, 'match_end': 8}, {'emoji': 'πŸ‘Œ', 'match_start': 8, 'match_end': 9}]


def test_distinct_emoji_list():
assert emoji.distinct_emoji_list('Hi, I am fine. 😁') == ['😁']
assert emoji.distinct_emoji_list('Hi') == []
assert set(emoji.distinct_emoji_list('Hello πŸ‡«πŸ‡·πŸ‘Œ')) == {'πŸ‡«πŸ‡·', 'πŸ‘Œ'}
assert emoji.distinct_emoji_list('Hi, I am fine. 😁😁😁😁') == ['😁']


def test_emoji_count():
assert emoji.emoji_count('Hi, I am fine. 😁') == 1
assert emoji.emoji_count('Hi') == 0
Expand Down

0 comments on commit 1aedfda

Please sign in to comment.