Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = [
"๐",
"๐",
"๐คฉ",
"๐ค",
"๐คข",
"๐",
"๐ซ",
"๐",
"๐",
"๐งก",
"ๅณ้จฐ่จๅ
ฅ่ก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 test_download():
assert demoji.download_codes() is None
assert type(demoji._EMOJI_PAT) == type(re.compile("")) # noqa
assert isinstance(demoji._CODE_TO_DESC, dict)
assert os.path.isfile(demoji.CACHEPATH)
def test_load_codes_from_file_raises_if_dne():
if os.path.isfile(demoji.CACHEPATH):
os.remove(demoji.CACHEPATH)
with pytest.raises(IOError):
demoji._load_codes_from_file()
assert demoji.last_downloaded_timestamp() is None
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 = [
"๐",
"๐",
"๐คฉ",
"๐ค",
"๐คข",
"๐",
"๐ซ",
"๐",
"๐",
"๐งก",
"๐ค",
"๐๏ธโ๐จ๏ธ",
"โ",