def test_person_does_not_exist(self): self.tbot = TestedBot() self.tbot.register(regex.directedsubstitute) self.tbot.listen("Afal", "#42", "Fluttershy: s/yay/woo hoo/") disappointing_result = ( "#42", "Afal: Fluttershy doesn't exist! You don't have to correct them!") self.assertEqual(self.tbot.last_message(), disappointing_result)
class TestRegexModule(unittest.TestCase): def setUp(self): self.tbot = TestedBot() self.tbot.register(regex.storemessage) self.tbot.register(regex.substitute) self.tbot.register(regex.directedsubstitute) def test_subsitute(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "test") self.tbot.listen("Afal", "#42", "s/e/oa/") should_be_toast = ("#42", "<Afal> toast") self.assertEqual(self.tbot.last_message(), should_be_toast) def test_nothing_has_been_said(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "s/lol/bums/") rude_error = ("#42", "Uh Afal... you haven't said anything yet") self.assertEqual(self.tbot.last_message(), rude_error) def test_person_does_not_exist(self): self.tbot = TestedBot() self.tbot.register(regex.directedsubstitute) self.tbot.listen("Afal", "#42", "Fluttershy: s/yay/woo hoo/") disappointing_result = ( "#42", "Afal: Fluttershy doesn't exist! You don't have to correct them!") self.assertEqual(self.tbot.last_message(), disappointing_result)
def setUp(self): self.tbot = TestedBot() self.tbot.register(regex.storemessage) self.tbot.register(regex.substitute) self.tbot.register(regex.directedsubstitute)
def setUp(self): self.tbot = TestedBot() self.tbot.register(ping.thanks_ants)
class TestPingModule(unittest.TestCase): def setUp(self): self.tbot = TestedBot() self.tbot.register(ping.thanks_ants) def test_thanks_ants(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "!thanks ants") self.assertEqual(self.tbot.last_message()[1], "Thanks ants... Thants") def test_thanks_trtl(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "!thanks trtl") self.assertEqual(self.tbot.last_message()[1], "Thanks trtl... Thtrtl") def test_thanks_sylnai(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "!thanks Sylnai") self.assertEqual(self.tbot.last_message()[1], "Thanks Sylnai... Thai") def test_thanks_phoebe(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "!thanks phoebe") self.assertEqual(self.tbot.last_message()[1], "Thanks phoebe... Thoebe")
class TestRegexModule(unittest.TestCase): def setUp(self): self.tbot = TestedBot() self.tbot.register(regex.storemessage) self.tbot.register(regex.substitute) self.tbot.register(regex.directedsubstitute) def test_subsitute(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "test") self.tbot.listen("Afal", "#42", "s/e/oa/") should_be_toast = ("#42", "<Afal> toast") self.assertEqual(self.tbot.last_message(), should_be_toast) def test_nothing_has_been_said(self): self.tbot.bot_messages = [] self.tbot.listen("Afal", "#42", "s/lol/bums/") rude_error = ("#42", "Uh Afal... you haven't said anything yet") self.assertEqual(self.tbot.last_message(), rude_error) def test_person_does_not_exist(self): self.tbot = TestedBot() self.tbot.register(regex.directedsubstitute) self.tbot.listen("Afal", "#42", "Fluttershy: s/yay/woo hoo/") disappointing_result = ("#42", "Afal: Fluttershy doesn't exist! You don't have to correct them!") self.assertEqual(self.tbot.last_message(), disappointing_result)
def test_person_does_not_exist(self): self.tbot = TestedBot() self.tbot.register(regex.directedsubstitute) self.tbot.listen("Afal", "#42", "Fluttershy: s/yay/woo hoo/") disappointing_result = ("#42", "Afal: Fluttershy doesn't exist! You don't have to correct them!") self.assertEqual(self.tbot.last_message(), disappointing_result)