Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed redundant tests
  • Loading branch information
dbravender committed Jul 31, 2009
1 parent 9b52034 commit 34614b5
Showing 1 changed file with 1 addition and 61 deletions.
62 changes: 1 addition & 61 deletions qc/__init__.py
Expand Up @@ -3,8 +3,6 @@
import os
from functools import partial

__all__ = ['integers', 'lists', 'unicodes', 'characters', 'forall']

def evaluate(lazy_value):
while hasattr(lazy_value, '__call__'):
lazy_value = lazy_value()
Expand Down Expand Up @@ -49,62 +47,4 @@ def wrapped():
return wrap
forall.verbose = False # if enabled will print out the random test cases

@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, 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, u=unicodes)
def test_unicodes(u):
assert type(u) == unicode

@forall(tries=10, u=unicodes(size=(1,1)))
def test_unicodes_size(u):
assert len(u) == 1

def random_int_unicode_tuple():
return lambda: (evaluate(integers), evaluate(unicodes))

@forall(tries=10, l=lists(items=random_int_unicode_tuple))
def test_a_tupled_list(l):
for x in l:
assert type(x[0]) == int and type(x[1]) == unicode

@forall(tries=10, x=integers, y=integers)
def test_addition_associative(x, y):
assert x + y == y + x

@forall(tries=10, l=lists)
def test_reverse_reverse(l):
assert list(reversed(list(reversed(l)))) == l

@forall(tries=10, c=characters)
def test_characters(c):
assert len(c) == 1

@forall(tries=10, d=dicts(items=unicodes, values=integers))
def test_dicts(d):
for x, y in d.iteritems():
assert type(x) == unicode
assert type(y) == int

@forall(tries=10, d=dicts(items=unicodes, values=lists, size=(2, 2)))
def test_dicts_size(d):
assert len(d) == 2
for x, y in d.iteritems():
assert type(x) == unicode
assert type(y) == list
__all__ = ['integers', 'lists', 'unicodes', 'characters', 'forall']

0 comments on commit 34614b5

Please sign in to comment.