def test_event_var_in_rx_cond():
    """Test that EventVar and EventChainVar cannot be used in rx.cond()."""
    from reflex.components.core.cond import cond as rx_cond

    class S(BaseState):
        @event
        def s(self):
            pass

    handler_var = Var.create(S.s)
    with pytest.raises(TypeError) as err:
        rx_cond(handler_var, rx.text("True"), rx.text("False"))
    assert "Cannot convert" in str(err.value)
    assert "to bool" in str(err.value)

    def _args_spec() -> tuple:
        return ()

    chain_var = Var.create(
        EventChain(
            events=[S.s()],
            args_spec=_args_spec,
        )
    )
    with pytest.raises(TypeError) as err:
        rx_cond(chain_var, rx.text("True"), rx.text("False"))
    assert "Cannot convert" in str(err.value)
    assert "to bool" in str(err.value)
Test that EventVar and EventChainVar cannot be used in rx.cond().
tests/units/test_event.py