def test_valid_event_handler_args(component2, test_state):
    """Test that an valid event handler args do not raise exception.

    Args:
        component2: A test component.
        test_state: A test state.
    """
    # Uncontrolled event handlers should not take args.
    component2.create(on_blur=test_state.do_something)
    component2.create(on_blur=test_state.do_something_arg(1))

    # Does not raise because event handlers are allowed to have less args than the spec.
    component2.create(on_open=test_state.do_something)
    component2.create(on_prop_event=test_state.do_something)

    # Does not raise because event handlers can have optional args.
    component2.create(
        on_user_visited_count_changed=test_state.do_something_required_optional
    )
    component2.create(on_two_args=test_state.do_something_required_optional)

    # Controlled event handlers should take args.
    component2.create(on_open=test_state.do_something_arg)
    component2.create(on_prop_event=test_state.do_something_arg)

    # Using a partial event spec bypasses arg validation (ignoring the args).
    component2.create(on_open=test_state.do_something())
    component2.create(on_prop_event=test_state.do_something())

    # Multiple EventHandler args: all must match
    component2.create(on_open=[test_state.do_something_arg, test_state.do_something])
    component2.create(
        on_prop_event=[test_state.do_something_arg, test_state.do_something]
    )

    # lambda returning EventHandler is okay if the spec matches.
    component2.create(on_blur=lambda: test_state.do_something)
    component2.create(on_open=lambda _: test_state.do_something_arg)
    component2.create(on_prop_event=lambda _: test_state.do_something_arg)
    component2.create(on_open=lambda: test_state.do_something)
    component2.create(on_prop_event=lambda: test_state.do_something)
    component2.create(on_open=lambda _: test_state.do_something)
    component2.create(on_prop_event=lambda _: test_state.do_something)

    # lambda can always return an EventSpec.
    component2.create(on_blur=lambda: test_state.do_something_arg(1))
    component2.create(on_open=lambda _: test_state.do_something_arg(1))
    component2.create(on_prop_event=lambda _: test_state.do_something_arg(1))

    # Return EventSpec and EventHandler (no arg).
    component2.create(
        on_blur=lambda: [test_state.do_something_arg(1), test_state.do_something]
    )
    component2.create(
        on_blur=lambda: [test_state.do_something_arg(1), test_state.do_something()]
    )

    # Return 2 EventSpec.
    component2.create(
        on_open=lambda _: [test_state.do_something_arg(1), test_state.do_something()]
    )
    component2.create(
        on_prop_event=lambda _: [
            test_state.do_something_arg(1),
            test_state.do_something(),
        ]
    )

    # Return EventHandler (1 arg) and EventSpec.
    component2.create(
        on_open=lambda _: [test_state.do_something_arg, test_state.do_something()]
    )
    component2.create(
        on_prop_event=lambda _: [test_state.do_something_arg, test_state.do_something()]
    )
    component2.create(
        on_open=lambda _: [test_state.do_something_arg(1), test_state.do_something]
    )
    component2.create(
        on_prop_event=lambda _: [
            test_state.do_something_arg(1),
            test_state.do_something,
        ]
    )
Test that an valid event handler args do not raise exception.

    Args:
        component2: A test component.
        test_state: A test state.
    
tests/units/components/test_component.py