How to use demoji - 10 common examples

To help you get started, weโ€™ve selected a few demoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 = [
        "๐Ÿ˜€",
        "๐Ÿ˜‚",
        "๐Ÿคฉ",
        "๐Ÿค",
        "๐Ÿคข",
        "๐Ÿ™",
        "๐Ÿ˜ซ",
        "๐Ÿ™€",
        "๐Ÿ’“",
        "๐Ÿงก",
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
"ๅ‚ณ้จฐ่จŠๅ…ฅ่‚ก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",
    }
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 "
    )
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
"๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ",
        "๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ",
        "๐Ÿท",
        "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",
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 "
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 (
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 = [
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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)
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
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 = [
        "๐Ÿ˜€",
        "๐Ÿ˜‚",
        "๐Ÿคฉ",
        "๐Ÿค",
        "๐Ÿคข",
        "๐Ÿ™",
        "๐Ÿ˜ซ",
        "๐Ÿ™€",
        "๐Ÿ’“",
        "๐Ÿงก",
        "๐Ÿ–ค",
        "๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ",
        "โœ‹",