def test_record_good():
 output = StringIO()
 recorder = Record(file_object=output, replay=False)
 num_lines = 10
 for i in xrange(num_lines):
  recorder.handle_line((str(i) + '\n'))
 output_value = output.getvalue()
 assert (output_value == ''.join(((str(i) + '\n') for i in xrange(num_lines))))
 output = StringIO(output_value)
 playback_checker = Record(file_object=output, replay=True)
 for i in xrange(num_lines):
  playback_checker.handle_line((str(i) + '\n'))

def test_record_good ( ) : output = StringIO ( ) recorder = Record ( file_object = output , replay = False ) num_lines = 10 for i in xrange ( num_lines ) : recorder . handle_line ( ( str ( i ) + '\n' ) ) output_value = output . getvalue ( ) assert ( output_value == '' . join ( ( ( str ( i ) + '\n' ) for i in xrange ( num_lines ) ) ) ) output = StringIO ( output_value ) playback_checker = Record ( file_object = output , replay = True ) for i in xrange ( num_lines ) : playback_checker . handle_line ( ( str ( i ) + '\n' ) )
tests that when we record a sequence of events .