use is true for bool var (#3973)
This commit is contained in:
parent
ee3b0e614c
commit
47c9938d95
@ -194,14 +194,6 @@ class StringVar(Var[str]):
|
|||||||
"""
|
"""
|
||||||
return string_strip_operation(self)
|
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:
|
def reversed(self) -> StringVar:
|
||||||
"""Reverse the string.
|
"""Reverse the string.
|
||||||
|
|
||||||
|
@ -968,7 +968,7 @@ def test_all_number_operations():
|
|||||||
[
|
[
|
||||||
(Var.create(False), "false"),
|
(Var.create(False), "false"),
|
||||||
(Var.create(True), "true"),
|
(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([1, 2, 3]), "isTrue([1, 2, 3])"),
|
||||||
(Var.create({"a": 1, "b": 2}), 'isTrue(({ ["a"] : 1, ["b"] : 2 }))'),
|
(Var.create({"a": 1, "b": 2}), 'isTrue(({ ["a"] : 1, ["b"] : 2 }))'),
|
||||||
(Var("mysterious_var"), "isTrue(mysterious_var)"),
|
(Var("mysterious_var"), "isTrue(mysterious_var)"),
|
||||||
|
Loading…
Reference in New Issue
Block a user