예제 #1
0
def test_parse_bool_failure():
    v = Value(type_name="bool")

    v._value = ""
    assert v.value is False

    v._value = list()
    assert v.value is False

    v._value = dict()
    assert v.value is False

    v._value = set()
    assert v.value is False
예제 #2
0
def test_parse_bool_success():
    v = Value(type_name="bool")

    v._value = 1
    assert v.value is True

    v._value = 2.2
    assert v.value is True

    v._value = "2"
    assert v.value is True

    v._value = {"a"}
    assert v.value is True

    v._value = [1, 4, 4, 4, 4]
    assert v.value is True