mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
chore: add talisman env var to config (#24774)
This commit is contained in:
committed by
GitHub
parent
554ef07eed
commit
d23b20ea75
@@ -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