code: def test_coercion_basic(self, dtype, scalar):
      # Note the `[scalar]` is there because np.array(scalar) uses stricter
      # `scalar.__int__()` rules for backward compatibility right now.
      arr = np.array(scalar, dtype=dtype)
      cast = np.array(scalar).astype(dtype)
      assert_array_equal(arr, cast)
  
      ass = np.ones((), dtype=dtype)
      if issubclass(dtype, np.integer):
          with pytest.raises(TypeError):
              # raises, as would np.array([scalar], dtype=dtype), this is
              # conversion from times, but behaviour of integers.
              ass[()] = scalar
      else:
          ass[()] = scalar
          assert_array_equal(ass, cast)
  
imports: from itertools import permutations, product
  import pytest
  from pytest import param
  import numpy
  import numpy._core._multiarray_umath
  from numpy._core._rational_tests import rational
  from numpy.testing import assert_array_equal, assert_warns, IS_PYPY
label_desc: Use image node_id 1 for calling the TestTimeScalars obj's underlying member method code with example usage: obj.test_coercion_basic(dtype, scalar) without return types