File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -485,8 +485,9 @@ def get_handler(self, arg: Var[str]):
485485 _ = rx .input (on_change = w .get_handler )
486486
487487
488- def test_event_var_bool_conversion ():
489- """Test that EventVar and EventChainVar cannot be converted to booleans."""
488+ def test_event_var_in_rx_cond ():
489+ """Test that EventVar and EventChainVar cannot be used in rx.cond()."""
490+ from reflex .components .core .cond import cond as rx_cond
490491
491492 class S (BaseState ):
492493 @event
@@ -495,7 +496,7 @@ def s(self):
495496
496497 handler_var = Var .create (S .s )
497498 with pytest .raises (TypeError ) as err :
498- handler_var . bool ( )
499+ rx_cond ( handler_var , rx . text ( "True" ), rx . text ( "False" ) )
499500 assert "Cannot convert" in str (err .value )
500501 assert "to bool" in str (err .value )
501502
@@ -509,6 +510,6 @@ def _args_spec() -> tuple:
509510 )
510511 )
511512 with pytest .raises (TypeError ) as err :
512- chain_var . bool ( )
513+ rx_cond ( chain_var , rx . text ( "True" ), rx . text ( "False" ) )
513514 assert "Cannot convert" in str (err .value )
514515 assert "to bool" in str (err .value )
You can’t perform that action at this time.
0 commit comments