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

Method test_samefile

Lib/test/test_pathlib/test_pathlib.py:2813–2832  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2811 self.assertFalse((R / '\udfff').is_mount())
2812
2813 def test_samefile(self):
2814 parser = self.parser
2815 fileA_path = parser.join(self.base, 'fileA')
2816 fileB_path = parser.join(self.base, 'dirB', 'fileB')
2817 p = self.cls(fileA_path)
2818 pp = self.cls(fileA_path)
2819 q = self.cls(fileB_path)
2820 self.assertTrue(p.samefile(fileA_path))
2821 self.assertTrue(p.samefile(pp))
2822 self.assertFalse(p.samefile(fileB_path))
2823 self.assertFalse(p.samefile(q))
2824 # Test the non-existent file case
2825 non_existent = parser.join(self.base, 'foo')
2826 r = self.cls(non_existent)
2827 self.assertRaises(FileNotFoundError, p.samefile, r)
2828 self.assertRaises(FileNotFoundError, p.samefile, non_existent)
2829 self.assertRaises(FileNotFoundError, r.samefile, p)
2830 self.assertRaises(FileNotFoundError, r.samefile, non_existent)
2831 self.assertRaises(FileNotFoundError, r.samefile, r)
2832 self.assertRaises(FileNotFoundError, r.samefile, non_existent)
2833
2834 def test_passing_kwargs_errors(self):
2835 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 6

assertTrueMethod · 0.80
samefileMethod · 0.80
assertFalseMethod · 0.80
joinMethod · 0.45
clsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected