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