@then('the new contact list is equal to the old contact list without the deleted contact')
def verify_contact_deleted(db, non_empty_contact_list, random_contact, app, check_ui):
    old_contacts = non_empty_contact_list
    index = old_contacts.index(random_contact)
    new_contacts = db.get_contact_list()
    old_contacts[index] = random_contact
    if check_ui:
        assert (sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max))
@then('the new contact list is equal to the old contact list without the deleted contact')
def verify_contact_deleted(db, non_empty_contact_list, random_contact, app, check_ui):
    old_contacts = non_empty_contact_list
    index = old_contacts.index(random_contact)
    new_contacts = db.get_contact_list()
    old_contacts[index] = random_contact
    if check_ui:
        assert (sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max))