예제 #1
0
 def test_list_records(self):
     """Check for right output when record created and listed"""
     capturedOutput = io.StringIO()
     sys.stdout = capturedOutput
     phonebook = Phonebook()
     phonebook.add_record("John Mayer", 12345)
     phonebook.list_records()
     sys.stdout = sys.__stdout__
     self.assertEqual(
         capturedOutput.getvalue(),
         "\nPhonebook has following entries:\n'John Mayer' => 12345\n")