#NEWLINE# def test_camera_stream_copy_seconds( ) : #NEWLINE# #INDENT# camera = mock . Mock ( ) #NEWLINE# encoder = mock . Mock ( ) #NEWLINE# camera . _encoders = { #NEWLINE# #INDENT# 1 : encoder , #NEWLINE# #UNINDENT# } #NEWLINE# stream = PiCameraCircularIO ( camera , size = 10 ) #NEWLINE# for ( data , frame ) in generate_frames ( 'hkffkff' ) : #NEWLINE# #INDENT# encoder . frame = frame #NEWLINE# stream . write ( data ) #NEWLINE# #UNINDENT# output = io . BytesIO ( ) #NEWLINE# stream . copy_to ( output , seconds = 1 ) #NEWLINE# assert ( output . getvalue ( ) == b'' ) #NEWLINE# stream . copy_to ( output , seconds = 10 ) #NEWLINE# assert ( output . getvalue ( ) == b'hkkffkkff' )