Example #1
0
    def test_get_required_args2(self):
        def yeah(mandatory):
            """
            :param mandatory:
            :return:
            """
            return mandatory

        args, defaults = get_required_args(yeah)
        self.assertTrue(args == ['mandatory'])
        self.assertTrue(defaults == [])
Example #2
0
    def test_get_required_args(self):
        def yeah(mandatory, why=0, me=1):
            """
            :param mandatory:
            :param why:
            :param me:
            :return:
            """
            return mandatory + why + me

        args, defaults = get_required_args(yeah)
        self.assertTrue(args == ['mandatory'])
        self.assertTrue(defaults == ['why', 'me'])
Example #3
0
    def get_required_args_no_context(self):
        """
        Get the arguments and default arguments of the job function.

        Any context parameter will be ignored.

        Returns
           args - the arguments of the job function.
           defaults - the default arguments of the job function.
        """
        args, defaults = misc.get_required_args(self.__call__)
        try:
            args.remove('context')
        except KeyError:
            pass
        try:
            args.remove('self')
        except KeyError:
            pass

        return args, defaults