text: # -*- coding: utf-8 -*-
  from model.contact import Contact
  import random
  
  
  def test_delete_some_contact(app, db, check_ui):
      old_contacts = db.get_contact_list()
      if len(old_contacts) == 0:
          app.contact.create(Contact(firstname="llll"))
      contact = random.choice(old_contacts)
      app.contact.delete_contact_by_id(contact.id)
      app.wd.find_element_by_css_selector("div.msgbox")
      new_contacts = db.get_contact_list()
      assert len(old_contacts) - 1 == len(new_contacts)
      old_contacts.remove(contact)
      assert old_contacts == new_contacts
      if check_ui:
          assert sorted(new_contacts, key=Contact.id_or_max) == sorted(app.contact.get_contact_list(), key=Contact.id_or_max)
  