Ejemplo n.º 1
0
def test_quantity_str():
    q = Quantity(str, "hallo")
    assert not q.valid("ssdf")
    assert q.valid("hallo")
    assert not q.valid(101)
    assert not q.valid(101.0)
    assert not q.valid(True)
Ejemplo n.º 2
0
def test_quantity_int_value_low_high():
    q = Quantity(int, value_low=100, value_high=101)
    assert not q.valid("ssdf")
    assert q.valid(101)
    assert q.valid(101.0)
    assert q.valid(100)
    assert q.valid(100.0)
    assert not q.valid(101.1)
    assert not q.valid(99.99999)
    assert q.valid(100.1)
    assert not q.valid(True)
Ejemplo n.º 3
0
def test_quantity_int_value_low():
    q = Quantity(int, value_low=101)
    assert not q.valid("ssdf")
    assert q.valid(101)
    assert q.valid(101.0)
    assert q.valid(110)
    assert not q.valid(100.99999)
    assert not q.valid(True)
Ejemplo n.º 4
0
def test_quantity_int_value():
    q = Quantity(int, 101)
    assert not q.valid("ssdf")
    assert q.valid(101)
    assert q.valid(101.0)
    assert not q.valid(True)
Ejemplo n.º 5
0
def test_quantity_bool():
    q = Quantity(bool, True)
    assert not q.valid("ssdf")
    assert not q.valid(101)
    assert not q.valid(101.0)
    assert q.valid(True)