예제 #1
0
    def test_lookup(self):
        pb = "phonebook.pb"
        name = "Sarah"
        self.assertEqual(phonebook.lookup(name, pb), "Sarah could not be found.")

        name2 = "John"

        self.test_add()
        self.assertEqual(phonebook.lookup(name2, pb), "John Michael 123 456 4323\nJohn Doe 398 291 9281\n")
예제 #2
0
 def testChange(self):
     phonebook.createTable('unittest', self.c)
     phonebook.add('Lita Cho', '510 938 3333', 'unittest', self.c)
     phonebook.change('Lita Cho', '333 333 3333', 'unittest', self.c)
     rows = phonebook.lookup('Lita Cho', 'unittest', self.c)
     self.assertTrue(rows.next()[1] == '333 333 3333')
예제 #3
0
 def test_change(self):
     phonebook.change(pb_path, "John Smith", "212")
     phonebook.lookup(pb_path, "John Smith")
     self.verify('John Smith 212')
예제 #4
0
 def test_cant_find(self):
     phonebook.lookup(pb_path, "Batman")
     self.verify("")
예제 #5
0
 def test_lookup_partial(self):
     phonebook.lookup(pb_path, "Doge")
     self.verify('Wow Doge 212 234 2693')
예제 #6
0
 def test_lookup_lower(self):
     phonebook.lookup(pb_path, "j")
     self.verify('James John 212 234 2693\nJohn Carter 212 234 2693\nSmith John 212 234 2693')
예제 #7
0
 def test_lookup(self):
     phonebook.lookup(pb_path, "John Carter")
     self.verify('John Carter 212 234 2693')
예제 #8
0
파일: tests.py 프로젝트: joejean/phonebook
 def test_failed_lookup(self):
     self.assertEqual(phonebook.lookup("Joe Jan", "testing.db"),
                      "Joe Jan does not exist in the db")
예제 #9
0
파일: tests.py 프로젝트: joejean/phonebook
 def test_successful_lookup(self):
     self.assertEqual(phonebook.lookup("Joe Jean", "testing.db"),
                      "Joe Jean 123 345 2332")