def METHOD_NAME(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)
    with patch("os.link", side_effect=OSError(0, "linking unsupported")):
        copy_file(self.source, self.target, link='hard')
    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')