#NEWLINE# def test_file_random_seek( self ) : #NEWLINE# #INDENT# file_name = 'gs://gcsio-test/seek_file' #NEWLINE# file_size = ( ( ( 5 * 1024 ) * 1024 ) - 100 ) #NEWLINE# random_file = self . _insert_random_file ( self . client , file_name , file_size ) #NEWLINE# f = self . gcs . open ( file_name ) #NEWLINE# random . seed ( 0 ) #NEWLINE# for _ in range ( 0 , 10 ) : #NEWLINE# #INDENT# a = random . randint ( 0 , ( file_size - 1 ) ) #NEWLINE# b = random . randint ( 0 , ( file_size - 1 ) ) #NEWLINE# ( start , end ) = ( min ( a , b ) , max ( a , b ) ) #NEWLINE# f . seek ( start ) #NEWLINE# self . assertEqual ( f . tell ( ) , start ) #NEWLINE# self . assertEqual ( f . read ( ( ( end - start ) + 1 ) ) , random_file . contents [ start : ( end + 1 ) ] ) #NEWLINE# self . assertEqual ( f . tell ( ) , ( end + 1 ) )