assert test_3.label == 'len(chars) <= 10' assert test_3.success == TEST_COUNT assert test_3.failure == 0 it "can register 2 tests and should succeed when it runs them": TEST_COUNT = 100 TEST_LABEL_1 = '!(x || y) == !x && !y' TEST_LABEL_2 = 'x * y == y * x and x + y == y + x' def eq(x,y): return x * y == y * x and x + y == y + x results = PyQCheck().add( for_all( ('boolean', 'boolean'), TEST_LABEL_1, lambda x, y: (not(x or y)) == ((not x) and (not y)) ) ).add( for_all( ('integer', 'integer'), TEST_LABEL_2, eq ) ).run(TEST_COUNT).results assert len(results) == 2 result_1 = results[0] result_2 = results[1]
describe "for_all test": before each: PyQCheck.TEST_STACK = [] it "should succeed all tests when for_all creates an all true property": test_label = '!(x || y) == !x && !y' test_func = lambda x, y: (not(x or y)) == ((not x) and (not y)) result = ( PropRunner(1000).run( for_all( ('boolean', 'boolean'), test_label, test_func ) ).test_result ) assert result.label == test_label assert result.success == 1000 assert result.failure == 0 it "should succeed all tests when for_all creates an all true property with limitations": test_label = 'x + y == y + x' test_func = lambda x, y: x + y == y + x result = ( PropRunner(1000).run(