def FunctionWithExceptions(funcname, calls): execution = EmptyProjectExecution() function = Function(funcname, sorted(calls[0][0].keys())) function.calls = [FunctionCall(function, stable_serialize_call_arguments(execution, i), exception=execution.serialize(e)) for (i,e) in calls] return function
def GeneratorWithSingleException(genname, input, exception): execution = EmptyProjectExecution() generator = Function(genname, input.keys(), is_generator=True) gobject = GeneratorObject(None, generator, stable_serialize_call_arguments(execution, input), generator) gobject.add_call(GeneratorObjectInvocation(generator, {}, exception=execution.serialize(exception))) generator.add_call(gobject) return generator
def serialize_arguments(args): return EmptyProjectExecution().serialize_call_arguments(args)
def serialize_value(value): return EmptyProjectExecution().serialize(value)