def test_command_search_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() xkcd.titles_location = old_titles self.assertEqual(output, excepted_output)
def test_command_search(self): output = xkcd.command_search("barrel") expected_outputs = [ "Matches:", "(#1) Barrel - Part 1", "(#11) Barrel - Part 2", "(#374) Journal", "(#25) Barrel - Part 4", "(#960) Subliminal", "(#728) iPad", "(#22) Barrel - Part 3", "(#1455) Trolley Problem", "(#31) Barrel - Part 5", "(#746) Birth", ] for x in expected_outputs: self.assertTrue(x in output)
def test_command_search_noargs(self): output = xkcd.command_search() excepted_output = "Missing argument: query" self.assertEqual(output, excepted_output)