Skip to content

Commit d8ecc76

Browse files
committed
-
1 parent 3659265 commit d8ecc76

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

source_py3/test_python_toolbox/test_combi/test_exhaustive.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ def _check_variation_selection(variation_selection, perm_space_type,
235235
# we'll get the illusion that the tests are running while they're
236236
# really not.
237237

238-
# blocktodo: change to 100 after finished debugging
239238
for i, (perm, brute_perm_tuple) in enumerate(
240-
itertools.islice(zip(perm_space, brute_perm_space_tuple), 10)):
239+
itertools.islice(zip(perm_space, brute_perm_space_tuple), 30)):
241240

242241
assert tuple(perm) == brute_perm_tuple
243242
assert perm in perm_space
@@ -372,6 +371,9 @@ def _check_variation_selection(variation_selection, perm_space_type,
372371

373372
perm_repr = repr(perm)
374373

374+
if variation_selection.number == 197:
375+
1 / 0
376+
375377
def _iterate_tests():
376378
for variation_selection in combi.variations.variation_selection_space:
377379

@@ -460,6 +462,12 @@ def _iterate_tests():
460462

461463

462464
# We use this shit because Nose can't parallelize generator tests:
465+
lambdas = []
463466
for i, x in enumerate(_iterate_tests()):
464-
locals()['f_%s' % i] = lambda: x[0](*x[1:])
465-
exec('def test_%s(): return f_%s()' % (i, i))
467+
f = lambda: x[0](*x[1:])
468+
f.name = 'f_%s' % i
469+
locals()[f.name] = f
470+
lambdas.append(f)
471+
for i, partition in enumerate(sequence_tools.partitions(lambdas, 1000)):
472+
exec('def test_%s(): return (%s)' %
473+
(i, ', '.join('%s()'% f.name for f in partition)))

source_py3/test_python_toolbox/test_logic_tools/test_all_equal.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from python_toolbox.logic_tools import all_equal
99

1010

11-
def test():
11+
def _iterate_exhaustive_tests():
1212
'''Test the basic working of `all_equal`.'''
1313
yield _check, False
1414
yield _check, True
@@ -36,7 +36,7 @@ def _check(exhaustive):
3636
# infinite.
3737

3838

39-
def test_exhaustive():
39+
def test_exhaustive_true():
4040
'''Test `all_equal` in cases where `exhaustive=True` is relevant.'''
4141

4242
class FunkyFloat(float):
@@ -53,3 +53,8 @@ def __eq__(self, other):
5353
assert all_equal(funky_floats)
5454
assert not all_equal(funky_floats, exhaustive=True)
5555

56+
57+
# We use this shit because Nose can't parallelize generator tests:
58+
for i, x in enumerate(_iterate_exhaustive_tests()):
59+
locals()['f_%s' % i] = lambda: x[0](*x[1:])
60+
exec('def test_%s(): return f_%s()' % (i, i))

0 commit comments

Comments
 (0)