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

Method test_pathlike_name

Lib/test/test_tarfile.py:595–608  ·  view source on GitHub ↗
(self, tarname=None)

Source from the content-addressed store, hash-verified

593 self.assertEqual(tar.name, os.path.abspath(fobj.name))
594
595 def test_pathlike_name(self, tarname=None):
596 if tarname is None:
597 tarname = self.tarname
598 expected = os.path.abspath(tarname)
599 tarname = os_helper.FakePath(tarname)
600 with tarfile.open(tarname, mode=self.mode) as tar:
601 self.assertEqual(tar.name, expected)
602 with self.taropen(tarname) as tar:
603 self.assertEqual(tar.name, expected)
604 with tarfile.TarFile.open(tarname, mode=self.mode) as tar:
605 self.assertEqual(tar.name, expected)
606 if self.suffix == '':
607 with tarfile.TarFile(tarname, mode='r') as tar:
608 self.assertEqual(tar.name, expected)
609
610 def test_pathlike_bytes_name(self):
611 self.test_pathlike_name(os.fsencode(self.tarname))

Callers 1

Calls 4

taropenMethod · 0.80
abspathMethod · 0.45
openMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected