Example #1
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()
Example #2
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()
Example #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()
Example #4
0
def test_rpv_002_simple():
    data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

    # with list
    rules = [R.List(), R.Size(10)]
    rpv = RPV(data, rules)
    assert rpv.execute()

    # without list
    rules = [R.Integer(), R.Size(10)]
    rpv = RPV(data, rules)
    assert not rpv.execute()
Example #5
0
def test_rpv_001_simple():
    data = "10"

    # with integer
    rules = [R.Integer(), R.Size(10)]
    rpv = RPV(data, rules)
    assert rpv.execute()

    # without integer
    rules = [R.Size(10)]
    rpv = RPV(data, rules)
    assert not rpv.execute()
Example #6
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()
Example #7
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()
Example #8
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()
Example #9
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()
Example #10
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()
Example #11
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()
Example #12
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()