kristynsmith commented on code in PR #40711: URL: https://github.com/apache/beam/pull/40711#discussion_r4473787097
########## sdks/python/apache_beam/internal/code_object_pickler_test.py: ########## @@ -76,6 +83,92 @@ def function_decorator(f): return lambda x: f(f(x)) +def get_zero_arg_and_one_arg_lambdas(): + return (lambda: 1, lambda x: 2) + + +def get_same_co_code_lambdas(): + tag_a = "train" + tag_b = "test" + return (lambda x: (tag_a, x), lambda x: (tag_b, x)) + + +def get_single_lambda_and_nested_function_with_lambda(): + unused_outer_lambda = lambda x: x + 1 + + def inner_fn(): + return lambda y: y + 2 + + return inner_fn() + + +def shared_wrapper_decorator(fn): + @functools.wraps(fn) + def wrapper(*args, **kwargs): + return fn(*args, **kwargs) + + return wrapper + + +@shared_wrapper_decorator +def outer_decorated_with_shared_wrapper(): + @shared_wrapper_decorator + def inner_decorated(): + return 1 + + return inner_decorated + + +def get_same_named_nested_functions_different_args(branch): + if branch: + + def nested_fn(x): + return x + 1 + else: + + def nested_fn(x, y): + return x + y + + return nested_fn + + +def get_same_named_nested_functions_same_args(branch): + if branch: + + def nested_fn(x): + return x + 1 + else: + + def nested_fn(x): + return x + 2 + + return nested_fn + + +def get_same_named_nested_functions_with_complex_consts(branch): + if branch: + + def nested_fn(x): + def inner(x): Review Comment: yes, good catch -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
