@@ -20,6 +20,9 @@ def VarOperations():
2020 from reflex .ivars .base import LiteralVar
2121 from reflex .ivars .sequence import ArrayVar
2222
23+ class Object (rx .Base ):
24+ str : str = "hello"
25+
2326 class VarOperationState (rx .State ):
2427 int_var1 : int = 10
2528 int_var2 : int = 5
@@ -29,6 +32,7 @@ class VarOperationState(rx.State):
2932 list1 : List = [1 , 2 ]
3033 list2 : List = [3 , 4 ]
3134 list3 : List = ["first" , "second" , "third" ]
35+ list4 : List = [Object (name = "obj_1" ), Object (name = "obj_2" )]
3236 str_var1 : str = "first"
3337 str_var2 : str = "second"
3438 str_var3 : str = "ThIrD"
@@ -474,6 +478,7 @@ def index():
474478 rx .text (
475479 VarOperationState .list1 .contains (1 ).to_string (), id = "list_contains"
476480 ),
481+ rx .text (VarOperationState .list4 .pluck ("name" ).to_string (), id = "list_pluck" ),
477482 rx .text (VarOperationState .list1 .reverse ().to_string (), id = "list_reverse" ),
478483 # LIST, INT
479484 rx .text (
@@ -749,6 +754,7 @@ def test_var_operations(driver, var_operations: AppHarness):
749754 ("list_and_list" , "[3,4]" ),
750755 ("list_or_list" , "[1,2]" ),
751756 ("list_contains" , "true" ),
757+ ("list_pluck" , '["obj_1","obj_2"]' ),
752758 ("list_reverse" , "[2,1]" ),
753759 ("list_join" , "firstsecondthird" ),
754760 ("list_join_comma" , "first,second,third" ),
0 commit comments