summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 0868d5d..2139320 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -734,6 +734,18 @@ class MiscReadTestBase(CommonReadTest):
with self.assertRaises(tarfile.ReadError):
tarfile.open(self.tarname)
+ def test_next_on_empty_tarfile(self):
+ fd = io.BytesIO()
+ tf = tarfile.open(fileobj=fd, mode="w")
+ tf.close()
+
+ fd.seek(0)
+ with tarfile.open(fileobj=fd, mode="r|") as tf:
+ self.assertEqual(tf.next(), None)
+
+ fd.seek(0)
+ with tarfile.open(fileobj=fd, mode="r") as tf:
+ self.assertEqual(tf.next(), None)
class MiscReadTest(MiscReadTestBase, unittest.TestCase):
test_fail_comp = None