Exemplo n.º 1
0
 def validate_function_call(func, name, args):
     """
     Checks that func has been called with the correct number of arguments.
     """
     num_args = len(args)
     expected = get_number_of_args(func)
     if expected != num_args:
         msg = ("Wrong number of arguments passed to {func}. "
                "Expected {num}, received {num2}.")
         raise ArgumentError(msg.format(func=name, num=expected, num2=num_args))
     return True
def test_argument_number_of_RandomFunction():
    """Tests to make sure we can extract the number of inputs expected for a random function"""
    func = RandomFunction(input_dim=3).gen_sample()
    assert validatorfuncs.get_number_of_args(func) == 3