Пример #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)