code: def test_create_and_delete_directory(self):
      new_dir_name = "new_dir"
      self.hook.create_directory(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS, new_dir_name)
      )
      output = self.hook.describe_directory(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS)
      )
      assert new_dir_name in output
      # test the directory has default permissions to 777
      umask = 0o022
      output = self.hook.get_conn().lstat(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS, new_dir_name)
      )
      assert output.st_mode & 0o777 == 0o777 - umask
      # test directory already exists for code coverage, should not raise an exception
      self.hook.create_directory(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS, new_dir_name)
      )
      # test path already exists and is a file, should raise an exception
      with pytest.raises(
          AirflowException, match="already exists and is a file"
      ):
          self.hook.create_directory(
              os.path.join(
                  self.temp_dir,
                  TMP_DIR_FOR_TESTS,
                  SUB_DIR,
                  TMP_FILE_FOR_TESTS,
              )
          )
      self.hook.delete_directory(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS, new_dir_name)
      )
      output = self.hook.describe_directory(
          os.path.join(self.temp_dir, TMP_DIR_FOR_TESTS)
      )
      assert new_dir_name not in output
  
imports: from __future__ import annotations
  import json
  import os
  import shutil
  from io import StringIO
  from unittest import mock
  import paramiko
  import pytest
  from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
  from airflow.models import Connection
  from airflow.providers.sftp.hooks.sftp import SFTPHook
  from airflow.providers.ssh.hooks.ssh import SSHHook
  from airflow.utils.session import provide_session
label_desc: Use image node_id 9 for calling the TestSFTPHook obj's underlying member method code with example usage: obj.test_create_and_delete_directory() without return types