cut = 'two_cover_sublist'
actual = generate_util.two_cover_sublist([[1,2],[3,4],['a','b']], [0,1,2])
expected = [[1, 3, 'a'], [2, 4, 'a'], [1, 4, 'b'], [2, 3, 'b']]
message = '''Error in %s:
\tactual: %s
\texpected: %s
'''
if actual != expected:
	print message % (cut,str(actual),str(expected))

# primitives ----------------------------------------------------

# ********** cross_product

# cross product of 1 domain
actual = generate_util.cross_product([[1,2]])
expected = [[1],[2]]
if actual != expected:
	print 'Error:\n\tactual: %s\n\texpected: %s' % (str(actual),str(expected))

# cross product of 2 domains
actual = generate_util.cross_product([[1,2],[3,4]])
expected = [[1,3],[1,4],[2,3],[2,4]]
if actual != expected:
	print 'Error:\n\tactual: %s\n\texpected: %s' % (str(actual),str(expected))

# ********** generalize

# None count is 0
actual = generate_util.generalize([1,2,3],0)
expected = [[1,2,3]]
Exemple #2
0
actual = generate_util.two_cover_sublist([[1, 2], [3, 4], ['a', 'b']],
                                         [0, 1, 2])
expected = [[1, 3, 'a'], [2, 4, 'a'], [1, 4, 'b'], [2, 3, 'b']]
message = '''Error in %s:
\tactual: %s
\texpected: %s
'''
if actual != expected:
    print message % (cut, str(actual), str(expected))

# primitives ----------------------------------------------------

# ********** cross_product

# cross product of 1 domain
actual = generate_util.cross_product([[1, 2]])
expected = [[1], [2]]
if actual != expected:
    print 'Error:\n\tactual: %s\n\texpected: %s' % (str(actual), str(expected))

# cross product of 2 domains
actual = generate_util.cross_product([[1, 2], [3, 4]])
expected = [[1, 3], [1, 4], [2, 3], [2, 4]]
if actual != expected:
    print 'Error:\n\tactual: %s\n\texpected: %s' % (str(actual), str(expected))

# ********** generalize

# None count is 0
actual = generate_util.generalize([1, 2, 3], 0)
expected = [[1, 2, 3]]