#NEWLINE# def assert_mail_count( count , msg = None ) : #NEWLINE# #INDENT# 'Assert the number of emails sent.\n    The message here tends to be long, so allow for replacing the whole\n    thing instead of prefixing.\n    ' #NEWLINE# if ( e is None ) : #NEWLINE# #INDENT# msg = ', ' . join ( [ e . subject for e in mail . outbox ] ) #NEWLINE# msg = ( '%d != %d %s' % ( len ( mail . outbox ) , count , msg ) ) #NEWLINE# #UNINDENT# assert_equals ( len ( mail . outbox ) , count , msg )