Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_in_should_work_when_looking_for_emoji(self):
emoji = Emoji()
self.assertTrue('relaxed' in emoji)
def test_should_also_store_the_unicode_of_an_emoji(self):
self.assertEqual(len(Emoji._unicode_characters), TOTAL_EMOJIS_UNICODE)
def test_should_replace_hex_encoded_unicode(self):
self.assertEqual(
Emoji.replace_html_entities(self.HEX_KISS),
self.UNICODE_KISS
)
def test_emoji_is_singleton(self):
e = Emoji()
e2 = Emoji()
self.assertEqual(id(e), id(e2))
def test_convert_instance_to_dict_and_act_like_dict(self):
e = Emoji()
as_dict = dict(e)
self.assertEqual(len(as_dict), TOTAL_EMOJIS)
self.assertEqual(as_dict['+1'], '/static/emoji/img/%2B1.png')
with self.assertRaises(KeyError):
as_dict['nonexistant']
def test_emoji_is_singleton(self):
e = Emoji()
e2 = Emoji()
self.assertEqual(id(e), id(e2))
from .models import Emoji as emoji_class
__version__ = '2.0.0'
Emoji = emoji_class()
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(Emoji, cls).__new__(cls, *args, **kwargs)
return cls._instance