def test_command_search_titles_no_titles(self): excepted_output = ( "This function needs a dictionary of comic titles." " Please see the documentation of the program for" " more info." ) old_titles = xkcd.titles_location xkcd.titles_location = "AAA" output = xkcd.command_search_titles() xkcd.titles_location = old_titles self.assertEqual(output, excepted_output)
def test_command_search_title(self): output = xkcd.command_search_titles("barrel") excepted_outputs = [ "Matches:", "(#31) Barrel - Part 5", "(#11) Barrel - Part 2", "(#1) Barrel - Part 1", "(#22) Barrel - Part 3", "(#25) Barrel - Part 4", ] for x in excepted_outputs: self.assertTrue(x in output)
def test_command_search_titles_noargs(self): excepted_output = "Missing argument: query" output = xkcd.command_search_titles() self.assertEqual(output, excepted_output)