#NEWLINE# def test09b( self ) : #NEWLINE# #INDENT# 'Modifying selected values on a large table (alternate values)' #NEWLINE# table = self . table #NEWLINE# formats = table . description . _v_nested_formats #NEWLINE# nrows = 100 #NEWLINE# row = table . row #NEWLINE# for i in range ( nrows ) : #NEWLINE# #INDENT# row [ 'col1' ] = ( i - 1 ) #NEWLINE# row [ 'col2' ] = ( 'a' + str ( ( i - 1 ) ) ) #NEWLINE# row [ 'col3' ] = ( - 1.0 ) #NEWLINE# row . append ( ) #NEWLINE# #UNINDENT# table . flush ( ) #NEWLINE# for row in table . iterrows ( step = 10 ) : #NEWLINE# #INDENT# row [ 'col1' ] = row . nrow #NEWLINE# row [ 'col2' ] = ( 'b' + str ( row . nrow ) ) #NEWLINE# row [ 'col3' ] = 0.0 #NEWLINE# row . update ( ) #NEWLINE# #UNINDENT# r1 = records . array ( None , shape = nrows , formats = formats , names = 'col1,col2,col3' ) #NEWLINE# for i in range ( nrows ) : #NEWLINE# #INDENT# if ( ( i % 10 ) > 0 ) : #NEWLINE# #INDENT# r1 [ 'col1' ] [ i ] = ( i - 1 ) #NEWLINE# r1 [ 'col2' ] [ i ] = ( 'a' + str ( ( i - 1 ) ) ) #NEWLINE# r1 [ 'col3' ] [ i ] = ( - 1.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# r1 [ 'col1' ] [ i ] = i #NEWLINE# r1 [ 'col2' ] [ i ] = ( 'b' + str ( i ) ) #NEWLINE# r1 [ 'col3' ] [ nrows ] = 0.0 #NEWLINE# #UNINDENT# #UNINDENT# if self . reopen : #NEWLINE# #INDENT# self . _reopen ( ) #NEWLINE# table = self . h5file . root . recarray #NEWLINE# table . nrowsinbuf = self . buffersize #NEWLINE# #UNINDENT# r2 = table . read ( ) #NEWLINE# if common . verbose : #NEWLINE# #INDENT# print ( 'Original table-->' , repr ( r2 ) ) #NEWLINE# print ( 'Should look like-->' , repr ( r1 ) ) #NEWLINE# #UNINDENT# self . assertEqual ( r1 . tostring ( ) , r2 . tostring ( ) ) #NEWLINE# self . assertEqual ( table . nrows , nrows )