@@ -906,37 +906,43 @@ def test_index_with_nan(self):
906906 y = df .set_index (['id1' , 'id2' , 'id3' ])
907907 result = y .to_string ()
908908 expected = u (' value\n id1 id2 id3 \n 1a3 NaN 78d 123\n 9h4 d67 79d 64' )
909- self .assert_ (result == expected )
909+ self .assertEqual (result , expected )
910910
911911 # index
912912 y = df .set_index ('id2' )
913913 result = y .to_string ()
914914 expected = u (' id1 id3 value\n id2 \n NaN 1a3 78d 123\n d67 9h4 79d 64' )
915- self .assert_ (result == expected )
915+ self .assertEqual (result , expected )
916+
917+ # with append (this failed in 0.12)
918+ y = df .set_index (['id1' , 'id2' ]).set_index ('id3' , append = True )
919+ result = y .to_string ()
920+ expected = u (' value\n id1 id2 id3 \n 1a3 NaN 78d 123\n 9h4 d67 79d 64' )
921+ self .assertEqual (result , expected )
916922
917923 # all-nan in mi
918924 df2 = df .copy ()
919925 df2 .ix [:,'id2' ] = np .nan
920926 y = df2 .set_index ('id2' )
921927 result = y .to_string ()
922928 expected = u (' id1 id3 value\n id2 \n NaN 1a3 78d 123\n NaN 9h4 79d 64' )
923- self .assert_ (result == expected )
929+ self .assertEqual (result , expected )
924930
925931 # partial nan in mi
926932 df2 = df .copy ()
927933 df2 .ix [:,'id2' ] = np .nan
928934 y = df2 .set_index (['id2' ,'id3' ])
929935 result = y .to_string ()
930936 expected = u (' id1 value\n id2 id3 \n NaN 78d 1a3 123\n 79d 9h4 64' )
931- self .assert_ (result == expected )
937+ self .assertEqual (result , expected )
932938
933939 df = DataFrame ({'id1' : {0 : np .nan , 1 : '9h4' }, 'id2' : {0 : np .nan , 1 : 'd67' },
934940 'id3' : {0 : np .nan , 1 : '79d' }, 'value' : {0 : 123 , 1 : 64 }})
935941
936942 y = df .set_index (['id1' ,'id2' ,'id3' ])
937943 result = y .to_string ()
938944 expected = u (' value\n id1 id2 id3 \n NaN NaN NaN 123\n 9h4 d67 79d 64' )
939- self .assert_ (result == expected )
945+ self .assertEqual (result , expected )
940946
941947 def test_to_string (self ):
942948 from pandas import read_table
0 commit comments