def test_gmail_many_folders_one_role(monkeypatch, constants):
 folders = constants['gmail_folders']
 duplicates = [('\\HasNoChildren', '/', u'[Imap]/Trash'), ('\\HasNoChildren', '/', u'[Imap]/Sent')]
 folders += duplicates
 client = patch_gmail_client(monkeypatch, folders)
 raw_folders = client.folders()
 folder_names = client.folder_names()
 for role in ['inbox', 'all', 'trash', 'drafts', 'important', 'sent', 'spam', 'starred']:
  assert (role in folder_names)
  test_set = filter((lambda x: (x == role)), map((lambda y: y.role), raw_folders))
  assert (len(test_set) == 1), 'assigned wrong number of {}'.format(role)
  names = folder_names[role]
  assert isinstance(names, list)
  assert (len(names) == 1), ('assign same role to %s folders' % len(names))

def test_gmail_many_folders_one_role ( monkeypatch , constants ) : folders = constants [ 'gmail_folders' ] duplicates = [ ( '\\HasNoChildren' , '/' , u'[Imap]/Trash' ) , ( '\\HasNoChildren' , '/' , u'[Imap]/Sent' ) ] folders += duplicates client = patch_gmail_client ( monkeypatch , folders ) raw_folders = client . folders ( ) folder_names = client . folder_names ( ) for role in [ 'inbox' , 'all' , 'trash' , 'drafts' , 'important' , 'sent' , 'spam' , 'starred' ] : assert ( role in folder_names ) test_set = filter ( ( lambda x : ( x == role ) ) , map ( ( lambda y : y . role ) , raw_folders ) ) assert ( len ( test_set ) == 1 ) , 'assigned wrong number of {}' . format ( role ) names = folder_names [ role ] assert isinstance ( names , list ) assert ( len ( names ) == 1 ) , ( 'assign same role to %s folders' % len ( names ) )
tests that accounts with many folders with similar system folders have only one role .