(self)
| 234 | next(h) |
| 235 | |
| 236 | def test_next_data(self): |
| 237 | # Check that next will correctly return the next available |
| 238 | # line and plays well with the dunder_iter part. |
| 239 | mock = mock_open(read_data='foo\nbar\nbaz\n') |
| 240 | with patch('%s.open' % __name__, mock, create=True): |
| 241 | h = open('bar') |
| 242 | line1 = next(h) |
| 243 | line2 = next(h) |
| 244 | lines = [l for l in h] |
| 245 | self.assertEqual(line1, 'foo\n') |
| 246 | self.assertEqual(line2, 'bar\n') |
| 247 | self.assertEqual(lines[0], 'baz\n') |
| 248 | self.assertEqual(h.readline(), '') |
| 249 | |
| 250 | def test_readlines_data(self): |
| 251 | # Test that emulating a file that ends in a newline character works |
nothing calls this directly
no test coverage detected