def test_imap_many_folders_one_role(monkeypatch, constants):
 folders = constants['imap_folders']
 duplicates = [(('\\HasNoChildren', '\\Trash'), '/', u'[Gmail]/Trash'), ('\\HasNoChildren', '/', u'[Gmail]/Sent')]
 folders += duplicates
 client = patch_generic_client(monkeypatch, folders)
 raw_folders = client.folders()
 folder_names = client.folder_names()
 for role in ['inbox', 'trash', 'drafts', 'sent', 'spam']:
  assert (role in folder_names)
  number_roles = (2 if (role in ['sent', 'trash']) else 1)
  test_set = filter((lambda x: (x == role)), map((lambda y: y.role), raw_folders))
  assert (len(test_set) == number_roles), 'assigned wrong number of {}'.format(role)

def test_imap_many_folders_one_role ( monkeypatch , constants ) : folders = constants [ 'imap_folders' ] duplicates = [ ( ( '\\HasNoChildren' , '\\Trash' ) , '/' , u'[Gmail]/Trash' ) , ( '\\HasNoChildren' , '/' , u'[Gmail]/Sent' ) ] folders += duplicates client = patch_generic_client ( monkeypatch , folders ) raw_folders = client . folders ( ) folder_names = client . folder_names ( ) for role in [ 'inbox' , 'trash' , 'drafts' , 'sent' , 'spam' ] : assert ( role in folder_names ) number_roles = ( 2 if ( role in [ 'sent' , 'trash' ] ) else 1 ) test_set = filter ( ( lambda x : ( x == role ) ) , map ( ( lambda y : y . role ) , raw_folders ) ) assert ( len ( test_set ) == number_roles ) , 'assigned wrong number of {}' . format ( role )
tests that accounts with many folders with similar system folders have only one role .