def check_cond(comment): text = comment.body emotes = ponymotes.parse(text) foreign_emotes = [] for e in emotes: if not e.is_default(): foreign_emotes.append(e) return foreign_emotes
def test_default(self): post = "[](/pinkiesad) I'm sad." emote = ponymotes.parse(post)[0] self.assertTrue(emote.is_default())
def test_hashslash(self): post = '[](//#bneodestiny)' emote = ponymotes.parse(post)[0] self.assertEqual('/#bneodestiny', emote.name)
def test_multiple_emotes(self): post = '[](/ppsad)[](/flutteryay)' emotes = ponymotes.parse(post) emotes = list(map(lambda v: v.name, emotes)) self.assertListEqual(['ppsad', 'flutteryay'], emotes)
def test_colon(self): post = '[](/flutter:I)' emote = ponymotes.parse(post)[0] self.assertEqual('flutter:I', emote.name)
def test_tooltip(self): post = '[](/fluttershy "Say what?")' emote = ponymotes.parse(post)[0] self.assertEqual('Say what?', emote.tooltip)
def test_text(self): post = "[RIP Applejack](/gravestone)" emote = ponymotes.parse(post)[0] self.assertEqual('RIP Applejack', emote.text)
def test_modifiers(self): post = "[](/cadence-intensifies-spin)" emote = ponymotes.parse(post)[0] self.assertIn(member="intensifies", container=emote.modifiers)
def test_name(self): post = "[](/dieinahole)" emote = ponymotes.parse(post)[0] self.assertEqual('dieinahole', emote.name)