#NEWLINE# def test_worker_sends_buffered_chunks_to_saver_when_speech_is_detected( self ) : #NEWLINE# #INDENT# self . vad . set_messages ( [ ( True , 'speech' , 'buffered chunk' , 'resampled buffered chunk' ) , ( False , 'non-speech' , '' , '' ) ] ) #NEWLINE# messages = [ { #NEWLINE# #INDENT# 'frontend' : self . make_frontend_request ( 'speech 1' , 'ONLINE' , id = 1 , has_next = True ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'frontend' : self . make_frontend_request ( 'speech 2' , 'ONLINE' , id = 1 , has_next = True ) , #NEWLINE# #UNINDENT# } ] #NEWLINE# self . run_worker ( self ) #NEWLINE# self . assertThatDataWasStored ( { #NEWLINE# #INDENT# 1 : { #NEWLINE# #INDENT# 'frame_rate' : 44100 , #NEWLINE# 'chunks' : [ { #NEWLINE# #INDENT# 'chunk_id' : 0 , #NEWLINE# 'pcm' : 'buffered chunk' , #NEWLINE# 'hypothesis' : [ ( 1.0 , 'Hello World!' ) ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } )