code: def test_delete_not_crashing(path=None):
      # although in above test we just use/interact with Keyring without specifying
      # any custom one, there we do not change it so I guess it is ok. Here we want
      # a real keyring backend which we will alter
      from keyrings.alt.file import PlaintextKeyring
  
      kb = PlaintextKeyring()
      kb.filename = path
  
      keyring = Keyring(keyring_backend=kb)
      cred = UserPassword("test1", keyring=keyring)
  
      cred.set(user="user1", password="password")
      ok_file_has_content(
          path, ".*test1.*", re_=True
      )  # keyring backend saves where we expect
  
      # manually delete one component of the credential
      cred._keyring.delete(cred.name, next(iter(cred._FIELDS)))
  
      # now delete entire credential -- we must not crash
      cred.delete()
      try:
          ok_file_has_content(
              path, ".*test1.*", re_=True
          )  # keyring backend saves where we expect
          raise AssertionError("keyring still has our key")
      except AssertionError:
          pass
  
file_path: datalad/datalad/downloaders/tests/test_credentials.py
imports: from unittest.mock import patch
  from datalad import cfg
  from datalad.api import Dataset
  from datalad.support.external_versions import external_versions
  from datalad.support.keyring_ import Keyring, MemoryKeyring
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_false, assert_in, assert_raises, assert_true, ok_file_has_content, skip_if, with_tempfile, with_testsui
  from ..credentials import AWS_S3, CompositeCredential, GitCredential, UserPassword
label_desc: Use image node_id 7 for calling a global function with example usage: test_delete_not_crashing(path) without return types