summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2015-07-02 17:41:03 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2015-07-02 17:41:03 (GMT)
commit49c521fd5d3102916045551019368eae66dc7696 (patch)
treeb51dc93916098c3c58bf9c89807341c2f499bdc0 /Lib/test/test_tarfile.py
parent44f323cb42418e6e2b83b7655146de66a7289dd4 (diff)
parentb7a688b3a40705ab4f7f7035d40ec026899c7052 (diff)
downloadcpython-49c521fd5d3102916045551019368eae66dc7696.zip
cpython-49c521fd5d3102916045551019368eae66dc7696.tar.gz
cpython-49c521fd5d3102916045551019368eae66dc7696.tar.bz2
Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 66a0a61..0f03c73 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -1952,6 +1952,10 @@ class MiscTest(unittest.TestCase):
self.assertEqual(tarfile.nti(b"\xff\x00\x00\x00\x00\x00\x00\x00"),
-0x100000000000000)
+ # Issue 24514: Test if empty number fields are converted to zero.
+ self.assertEqual(tarfile.nti(b"\0"), 0)
+ self.assertEqual(tarfile.nti(b" \0"), 0)
+
def test_write_number_fields(self):
self.assertEqual(tarfile.itn(1), b"0000001\x00")
self.assertEqual(tarfile.itn(0o7777777), b"7777777\x00")