diff --git a/reflex/utils/types.py b/reflex/utils/types.py index 390b5426e..dec0f4eaf 100644 --- a/reflex/utils/types.py +++ b/reflex/utils/types.py @@ -195,8 +195,6 @@ def unionize(*args: GenericType) -> Type: return Any if len(args) == 1: return args[0] - if sys.version_info >= (3, 11): - return Union[*args] # type: ignore # We are bisecting the args list here to avoid hitting the recursion limit # In Python versions >= 3.11, we can simply do `return Union[*args]` midpoint = len(args) // 2 diff --git a/tests/units/test_var.py b/tests/units/test_var.py index 86170e5d5..3e0da66f6 100644 --- a/tests/units/test_var.py +++ b/tests/units/test_var.py @@ -399,11 +399,15 @@ def test_list_tuple_contains(var, expected): class Foo(rx.Base): + """Foo class.""" + bar: int baz: str class Bar(rx.Base): + """Bar class.""" + bar: str baz: str foo: int @@ -416,7 +420,10 @@ class Bar(rx.Base): (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type(), Union[Foo, Bar]), (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().bar, Union[int, str]), (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().baz, str), - (Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().foo, Union[int, None]), + ( + Var(_js_expr="", _var_type=Union[Foo, Bar]).guess_type().foo, + Union[int, None], + ), ], ) def test_var_types(var, var_type):