code: def test_del_attr_handling():
      # DataSource __del__ can be called
      # even if __init__ fails when the
      # Exception object is caught by the
      # caller as happens in refguide_check
      # is_deprecated() function
  
      ds = datasource.DataSource()
      # simulate failed __init__ by removing key attribute
      # produced within __init__ and expected by __del__
      del ds._istmpdest
      # should not raise an AttributeError if __del__
      # gracefully handles failed __init__:
      ds.__del__()
  
imports: import os
  import pytest
  from tempfile import mkdtemp, mkstemp, NamedTemporaryFile
  from shutil import rmtree
  import numpy.lib._datasource
  from numpy.testing import assert_, assert_equal, assert_raises
  import urllib.request
  from urllib.parse import urlparse
  from urllib.error import URLError
label_desc: Use image node_id 12 for calling a global function with example usage: test_del_attr_handling() without return types