def test_record_bad():
 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()
 output = StringIO(output_value)
 playback_checker = Record(file_object=output, replay=True)
 for i in xrange((num_lines // 2)):
  playback_checker.handle_line((str(i) + '\n'))
 try:
  playback_checker.handle_line('0\n')
 except MismatchError:
  return
 raise AssertionError('Failed to detect mismatch between recorded sequence  and repetition of it.')

def test_record_bad ( ) : 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 ( ) output = StringIO ( output_value ) playback_checker = Record ( file_object = output , replay = True ) for i in xrange ( ( num_lines // 2 ) ) : playback_checker . handle_line ( ( str ( i ) + '\n' ) ) try : playback_checker . handle_line ( '0\n' ) except MismatchError : return raise AssertionError ( 'Failed to detect mismatch between recorded sequence  and repetition of it.' )
tests that when we record a sequence of events .