def METHOD_NAME(self):
    """Test as_handle with a custom path-like object."""
    class CustomPathLike:
        def __init__(self, path):
            self.path = path
        def __fspath__(self):
            return self.path
    p = CustomPathLike(self._path("test_file.fasta"))
    mode = "wb"
    with File.as_handle(p, mode=mode) as handle:
        self.assertEqual(p.path, handle.name)
        self.assertEqual(mode, handle.mode)
        self.assertFalse(handle.closed)
    self.assertTrue(handle.closed)