def pretty( d ) : if ( d == None ) : return None keys = sorted( list( d.keys() ) ) items = '' for k in keys : v = d[ k ] item = str( k ) + ': ' + str( v ) + ', ' items = items + item n = len( items ) items = '{ ' + items[ 0 : n-2 ] + ' }' return items def test_id() : import me who = me.id() print( 'me.id():', who ) def test_ike() : import al x0 = [1, 1]; x1 = [1, 2, True, 2]; x2 = [ 1, 2, 'a']; x3 = [] y0 = [1, 1, 1]; y1 = [True, 2, 2, 1]; y2 = [2, 1, 2]; y3 = [] tests = [ [x0, y0], [x1, y1], [x2, y2], [x3, y3] ] for i in range( 0, 4 ) : x, y = tests[ i ] b = al.ike( x, y ) print( 'al.ike( x' + str( i ) + ',', 'y' + str( i ), '):', b ) def test_ear() : import lin tests = [ [3, 5, 4], [ 2, 4, 3], [10, 15, 2] ] for test in tests : m, b, x = test y = lin.ear( m, b, x ) print( 'lin.ear(', m, ',', b, ',', x, '):', y ) def test_ction() : import di x0 = ['m', 'i', 'm', 'i', 'c'] x1 = [3, 1, 2, 2, 1, 2] x2 = [True, False, True, True] tests =[ x0, x1, x2 ] for i in range( 0, 3 ) : x = tests[ i ] d = di.ction( x ) print( 'di.ction( x' + str( i ), '):', pretty( d ) ) def test_one() : import ph tests =[ '2024561111', '8602941986', '2125552368' ] for test in tests : n = ph.one( test ) print( 'ph.one(', "'" + test + "'", '):', n ) def test_le() : import tab d0 = [[1], [2, 4], [5, 3, 7, 7, 3, 3]] d1 = [[5, 6, 5], [7, 3, 5, 5], [4, 7, 9, 8, 2, 3]] d2 = [[1, 4, 6], [4, 8, 2, 7], [3, 8, 4, 5, 8, 5]] d3 = [[3, 1, 4, 1, 5, 9]] tests = [ d0, d1, d2, d3 ] for c in range( 0, 4 ) : d = tests[ c ] column = tab.le( d, c ) print( 'tab.le( d' + str( c ) + ',', c, '):', column ) if ( __name__ == '__main__' ) : test_id() print() print() test_ear() print() print() test_one() print() print() test_ike() print() print() test_ction() print() print() test_le() print() print()