Esempio n. 1
0
 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)
Esempio n. 2
0
    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
Esempio n. 3
0
 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)
Esempio n. 4
0
 def testDeleteContact(self):
     a = Contact("vasya", "petrov", "222")
     b = ContactBook()
     b.addContact(a)
     b.deleteContactByName("vasya")
     self.assertNotIn(a, b.listBook)
Esempio n. 5
0
 def testAddContact(self):
     a = Contact("vasya", "petrov", "222")
     b = ContactBook()
     b.addContact(a)
     self.assertIn(a, b.listBook)
Esempio n. 6
0
 def testContact(self):
     a = Contact("vasya", "petrov", "222")
     b = Contact("vasya", "petrov", "222")
     self.assertEqual(a, b)