Skip to content

Commit

Permalink
Test emoji.replace_emoji with function parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Oct 2, 2021
1 parent 9983e5e commit 5711c67
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def test_emojize_variant():
assert emoji.emojize(':admission_tickets:', variant='text_type') == remove_variant(emoji.EMOJI_UNICODE['en'][':admission_tickets:']) + u'\ufe0e'
assert emoji.emojize(':admission_tickets:', variant='emoji_type') == remove_variant(emoji.EMOJI_UNICODE['en'][':admission_tickets:']) + u'\ufe0f'

with pytest.raises(Exception):
with pytest.raises(ValueError):
emoji.emojize(':admission_tickets:', variant=False)

with pytest.raises(Exception):
with pytest.raises(ValueError):
emoji.emojize(':admission_tickets:', variant=True)

with pytest.raises(Exception):
with pytest.raises(ValueError):
emoji.emojize(':admission_tickets:', variant='wrong')

assert emoji.emojize(":football:", use_aliases=False) == ':football:'
Expand Down Expand Up @@ -149,11 +149,16 @@ def test_emoji_count():


def test_replace_emoji():
assert emoji.replace_emoji('Hi, I am fine. 😁') == 'Hi, I am fine. '
assert emoji.replace_emoji(u'Hi, I am fine. 😁') == 'Hi, I am fine. '
assert emoji.replace_emoji('Hi') == 'Hi'
assert emoji.replace_emoji('Hello πŸ‡«πŸ‡·πŸ‘Œ') == 'Hello '
assert emoji.replace_emoji('Hello πŸ‡«πŸ‡·πŸ‘Œ', 'x') == 'Hello xx'

def replace(emj, data):
assert emj in ["πŸ‡«πŸ‡·", "πŸ‘Œ"]
return 'x'
assert emoji.replace_emoji('Hello πŸ‡«πŸ‡·πŸ‘Œ', replace) == 'Hello xx'


def test_is_emoji():
assert emoji.is_emoji('😁')
Expand Down

0 comments on commit 5711c67

Please sign in to comment.