code: def test_unary(self, xp):
      arg1 = self.arg1
      if isinstance(arg1, numpy.ndarray):
          arg1 = xp.asarray(arg1)
  
      if self.name in {"angle"}:
          y = getattr(xp, self.name)(arg1, self.deg)
      else:
          y = getattr(xp, self.name)(arg1)
  
      if self.name in ("real", "imag"):
          # Some NumPy functions return Python scalars for Python scalar
          # inputs.
          # We need to convert them to arrays to compare with CuPy outputs.
          if xp is numpy and isinstance(
              arg1, (bool, int, float, complex)
          ):
              y = xp.asarray(y)
  
          # TODO(niboshi): Fix this
          # numpy.real and numpy.imag return Python int if the input is
          # Python bool. CuPy should return an array of dtype=int32 or
          # dtype=int64 (depending on the platform) in such cases, instead
          # of an array of dtype=bool.
          if xp is cupy and isinstance(arg1, bool):
              y = y.astype(int)
  
      return y
  
imports: import itertools
  import warnings
  import numpy
  import pytest
  import cupy
  from cupy import testing
label_desc: Use image node_id 1 for calling the TestArithmeticUnary obj's underlying member method code with example usage: obj.test_unary(xp) and returns: y