#NEWLINE# def test_repr_roundtrip( self ) : #NEWLINE# #INDENT# mi = MultiIndex . from_product ( [ list ( 'ab' ) , range ( 3 ) ] , names = [ 'first' , 'second' ] ) #NEWLINE# str ( mi ) #NEWLINE# if PY3 : #NEWLINE# #INDENT# tm . assert_index_equal ( eval ( repr ( mi ) ) , mi , exact = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = eval ( repr ( mi ) ) #NEWLINE# tm . assert_index_equal ( result , mi , exact = False ) #NEWLINE# self . assertEqual ( mi . get_level_values ( 'first' ) . inferred_type , 'string' ) #NEWLINE# self . assertEqual ( result . get_level_values ( 'first' ) . inferred_type , 'unicode' ) #NEWLINE# #UNINDENT# mi_u = MultiIndex . from_product ( [ list ( 'ab' ) , range ( 3 ) ] , names = [ 'first' , 'second' ] ) #NEWLINE# result = eval ( repr ( mi_u ) ) #NEWLINE# tm . assert_index_equal ( result , mi_u , exact = True ) #NEWLINE# if PY3 : #NEWLINE# #INDENT# str ( mi ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# compat . text_type ( mi ) #NEWLINE# #UNINDENT# mi = MultiIndex . from_product ( [ list ( 'abcdefg' ) , range ( 10 ) ] , names = [ 'first' , 'second' ] ) #NEWLINE# result = str ( mi ) #NEWLINE# if PY3 : #NEWLINE# #INDENT# tm . assert_index_equal ( eval ( repr ( mi ) ) , mi , exact = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = eval ( repr ( mi ) ) #NEWLINE# tm . assert_index_equal ( result , mi , exact = False ) #NEWLINE# self . assertEqual ( mi . get_level_values ( 'first' ) . inferred_type , 'string' ) #NEWLINE# self . assertEqual ( result . get_level_values ( 'first' ) . inferred_type , 'unicode' ) #NEWLINE# #UNINDENT# mi = MultiIndex . from_product ( [ list ( 'abcdefg' ) , range ( 10 ) ] , names = [ 'first' , 'second' ] ) #NEWLINE# result = eval ( repr ( mi_u ) ) #NEWLINE# tm . assert_index_equal ( result , mi_u , exact = True )