diff --git a/django/core/files/base.py b/django/core/files/base.py
index b132529..641ff92 100644
a
|
b
|
class File(FileProxyMixin):
|
104 | 104 | |
105 | 105 | # If this is the end of a line, yield |
106 | 106 | # otherwise, wait for the next round |
107 | | if line[-1] in ('\n', '\r'): |
| 107 | if line[-1:] in (b'\n', b'\r'): |
108 | 108 | yield line |
109 | 109 | else: |
110 | 110 | buffer_ = line |
diff --git a/tests/files/tests.py b/tests/files/tests.py
index f562b57..58a11ec 100644
a
|
b
|
class FileTests(unittest.TestCase):
|
64 | 64 | self.assertFalse(hasattr(file, 'mode')) |
65 | 65 | gzip.GzipFile(fileobj=file) |
66 | 66 | |
| 67 | def test_file_iteration(self): |
| 68 | file = File(BytesIO(b'1\n2\n3')) |
| 69 | self.assertEqual(list(file), [b'1\n', b'2\n', b'3']) |
| 70 | |
67 | 71 | |
68 | 72 | class NoNameFileTestCase(unittest.TestCase): |
69 | 73 | """ |