Exemplo n.º 1
0
def test_curried_function_annotation_drops_arguments_as_it_is_applied(
) -> None:
    def add3(a: int, b: int, c: int) -> int:
        return a + b + c

    assert (inspect.Signature(
        [
            inspect.Parameter(
                param, inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=int)
            for param in ["b", "c"]
        ],
        return_annotation=int,
    ) == inspect.signature(curry(add3)(1)))
Exemplo n.º 2
0
def test_curry() -> None:
    def add3(a: int, b: int, c: int) -> int:
        return a + b + c

    assert add3(1, 2, 3) == curry(add3)(1)(2)(3)
Exemplo n.º 3
0
def test_curried_function_annotation_matches_original_function() -> None:
    def add3(a: int, b: int, c: int) -> int:
        return a + b + c

    assert inspect.signature(add3) == inspect.signature(curry(add3))