def testEditContact(self): a = Contact("vasya", "petrov", "222") b = ContactBook() b.addContact(a) b.editContact("vasya", "petya", "petrov", "222") a = b.getContactByName("petya") self.assertIsInstance(a, Contact)
def decode(obj): """ :param obj: :return: """ tmpBook = ContactBook() for dic in obj: tmpContact = Contact(dic["Name"], dic["Surname"], dic["Number"]) tmpBook.addContact(tmpContact) return tmpBook
def addInput(book): """ Input for add option :param book: :return: """ name = input("Enter the name:") surname = input("Enter the surname:") phone = input("Enter the phone number:") tmpContact = Contact(name, surname, phone) book.addContact(tmpContact)
def testDeleteContact(self): a = Contact("vasya", "petrov", "222") b = ContactBook() b.addContact(a) b.deleteContactByName("vasya") self.assertNotIn(a, b.listBook)
def testAddContact(self): a = Contact("vasya", "petrov", "222") b = ContactBook() b.addContact(a) self.assertIn(a, b.listBook)
def testContact(self): a = Contact("vasya", "petrov", "222") b = Contact("vasya", "petrov", "222") self.assertEqual(a, b)