code: def test_none_to_nan_cast(dtype):
      # Note that at the time of writing this test, the scalar constructors
      # reject None
      arr = np.zeros(1, dtype=dtype)
      arr[0] = None
      assert np.isnan(arr)[0]
      assert np.isnan(np.array(None, dtype=dtype))[()]
      assert np.isnan(np.array([None], dtype=dtype))[0]
      assert np.isnan(np.array(None).astype(dtype))[()]
  
imports: import sys
  import numpy
  from numpy.core._rational_tests import rational
  import pytest
  from numpy.testing import assert_, assert_equal, assert_array_equal, assert_raises, assert_warns, HAS_REFCOUNT
label_desc: Use image node_id 12 for calling a global function with example usage: test_none_to_nan_cast(dtype) without return types