コード例 #1
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def kv_unicodes_lists():
    u = unicodes()
    l = lists()
    while True:
        yield (u.next(), l.next())
コード例 #2
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def random_int_unicode_tuple():
    i = integers()
    u = unicodes()
    while True:
        yield (i.next(), u.next())
コード例 #3
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def kv_unicode_integers():
    u = unicodes()
    i = integers()
    while True:
        yield (u.next(), i.next())
コード例 #4
0
ファイル: test_qc.py プロジェクト: davidedelvento/qc
def kv_unicodes_lists(): # key-value helper
    u = unicodes()
    l = lists()
    while True:
        yield (u.next(), l.next())
コード例 #5
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
@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

@forall(tries=10, l=lists(items=integers(), size=(10, 50)))
def test_lists_size(l):
    assert len(l) <= 50 and len(l) >= 10

@forall(tries=10, l=tuples(items=integers(), size=(10, 50)))
def test_tuples_size(l):
    assert len(l) <= 50 and len(l) >= 10

@forall(tries=10, u=unicodes())
def test_unicodes(u):
コード例 #6
0
def kv_unicode_integers():
    u = unicodes()
    i = integers()
    while True:
        yield (u.next(), i.next())
コード例 #7
0
ファイル: test_qc.py プロジェクト: davidedelvento/qc
def kv_unicode_integers(): # key-value helper
    u = unicodes()
    i = integers()
    while True:
        yield (u.next(), i.next())
コード例 #8
0
def random_int_unicode_tuple():
    i = integers()
    u = unicodes()
    while True:
        yield (i.next(), u.next())
コード例 #9
0
def kv_unicodes_lists():
    u = unicodes()
    l = lists()
    while True:
        yield (u.next(), l.next())
コード例 #10
0
    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


@forall(tries=10, l=lists(items=integers(), size=(10, 50)))
def test_lists_size(l):
    assert len(l) <= 50 and len(l) >= 10


@forall(tries=10, l=tuples(items=integers(), size=(10, 50)))
def test_tuples_size(l):
    assert len(l) <= 50 and len(l) >= 10
コード例 #11
0
ファイル: ex1_nose.py プロジェクト: SemanticMD/qc
from qc import forall, unicodes

# This example is adapted from Scala's
# https://github.com/rickynils/scalacheck
# and we are pretending to test the string
# concatenation, slicing and the len builtin

@forall(tries=2000, a=unicodes(), b=unicodes())
def testStartswith(a, b):
    concat = a + b
    assert concat.startswith(a)

@forall(tries=10, a=unicodes(), b=unicodes())
def testConcatenation(a, b):
    concat = a + b
    # the following is meant to fail as an example of a failure
    assert len(concat) > len(a)
    assert len(concat) > len(b)

@forall(a=unicodes(), b=unicodes(), c=unicodes())
def testSubstring(a, b, c):
    concat = a + b + c
    start = len(a)
    stop = len(a) + len(b)
    assert concat[start: stop] == b


コード例 #12
0
ファイル: test_qc.py プロジェクト: lbolla/qc
@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

@forall(tries=10, l=lists(items=integers(), size=(10, 50)))
def test_lists_size(l):
    assert len(l) <= 50 and len(l) >= 10

@forall(tries=10, l=tuples(items=integers(), size=(10, 50)))
def test_tuples_size(l):
    assert len(l) <= 50 and len(l) >= 10

@forall(tries=10, u=unicodes())
def test_unicodes(u):