mirror of
https://github.com/apache/superset.git
synced 2026-05-07 17:04:58 +00:00
chore: add talisman env var to config (#24774)
(cherry picked from commit d23b20ea75)
This commit is contained in:
committed by
Michael S. Molina
parent
b272814ff5
commit
e46f10a8a6
@@ -20,6 +20,7 @@ from typing import Any, Optional
|
||||
import pytest
|
||||
|
||||
from superset.utils.core import (
|
||||
cast_to_boolean,
|
||||
is_test,
|
||||
parse_boolean_string,
|
||||
QueryObjectFilterClause,
|
||||
@@ -132,3 +133,41 @@ def test_is_test():
|
||||
)
|
||||
def test_parse_boolean_string(test_input: Optional[str], expected: bool):
|
||||
assert parse_boolean_string(test_input) == expected
|
||||
|
||||
|
||||
def test_int_values():
|
||||
assert cast_to_boolean(1) is True
|
||||
assert cast_to_boolean(0) is False
|
||||
assert cast_to_boolean(-1) is True
|
||||
assert cast_to_boolean(42) is True
|
||||
assert cast_to_boolean(0) is False
|
||||
|
||||
|
||||
def test_float_values():
|
||||
assert cast_to_boolean(0.5) is True
|
||||
assert cast_to_boolean(3.14) is True
|
||||
assert cast_to_boolean(-2.71) is True
|
||||
assert cast_to_boolean(0.0) is False
|
||||
|
||||
|
||||
def test_string_values():
|
||||
assert cast_to_boolean("true") is True
|
||||
assert cast_to_boolean("TruE") is True
|
||||
assert cast_to_boolean("false") is False
|
||||
assert cast_to_boolean("FaLsE") is False
|
||||
assert cast_to_boolean("") is False
|
||||
|
||||
|
||||
def test_none_value():
|
||||
assert cast_to_boolean(None) is None
|
||||
|
||||
|
||||
def test_boolean_values():
|
||||
assert cast_to_boolean(True) is True
|
||||
assert cast_to_boolean(False) is False
|
||||
|
||||
|
||||
def test_other_values():
|
||||
assert cast_to_boolean([]) is False
|
||||
assert cast_to_boolean({}) is False
|
||||
assert cast_to_boolean(object()) is False
|
||||
|
||||
Reference in New Issue
Block a user