From 47c9938d958f9438c0e170dd0e9bf1cc0acd49fd Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Mon, 23 Sep 2024 16:36:58 -0700 Subject: [PATCH] use is true for bool var (#3973) --- reflex/vars/sequence.py | 8 -------- tests/test_var.py | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/reflex/vars/sequence.py b/reflex/vars/sequence.py index ca8967d338..6145c980c2 100644 --- a/reflex/vars/sequence.py +++ b/reflex/vars/sequence.py @@ -194,14 +194,6 @@ def strip(self) -> StringVar: """ return string_strip_operation(self) - def bool(self): - """Boolean conversion. - - Returns: - The boolean value of the string. - """ - return self.length() != 0 - def reversed(self) -> StringVar: """Reverse the string. diff --git a/tests/test_var.py b/tests/test_var.py index e9998c4568..31bf805689 100644 --- a/tests/test_var.py +++ b/tests/test_var.py @@ -968,7 +968,7 @@ def test_all_number_operations(): [ (Var.create(False), "false"), (Var.create(True), "true"), - (Var.create("false"), '("false".split("").length !== 0)'), + (Var.create("false"), 'isTrue("false")'), (Var.create([1, 2, 3]), "isTrue([1, 2, 3])"), (Var.create({"a": 1, "b": 2}), 'isTrue(({ ["a"] : 1, ["b"] : 2 }))'), (Var("mysterious_var"), "isTrue(mysterious_var)"),