#NEWLINE# @ requires_dask #NEWLINE# def test_auto_combine( self ) : #NEWLINE# #INDENT# objs = [ Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 ] , #NEWLINE# #UNINDENT# } ) , Dataset ( { #NEWLINE# #INDENT# 'x' : [ 1 ] , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# actual = auto_combine ( objs ) #NEWLINE# expected = Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 , 1 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertDatasetIdentical ( expected , actual ) #NEWLINE# actual = auto_combine ( [ actual ] ) #NEWLINE# self . assertDatasetIdentical ( expected , actual ) #NEWLINE# objs = [ Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 , 1 ] , #NEWLINE# #UNINDENT# } ) , Dataset ( { #NEWLINE# #INDENT# 'x' : [ 2 ] , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# actual = auto_combine ( objs ) #NEWLINE# expected = Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 , 1 , 2 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertDatasetIdentical ( expected , actual ) #NEWLINE# objs = [ Dataset ( OrderedDict ( [ ( 'x' , ( 'a' , [ 0 ] ) ) , ( 'y' , ( 'a' , [ 0 ] ) ) ] ) ) , Dataset ( OrderedDict ( [ ( 'y' , ( 'a' , [ 1 ] ) ) , ( 'x' , ( 'a' , [ 1 ] ) ) ] ) ) ] #NEWLINE# actual = auto_combine ( objs ) #NEWLINE# expected = Dataset ( { #NEWLINE# #INDENT# 'x' : ( 'a' , [ 0 , 1 ] ) , #NEWLINE# 'y' : ( 'a' , [ 0 , 1 ] ) , #NEWLINE# 'a' : [ 0 , 0 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertDatasetIdentical ( expected , actual ) #NEWLINE# objs = [ Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 ] , #NEWLINE# 'y' : [ 0 ] , #NEWLINE# #UNINDENT# } ) , Dataset ( { #NEWLINE# #INDENT# 'y' : [ 1 ] , #NEWLINE# 'x' : [ 1 ] , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# with self . assertRaisesRegexp ( ValueError , 'too many .* dimensions' ) : #NEWLINE# #INDENT# auto_combine ( objs ) #NEWLINE# #UNINDENT# objs = [ Dataset ( { #NEWLINE# #INDENT# 'x' : 0 , #NEWLINE# #UNINDENT# } ) , Dataset ( { #NEWLINE# #INDENT# 'x' : 1 , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# with self . assertRaisesRegexp ( ValueError , 'cannot infer dimension' ) : #NEWLINE# #INDENT# auto_combine ( objs ) #NEWLINE# #UNINDENT# objs = [ Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 ] , #NEWLINE# 'y' : [ 0 ] , #NEWLINE# #UNINDENT# } ) , Dataset ( { #NEWLINE# #INDENT# 'x' : [ 0 ] , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# with self . assertRaises ( KeyError ) : #NEWLINE# #INDENT# auto_combine ( actual )