Beispiel #1
0
 def test_call_function(self, text):
     begin_clippy(["test_clip", "top_level_function", text])
Beispiel #2
0
    def test_begin_function(self):
        with self.assertRaises(SystemExit) as err:
            begin_clippy(["some_module", "top_level_function", "--help"])

        self.assertEqual(err.exception.code, 0)
Beispiel #3
0
    def test_begin_function_invalid(self, text):
        with self.assertRaises(SystemExit) as err:
            begin_clippy(["some_module", text, "--help"])

        self.assertEqual(err.exception.code, 1)
Beispiel #4
0
    def test_begin_version_invalid(self):
        with self.assertRaises(SystemExit) as err:
            begin_clippy(["some_module", "--version"])

        self.assertEqual(err.exception.code, 1)
Beispiel #5
0
    def test_begin_help_invalid(self):
        with self.assertRaises(SystemExit) as err:
            begin_clippy(["--help"])

        self.assertEqual(err.exception.code, 1)
Beispiel #6
0
    def test_begin_one_argument(self, text):
        with self.assertRaises(SystemExit) as err:
            # noinspection PyTypeChecker
            begin_clippy(text)

        self.assertEqual(err.exception.code, 1)
Beispiel #7
0
    def test_begin_no_arguments(self):
        with self.assertRaises(SystemExit) as err:
            begin_clippy()

        self.assertEqual(err.exception.code, 1)
Beispiel #8
0
    return f"one_documented_parameter arg: {arg}"


@clippy
def documented_one_typed_documented_parameter(arg: str):
    """
    Returns a string containing the documented and typed input argument.
    :param arg: An argument.
    """
    return f"one_documented_parameter arg: {arg}"


@clippy
def documented_two_parameter_alt_syntax(arg1, arg2):
    """
    Returns a string containing the input arguments.
    @param arg1: The first argument.
    @param arg2: The second argument.
    @return: The return value.
    """
    return f"documented_two_parameter_alt_syntax: {arg1} {arg2}"


@clippy
def typed_return() -> str:
    return "typed_return"


if __name__ == "__main__":
    begin_clippy()