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

Method test_copy2

Lib/test/test_shutil.py:1388–1402  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1386
1387 @unittest.skipUnless(hasattr(os, 'utime'), 'requires os.utime')
1388 def test_copy2(self):
1389 # Ensure that the copied file exists and has the same mode and
1390 # modification time bits.
1391 file1, file2 = self._copy_file(shutil.copy2)
1392 self.assertTrue(os.path.exists(file2))
1393 file1_stat = os.stat(file1)
1394 file2_stat = os.stat(file2)
1395 self.assertEqual(file1_stat.st_mode, file2_stat.st_mode)
1396 for attr in 'st_atime', 'st_mtime':
1397 # The modification times may be truncated in the new file.
1398 self.assertLessEqual(getattr(file1_stat, attr),
1399 getattr(file2_stat, attr) + 1)
1400 if hasattr(os, 'chflags') and hasattr(file1_stat, 'st_flags'):
1401 self.assertEqual(getattr(file1_stat, 'st_flags'),
1402 getattr(file2_stat, 'st_flags'))
1403
1404 @os_helper.skip_unless_symlink
1405 def test_copy2_symlinks(self):

Callers

nothing calls this directly

Calls 6

_copy_fileMethod · 0.95
assertTrueMethod · 0.80
assertLessEqualMethod · 0.80
existsMethod · 0.45
statMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected