def test_list_02(): assert not List().check(None) assert not List().check({}) assert not List().check("abc") assert not List().check({1, 2}) assert not List().check(123)
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()
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()
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()
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()
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()
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()
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()
def test_list_01(): assert List().check([1, 2, 3]) assert List().check(["a", "b", "c"]) assert List().check([{}]) assert List().check([{1, 2, 3}]) assert List().check([(1, 2)]) assert List().check([(1, 2), [3, 4], {5, 6}, {7: 8}, "9"])