#NEWLINE# def test_rechunk_internals_1( ) : #NEWLINE# #INDENT# ' Test the cumdims_label and _breakpoints and\n    _intersect_1d internal funcs to rechunk.' #NEWLINE# new = cumdims_label ( ( ( 1 , 1 , 2 ) , ( 1 , 5 , 1 ) ) , 'n' ) #NEWLINE# old = cumdims_label ( ( ( 4 , ) , ( ( 1 , ) * 5 ) ) , 'o' ) #NEWLINE# breaks = tuple ( ( _breakpoints ( o , n ) for ( o , n ) in zip ( old , new ) ) ) #NEWLINE# answer = ( ( 'o' , 0 ) , ( 'n' , 0 ) , ( 'n' , 1 ) , ( 'n' , 2 ) , ( 'o' , 4 ) , ( 'n' , 4 ) ) #NEWLINE# assert ( breaks [ 0 ] == n ) #NEWLINE# answer2 = ( ( 'o' , 0 ) , ( 'n' , 0 ) , ( 'o' , 1 ) , ( 'n' , 1 ) , ( 'o' , 2 ) , ( 'o' , 3 ) , ( 'o' , 4 ) , ( 'o' , 5 ) , ( 'n' , 6 ) , ( 'n' , 7 ) ) #NEWLINE# assert ( breaks [ 1 ] == answer2 ) #NEWLINE# i1d = [ _intersect_1d ( b ) for b in breaks ] #NEWLINE# answer3 = ( ( ( 0 , slice ( 0 , 1 , None ) ) , ) , ( ( 0 , slice ( 1 , 2 , None ) ) , ) , ( ( 0 , slice ( 2 , 4 , None ) ) , ) ) #NEWLINE# assert ( i1d [ 0 ] == answer3 ) #NEWLINE# answer4 = ( ( ( 0 , slice ( 0 , 1 , None ) ) , ) , ( ( 1 , slice ( 0 , 1 , None ) ) , ( 2 , slice ( 0 , 1 , None ) ) , ( 3 , slice ( 0 , 1 , None ) ) , ( 4 , slice ( 0 , 1 , None ) ) , ( 5 , slice ( 0 , 1 , None ) ) ) , ( ( 5 , slice ( 1 , 2 , None ) ) , ) ) #NEWLINE# assert ( i1d [ 1 ] == answer4 )