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

Method test_file_size

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

Source from the content-addressed store, hash-verified

1469
1470 # The test_*_size tests test for bug #1167128.
1471 def test_file_size(self):
1472 tar = tarfile.open(tmpname, self.mode)
1473 try:
1474 path = os.path.join(TEMPDIR, "file")
1475 with open(path, "wb"):
1476 pass
1477 tarinfo = tar.gettarinfo(path)
1478 self.assertEqual(tarinfo.size, 0)
1479
1480 with open(path, "wb") as fobj:
1481 fobj.write(b"aaa")
1482 tarinfo = tar.gettarinfo(path)
1483 self.assertEqual(tarinfo.size, 3)
1484 finally:
1485 tar.close()
1486
1487 def test_directory_size(self):
1488 path = os.path.join(TEMPDIR, "directory")

Callers

nothing calls this directly

Calls 7

gettarinfoMethod · 0.80
openFunction · 0.50
openMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected