code: def test_copy_file_hard_link_failure(self):
      # If hard linking fails, copy_file() falls back on copying file
      # (some special filesystems don't support hard linking even under
      #  Unix, see issue #8876).
      with open(self.source, "w") as f:
          f.write("some content")
      st = os.stat(self.source)
  
      def _os_link(*args):
          raise OSError(0, "linking unsupported")
  
      old_link = os.link
      os.link = _os_link
      try:
          copy_file(self.source, self.target, link="hard")
      finally:
          os.link = old_link
      st2 = os.stat(self.source)
      st3 = os.stat(self.target)
      self.assertTrue(os.path.samestat(st, st2), (st, st2))
      self.assertFalse(os.path.samestat(st2, st3), (st2, st3))
      for fn in (self.source, self.target):
          with open(fn, "r") as f:
              self.assertEqual(f.read(), "some content")
  
file_path: catboost/contrib/tools/python/src/Lib/distutils/tests/test_file_util.py
imports: import unittest
  import os
  import shutil
  from distutils.file_util import move_file, write_file, copy_file
  from distutils import log
  from distutils.tests import support
  from test.test_support import run_unittest
label_desc: Use image node_id 8 for calling the FileUtilTestCase obj's underlying member method code with example usage: obj.test_copy_file_hard_link_failure() without return types