MCPcopy Index your code
hub / github.com/python/cpython / test_100_char_name

Method test_100_char_name

Lib/test/test_tarfile.py:1437–1455  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1435 prefix = "w:"
1436
1437 def test_100_char_name(self):
1438 # The name field in a tar header stores strings of at most 100 chars.
1439 # If a string is shorter than 100 chars it has to be padded with '\0',
1440 # which implies that a string of exactly 100 chars is stored without
1441 # a trailing '\0'.
1442 name = "0123456789" * 10
1443 tar = tarfile.open(tmpname, self.mode)
1444 try:
1445 t = tarfile.TarInfo(name)
1446 tar.addfile(t)
1447 finally:
1448 tar.close()
1449
1450 tar = tarfile.open(tmpname)
1451 try:
1452 self.assertEqual(tar.getnames()[0], name,
1453 "failed to store 100 char filename")
1454 finally:
1455 tar.close()
1456
1457 def test_tar_size(self):
1458 # Test for bug #1013882.

Callers

nothing calls this directly

Calls 5

addfileMethod · 0.80
getnamesMethod · 0.80
openMethod · 0.45
closeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected