class_docstr: Test getting and setting global print options.
class_docstr_tok: ["Test","getting","and","setting","global","print","options","."]
code: def test_0d_arrays(self):
      assert_equal(str(np.array("café", "<U4")), "café")
  
      assert_equal(
          repr(np.array("café", "<U4")), "array('café', dtype='<U4')"
      )
      assert_equal(str(np.array("test", np.str_)), "test")
  
      a = np.zeros(1, dtype=[("a", "<i4", (3,))])
      assert_equal(str(a[0]), "([0, 0, 0],)")
  
      assert_equal(
          repr(np.datetime64("2005-02-25")[...]),
          "array('2005-02-25', dtype='datetime64[D]')",
      )
  
      assert_equal(
          repr(np.timedelta64("10", "Y")[...]),
          "array(10, dtype='timedelta64[Y]')",
      )
  
      # repr of 0d arrays is affected by printoptions
      x = np.array(1)
      np.set_printoptions(formatter={"all": lambda x: "test"})
      assert_equal(repr(x), "array(test)")
      # str is unaffected
      assert_equal(str(x), "1")
  
      # check `style` arg raises
      assert_warns(
          DeprecationWarning, np.array2string, np.array(1.0), style=repr
      )
      # but not in legacy mode
      np.array2string(np.array(1.0), style=repr, legacy="1.13")
      # gh-10934 style was broken in legacy mode, check it works
      np.array2string(np.array(1.0), legacy="1.13")
  
imports: import sys
  import gc
  from hypothesis import given
  from hypothesis.extra import numpy
  import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_raises, assert_warns, HAS_REFCOUNT, assert_raises_regex
  from numpy.core.arrayprint import _typelessdata
  import textwrap
label_desc: Use image node_id 7 for calling the TestPrintOptions obj's underlying member method code with example usage: obj.test_0d_arrays() without return types