def call(self, bot, item): parent = item.parent() item.reply( bot.reply_using_parent_of_mention(author_name(parent), get_text(parent)))
def call(self, bot, item): item.reply(bot.reply_to_mention(author_name(item), get_text(item)))
def is_tagged_in(self, item): # TODO should return True for messages & possibly other item types. But # those aren't supported yet, so not a huge deal. return self.bot_tag in get_text(item).lower()
def test_get_text_when_does_not_have_any(self): with self.assertRaises(ValueError): get_text(Mock(spec=Subreddit))
def test_get_text_when_comment(self): text = "sometext" s = Mock(spec=Comment) s.body = text assert text == get_text(s)
def test_get_text_when_submission(self): text = "sometext" s = Mock(spec=Submission) s.selftext = text assert text == get_text(s)