| 330 | | # |
|---|
| 331 | | # def ascii_readlines(self): |
|---|
| 332 | | # """Use readline operations to get data.""" |
|---|
| 333 | | # host = self.host |
|---|
| 334 | | # # write some data |
|---|
| 335 | | # local_data = 'line 1\nanother line\nyet another line' |
|---|
| 336 | | # self.write_test_data(local_data, 'w') |
|---|
| 337 | | # input_ = host.file(self.remote_name, 'r') |
|---|
| 338 | | # data = input_.read(3) |
|---|
| 339 | | # self.assertEqual(data, 'lin') |
|---|
| 340 | | # data = input_.readlines() |
|---|
| 341 | | # self.assertEqual(data, ['e 1\n', 'another line\n', |
|---|
| 342 | | # 'yet another line']) |
|---|
| 343 | | # input_.close() |
|---|
| | 330 | |
|---|
| | 331 | def test_ascii_readlines(self): |
|---|
| | 332 | """Use ASCII readline operations to get data.""" |
|---|
| | 333 | host = ftp_host_factory(session_factory=ReadMockSession) |
|---|
| | 334 | input_ = host.file('dummy', 'r') |
|---|
| | 335 | data = input_.read(3) |
|---|
| | 336 | self.assertEqual(data, 'lin') |
|---|
| | 337 | data = input_.readlines() |
|---|
| | 338 | self.assertEqual(data, ['e 1\n', 'another line\n', |
|---|
| | 339 | 'yet another line']) |
|---|
| | 340 | input_.close() |
|---|