MCPcopy Index your code
hub / github.com/RustPython/RustPython / _test

Method _test

Lib/test/test_tarfile.py:1916–1943  ·  view source on GitHub ↗
(self, name, link=None)

Source from the content-addressed store, hash-verified

1914 return count
1915
1916 def _test(self, name, link=None):
1917 tarinfo = tarfile.TarInfo(name)
1918 if link:
1919 tarinfo.linkname = link
1920 tarinfo.type = tarfile.LNKTYPE
1921
1922 tar = tarfile.open(tmpname, "w")
1923 try:
1924 tar.format = tarfile.GNU_FORMAT
1925 tar.addfile(tarinfo)
1926
1927 v1 = self._calc_size(name, link)
1928 v2 = tar.offset
1929 self.assertEqual(v1, v2, "GNU longname/longlink creation failed")
1930 finally:
1931 tar.close()
1932
1933 tar = tarfile.open(tmpname)
1934 try:
1935 member = tar.next()
1936 self.assertIsNotNone(member,
1937 "unable to read longname member")
1938 self.assertEqual(tarinfo.name, member.name,
1939 "unable to read longname member")
1940 self.assertEqual(tarinfo.linkname, member.linkname,
1941 "unable to read longname member")
1942 finally:
1943 tar.close()
1944
1945 def test_longname_1023(self):
1946 self._test(("longnam/" * 127) + "longnam")

Callers 9

test_longname_1023Method · 0.95
test_longname_1024Method · 0.95
test_longname_1025Method · 0.95
test_longlink_1023Method · 0.95
test_longlink_1024Method · 0.95
test_longlink_1025Method · 0.95

Calls 7

_calc_sizeMethod · 0.95
addfileMethod · 0.80
assertIsNotNoneMethod · 0.80
openMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected