#NEWLINE# def test_diop_partition( ) : #NEWLINE# #INDENT# for n in [ 8 , 10 ] : #NEWLINE# #INDENT# for k in range ( 1 , 8 ) : #NEWLINE# #INDENT# for p in partition ( n , k ) : #NEWLINE# #INDENT# assert ( len ( p ) == p ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# assert ( [ p for p in partition ( 3 , 5 ) ] == [ ] ) #NEWLINE# assert ( [ list ( p ) for p in partition ( 3 , 5 , 1 ) ] == [ [ 0 , 0 , 0 , 0 , 3 ] , [ 0 , 0 , 0 , 1 , 2 ] , [ 0 , 0 , 1 , 1 , 1 ] ] ) #NEWLINE# assert ( list ( partition ( 0 ) ) == [ ( ) ] ) #NEWLINE# assert ( list ( partition ( 1 , 0 ) ) == [ ( ) ] ) #NEWLINE# assert ( [ list ( i ) for i in partition ( 3 ) ] == [ [ 1 , 1 , 1 ] , [ 1 , 2 ] , [ 3 ] ] )