summaryrefslogtreecommitdiff
path: root/tests/files/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/files/tests.py')
-rw-r--r--tests/files/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index f562b5748d..b9f8b5228a 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -64,6 +64,14 @@ class FileTests(unittest.TestCase):
self.assertFalse(hasattr(file, 'mode'))
gzip.GzipFile(fileobj=file)
+ def test_file_iteration(self):
+ """
+ File objects should yield lines when iterated over.
+ Refs #22107.
+ """
+ file = File(BytesIO(b'one\ntwo\nthree'))
+ self.assertEqual(list(file), [b'one\n', b'two\n', b'three'])
+
class NoNameFileTestCase(unittest.TestCase):
"""