Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"ๅณ้จฐ่จๅ
ฅ่กReddit ่จ่ซ่ช็ฑไธไฟ?",
"๐ฉ๐ฏ",
"โฌ",
"๐ต",
"๐จ๐ซ",
"โผ",
]
assert len(demoji.findall(" xxx ".join(batch))) == len(batch) - 2
tweet = """\
#startspreadingthenews yankees win great start by ๐
๐พ going 5strong innings with 5kโs๐ฅ ๐
solo homerun ๐๐ with 2 solo homeruns and๐น 3run homerunโฆ ๐คก ๐ฃ๐ผ ๐จ๐ฝโโ๏ธ with rbiโs โฆ ๐ฅ๐ฅ
๐ฒ๐ฝ and ๐ณ๐ฎ to close the game๐ฅ๐ฅ!!!โฆ.
WHAT A GAME!!..
"""
assert demoji.findall(tweet) == {
"๐ฅ": "fire",
"๐": "volcano",
"๐จ๐ฝ\u200dโ๏ธ": "man judge: medium skin tone",
"๐
๐พ": "Santa Claus: medium-dark skin tone",
"๐ฒ๐ฝ": "flag: Mexico",
"๐น": "ogre",
"๐คก": "clown face",
"๐ณ๐ฎ": "flag: Nicaragua",
"๐ฃ๐ผ": "person rowing boat: medium-light skin tone",
"๐": "ox",
}
def test_demoji_main():
assert not demoji.findall("Hi")
assert demoji.replace("Hi") == "Hi"
assert not demoji.findall("2 ! $&%((@)# $)@ ")
assert demoji.findall("The ๐ shall rise again") == {
"๐": "first quarter moon"
}
allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
person_tipping_hand,
man_tipping_hand,
woman_tipping_hand,
)
assert demoji.findall(allhands) == {
person_tipping_hand: "person tipping hand",
man_tipping_hand: "man tipping hand",
woman_tipping_hand: "woman tipping hand",
}
assert (
demoji.replace(allhands)
== "Someone actually gets paid to make a , a , and a "
)
"๐ด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ",
"๐ฉโ๐งโ๐ฆ",
"๐ท",
"2๏ธโฃ",
"8๏ธโฃ",
"๐",
"๐ณ",
"ุงูุฌุฒูุฑุฉโ",
"ๅณ้จฐ่จๅ
ฅ่กReddit ่จ่ซ่ช็ฑไธไฟ?",
"๐ฉ๐ฏ",
"โฌ",
"๐ต",
"๐จ๐ซ",
"โผ",
]
assert len(demoji.findall(" xxx ".join(batch))) == len(batch) - 2
tweet = """\
#startspreadingthenews yankees win great start by ๐
๐พ going 5strong innings with 5kโs๐ฅ ๐
solo homerun ๐๐ with 2 solo homeruns and๐น 3run homerunโฆ ๐คก ๐ฃ๐ผ ๐จ๐ฝโโ๏ธ with rbiโs โฆ ๐ฅ๐ฅ
๐ฒ๐ฝ and ๐ณ๐ฎ to close the game๐ฅ๐ฅ!!!โฆ.
WHAT A GAME!!..
"""
assert demoji.findall(tweet) == {
"๐ฅ": "fire",
"๐": "volcano",
"๐จ๐ฝ\u200dโ๏ธ": "man judge: medium skin tone",
"๐
๐พ": "Santa Claus: medium-dark skin tone",
"๐ฒ๐ฝ": "flag: Mexico",
"๐น": "ogre",
"๐คก": "clown face",
"๐ณ๐ฎ": "flag: Nicaragua",
def test_demoji_main():
assert not demoji.findall("Hi")
assert demoji.replace("Hi") == "Hi"
assert not demoji.findall("2 ! $&%((@)# $)@ ")
assert demoji.findall("The ๐ shall rise again") == {
"๐": "first quarter moon"
}
allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
person_tipping_hand,
man_tipping_hand,
woman_tipping_hand,
)
assert demoji.findall(allhands) == {
person_tipping_hand: "person tipping hand",
man_tipping_hand: "man tipping hand",
woman_tipping_hand: "woman tipping hand",
}
assert (
demoji.replace(allhands)
== "Someone actually gets paid to make a , a , and a "
def test_demoji_main():
assert not demoji.findall("Hi")
assert demoji.replace("Hi") == "Hi"
assert not demoji.findall("2 ! $&%((@)# $)@ ")
assert demoji.findall("The ๐ shall rise again") == {
"๐": "first quarter moon"
}
allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
person_tipping_hand,
man_tipping_hand,
woman_tipping_hand,
)
assert demoji.findall(allhands) == {
person_tipping_hand: "person tipping hand",
man_tipping_hand: "man tipping hand",
woman_tipping_hand: "woman tipping hand",
}
assert (
def test_demoji_main():
assert not demoji.findall("Hi")
assert demoji.replace("Hi") == "Hi"
assert not demoji.findall("2 ! $&%((@)# $)@ ")
assert demoji.findall("The ๐ shall rise again") == {
"๐": "first quarter moon"
}
allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
person_tipping_hand,
man_tipping_hand,
woman_tipping_hand,
)
assert demoji.findall(allhands) == {
person_tipping_hand: "person tipping hand",
man_tipping_hand: "man tipping hand",
woman_tipping_hand: "woman tipping hand",
}
assert (
demoji.replace(allhands)
== "Someone actually gets paid to make a , a , and a "
)
assert (
demoji.replace(allhands, "X")
== "Someone actually gets paid to make a X, a X, and a X"
)
assert isinstance(demoji.last_downloaded_timestamp(), datetime.datetime)
# Something for everyone...
batch = [
def _process_unicode_emojis(m, emoji_class):
e = re.sub(r'[\U0000FE00-\U0000FE0F]$', '', m.group())
title_e = re.sub(r'[\U0001F3FB-\U0001F3FF]$', '', e) or e
title = UNICODE_LIST.get(title_e, demoji.findall(title_e)[title_e])
codepoint = "-".join(['%04x' % ord(_c) for _c in e]).lstrip('0')
return f'<img alt="{e}" title=":{title}:" class="{emoji_class}">'