Example #1
0
    assert positive_small == True
    assert positive_one == True
    assert positive_large == True
    assert positive_max == True
    assert positive_inf == True
    assert nan == True

# Lists and tuples 

@forall(tries=10, l=lists(items=integers()))
def test_a_int_list(l):
    assert type(l) == list, "expected a list, instead got a " + str(type(l))
    for i in l:
        assert type(i) == int, "expected an int, instead got a " + str(type(i))

@forall(tries=10, t=tuples(items=integers()))
def test_a_int_tuple(t):
    assert type(t) == tuple, "expected a tuple, instead got a " + str(type(t))
    for i in t:
        assert type(i) == int, "expected an int, instead got a " + str(type(i))

@forall(tries=10, l=lists(items=floats()))
def test_a_float_list(l):
    assert type(l) == list, "expected a list, instead got a " + str(type(l))
    for i in l:
        assert type(i) == float, "expected a float, instead got a " + str(type(i))

@forall(tries=10, t=tuples(items=floats()))
def test_a_float_tuple(t):
    assert type(t) == tuple, "expected a tuple, instead got a " + str(type(t))
    for i in t:
Example #2
0
__FILENAME__ = test_qc
from qc import integers, floats, unicodes, characters, lists, tuples, dicts, objects, forall

@forall(tries=10, i=integers())
def test_integers(i):
    assert type(i) == int
    assert i >= 0 and i <= 100

@forall(tries=10, l=lists(items=integers()))
def test_a_int_list(l):
    assert type(l) == list

@forall(tries=10, l=tuples(items=integers()))
def test_a_int_tuple(l):
    assert type(l) == tuple

@forall(tries=10, i=floats())
def test_floats(i):
    assert type(i) == float
    assert i >= 0.0 and i <= 100.0

@forall(tries=10, l=lists(items=floats()))
def test_a_float_list(l):
    assert type(l) == list
    assert reduce(lambda x,y: x and type(y) == float, l, True)

@forall(tries=10, ul=lists(items=unicodes()))
def test_unicodes_list(ul):
    assert type(ul) == list
    if len(ul):
        assert type(ul[0]) == unicode
Example #3
0
__FILENAME__ = test_qc
from qc import integers, floats, unicodes, characters, lists, tuples, dicts, objects, forall


@forall(tries=10, i=integers())
def test_integers(i):
    assert type(i) == int
    assert i >= 0 and i <= 100


@forall(tries=10, l=lists(items=integers()))
def test_a_int_list(l):
    assert type(l) == list


@forall(tries=10, l=tuples(items=integers()))
def test_a_int_tuple(l):
    assert type(l) == tuple


@forall(tries=10, i=floats())
def test_floats(i):
    assert type(i) == float
    assert i >= 0.0 and i <= 100.0


@forall(tries=10, l=lists(items=floats()))
def test_a_float_list(l):
    assert type(l) == list
    assert reduce(lambda x, y: x and type(y) == float, l, True)