示例#1
0
    def test_func_parse_input_error(self):
        def cmd(*arguments):
            raise Exception(arguments)

        xkcd.commands["test"] = cmd
        out = xkcd.parse_input("test Test")
        expected_output = "('Test',)"
        self.assertEqual(out, expected_output)
示例#2
0
 def test_parse_input_no_cmd(self):
     output = xkcd.parse_input("")
     expected_output = ""
     self.assertEqual(output, expected_output)
示例#3
0
 def test_func_parse_input_unknown_cmd(self):
     cmd = "nosuchcommand"
     output = xkcd.parse_input(cmd)
     excepted_output = "Unknown command\n"
     self.assertEqual(output, excepted_output)
示例#4
0
 def test_func_parse_input(self):
     cmd = "license"
     output = xkcd.parse_input(cmd)
     excepted_output = program_license + "\n"
     self.assertEqual(output, excepted_output)