#NEWLINE# def test_homogenize( self ) : #NEWLINE# #INDENT# def _check_matches( indices , expected ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( i , idx ) in enumerate ( indices ) : #NEWLINE# #INDENT# data [ i ] = SparseSeries ( idx . to_int_index ( ) . indices , sparse_index = idx ) #NEWLINE# #UNINDENT# homogenized = spf . homogenize ( data ) #NEWLINE# for ( k , v ) in compat . iteritems ( homogenized ) : #NEWLINE# #INDENT# assert v . sp_index . equals ( expected ) #NEWLINE# #UNINDENT# #UNINDENT# indices1 = [ BlockIndex ( 10 , [ 2 ] , [ 7 ] ) , BlockIndex ( 10 , [ 1 , 6 ] , [ 3 , 4 ] ) , BlockIndex ( 10 , [ 0 ] , [ 10 ] ) ] #NEWLINE# expected1 = BlockIndex ( 10 , [ 2 , 6 ] , [ 2 , 3 ] ) #NEWLINE# _check_matches ( indices1 , expected1 ) #NEWLINE# indices2 = [ BlockIndex ( 10 , [ 2 ] , [ 7 ] ) , BlockIndex ( 10 , [ 2 ] , [ 7 ] ) ] #NEWLINE# expected2 = indices2 [ 0 ] #NEWLINE# _check_matches ( indices2 , expected2 ) #NEWLINE# data = { #NEWLINE# #INDENT# 'a' : SparseSeries ( np . arange ( 7 ) , sparse_index = expected2 , fill_value = 0 ) , #NEWLINE# #UNINDENT# } #NEWLINE# with tm . assertRaisesRegexp ( TypeError , 'NaN fill value' ) : #NEWLINE# #INDENT# spf . homogenize ( data )