#NEWLINE# def test_from_product( self ) : #NEWLINE# #INDENT# first = [ 'foo' , 'bar' , 'buz' ] #NEWLINE# second = [ 'a' , 'b' , 'c' ] #NEWLINE# names = [ 'first' , 'second' ] #NEWLINE# result = MultiIndex . from_product ( [ first , second ] , names = names ) #NEWLINE# tuples = [ ( 'foo' , 'a' ) , ( 'foo' , 'b' ) , ( 'foo' , 'c' ) , ( 'bar' , 'a' ) , ( 'bar' , 'b' ) , ( 'bar' , 'c' ) , ( 'buz' , 'a' ) , ( 'buz' , 'b' ) , ( 'buz' , 'c' ) ] #NEWLINE# expected = MultiIndex . from_tuples ( tuples , names = names ) #NEWLINE# tm . assert_numpy_array_equal ( result , expected ) #NEWLINE# self . assertEqual ( result . names , names )