Esempio n. 1
0
def test_between_05():
    rpv = RPV(data=-15, rules=[Integer(), Between(-15, 30)])
    assert rpv.execute()

    rpv = RPV(data=30, rules=[Integer(), Between(-15, 30)])
    assert rpv.execute()

    rpv = RPV(data=0, rules=[Integer(), Between(-15, 30)])
    assert rpv.execute()
Esempio n. 2
0
def test_between_04():
    rpv = RPV(data=5, rules=[Integer(), Between(2, 18)])
    assert rpv.execute()

    rpv = RPV(data=1, rules=[Integer(), Between(2, 18)])
    assert not rpv.execute()

    rpv = RPV(data=19, rules=[Integer(), Between(2, 18)])
    assert not rpv.execute()
Esempio n. 3
0
def test_size_04_rpv():
    rpv = RPV(data=100, rules=[Integer(), Size(10)])
    assert not rpv.execute()

    rpv = RPV(data=100, rules=[Integer(), Size(0)])
    assert not rpv.execute()

    rpv = RPV(data=[1, 2, 3], rules=[List(), Size(6)])
    assert not rpv.execute()

    rpv = RPV([], rules=[List(), Size(-1)])
    assert not rpv.execute()
Esempio n. 4
0
def test_size_03_rpv():
    rpv = RPV(data=18, rules=[Integer(), Size(18)])
    assert rpv.execute()

    rpv = RPV(data=0, rules=[Integer(), Size(0)])
    assert rpv.execute()

    rpv = RPV(data=[1, 2, 3], rules=[List(), Size(3)])
    assert rpv.execute()

    rpv = RPV(data=[], rules=[List(), Size(0)])
    assert rpv.execute()
Esempio n. 5
0
def test_max_05_rpv():
    rpv = RPV(1000, [Integer(), Max(10)])
    assert not rpv.execute()

    rpv = RPV(0, [Integer(), Max(-10)])
    assert not rpv.execute()

    rpv = RPV([1, 2, 3], [List(), Max(2)])
    assert not rpv.execute()

    rpv = RPV([], [List(), Max(-1)])
    assert not rpv.execute()
Esempio n. 6
0
def test_size_03_rpv():
    rpv = RPV(data="0b01011001", rules=[Integer(), Size(89)])
    assert rpv.execute()

    rpv = RPV(data="0o113356", rules=[Integer(), Size(38638)])
    assert rpv.execute()

    rpv = RPV(data="12313", rules=[Integer(), Size(12313)])
    assert rpv.execute()

    rpv = RPV(data="0x1f", rules=[Integer(), Size(31)])
    assert rpv.execute()

    rpv = RPV(data=[1, 2, 3], rules=[List(), Size(3)])
    assert rpv.execute()

    rpv = RPV(data=[], rules=[List(), Size(0)])
    assert rpv.execute()
Esempio n. 7
0
def test_min_04_rpv():
    rpv = RPV(data=1000, rules=[Integer(), Min(10)])
    assert rpv.execute()

    rpv = RPV(data=0, rules=[Integer(), Min(-10)])
    assert rpv.execute()

    rpv = RPV(data=18, rules=[Integer(), Min(18)])
    assert rpv.execute()

    rpv = RPV(data=0, rules=[Integer(), Min(0)])
    assert rpv.execute()

    rpv = RPV(data=[1, 2, 3], rules=[List(), Min(2)])
    assert rpv.execute()

    rpv = RPV(data=[], rules=[List(), Min(-1)])
    assert rpv.execute()
Esempio n. 8
0
def test_max_04_rpv():
    rpv = RPV(18, [Integer(), Max(18)])
    assert rpv.execute()

    rpv = RPV(0, [Integer(), Max(0)])
    assert rpv.execute()

    rpv = RPV(0, [Integer(), Max(10)])
    assert rpv.execute()

    rpv = RPV([1, 2, 3], [List(), Max(3)])
    assert rpv.execute()

    rpv = RPV([], [List(), Max(0)])
    assert rpv.execute()

    rpv = RPV([], [List(), Max(10)])
    assert rpv.execute()
Esempio n. 9
0
def test_min_05_rpv():
    rpv = RPV(data=0, rules=[Integer(), Min(10)])
    assert not rpv.execute()

    rpv = RPV(data=[1, 2, 3], rules=[List(), Min(4)])
    assert not rpv.execute()

    rpv = RPV(data=[], rules=[List(), Min(1)])
    assert not rpv.execute()

    rpv = RPV(data=[], rules=[List(), Min(10)])
    assert not rpv.execute()
Esempio n. 10
0
def test_integer_01():
    assert Integer().check("23")

    assert Integer().check("0")

    assert Integer().check("99999")

    assert Integer().check("85189125")

    assert Integer().check("-1")

    assert Integer().check("-10000")

    assert Integer().check("-161651651")
Esempio n. 11
0
def test_integer_03():
    assert not Integer().check("-")

    assert not Integer().check("9.1")

    assert not Integer().check("-0.0")

    assert not Integer().check("0.0")

    assert not Integer().check("10.0")

    assert not Integer().check("-10000.213")

    assert not Integer().check("-161651651.12312312312")
Esempio n. 12
0
def test_integer_02():
    assert Integer().check(23)

    assert Integer().check(0)

    assert Integer().check(99999)

    assert Integer().check(85189125)

    assert Integer().check(-1)

    assert Integer().check(-10000)

    assert Integer().check(-161651651)
Esempio n. 13
0
def test_integer_05():
    assert not Integer().check([])

    assert not Integer().check([0, 1, 2])

    assert not Integer().check("string")

    assert not Integer().check(None)

    assert not Integer().check({"a": 2})

    assert not Integer().check(__file__)
Esempio n. 14
0
def test_integer_04():
    assert not Integer().check(9.1)

    assert not Integer().check(-0.0)

    assert not Integer().check(0.0)

    assert not Integer().check(10.0)

    assert not Integer().check(-10000.213)

    assert not Integer().check(-161651651.12312312312)
Esempio n. 15
0
def test_between_06():
    rpv = RPV(data=5, rules=[Integer(), Between(5, 5)])
    assert rpv.execute()

    rpv = RPV(data=0, rules=[Integer(), Between(5, 5)])
    assert not rpv.execute()