class_docstr: Test getting and setting global print options.
class_docstr_tok: ["Test","getting","and","setting","global","print","options","."]
docstr: there was an issue where
  repr(array([0], dtype='<u2')) and repr(array([0], dtype='>u2'))
  both returned the same thing:
  array([0], dtype=uint16)
  even though their dtypes have different endianness.
docstr_tok: ["there","was","an","issue","where","repr","(","array","(","[","0","]",",","dtype=","'","<","u2","'",")",")","and","repr","(","array","(","[","0","]",",","dtype=","'",">","u2","'",")",")","both","returned","the","same","thing",":","array","(","[","0","]",",","dtype=uint16",")","even","though","their","dtypes","have","different","endianness","."]
code: def test_dtype_endianness_repr(self, native):
      """
      there was an issue where
      repr(array([0], dtype='<u2')) and repr(array([0], dtype='>u2'))
      both returned the same thing:
      array([0], dtype=uint16)
      even though their dtypes have different endianness.
      """
      native_dtype = np.dtype(native)
      non_native_dtype = native_dtype.newbyteorder()
      non_native_repr = repr(np.array([1], non_native_dtype))
      native_repr = repr(np.array([1], native_dtype))
      # preserve the sensible default of only showing dtype if nonstandard
      assert ("dtype" in native_repr) ^ (
          native_dtype in _typelessdata
      ), (
          "an array's repr should show dtype if and only if the type "
          "of the array is NOT one of the standard types "
          "(e.g., int32, bool, float64)."
      )
      if non_native_dtype.itemsize > 1:
          # if the type is >1 byte, the non-native endian version
          # must show endianness.
          assert non_native_repr != native_repr
          assert (
              f"dtype='{non_native_dtype.byteorder}" in non_native_repr
          )
  
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 17 for calling the TestPrintOptions obj's underlying member method code with example usage: obj.test_dtype_endianness_repr(native) without return types