Пример #1
0
 def test_eof(self):
     # Populate stdin with an empty string. This will cause an
     # EOF. In the interest of simplicity, just return this as an
     # empty string. These are the same:
     #
     #     sys.stdin = StringIO()
     #     sys.stdin = StringIO('')
     #
     populate_stdin('')
     self.assertEqual(read_line('my prompt'), '')
     self.assert_stdout_equal('my prompt')
Пример #2
0
 def test_empty_line(self):
     populate_stdin('\n')
     self.assertEqual(read_line('fake prompt'), '')
     self.assert_stdout_equal('fake prompt')
Пример #3
0
 def test_normal_usage(self):
     populate_stdin('awesome\n')
     self.assertEqual(read_line('fake prompt'), 'awesome')
     self.assert_stdout_equal('fake prompt')