class_docstr: Test getting and setting global print options.
class_docstr_tok: ["Test","getting","and","setting","global","print","options","."]
code: def test_linewidth_repr(self):
      a = np.full(7, fill_value=2)
      np.set_printoptions(linewidth=17)
      assert_equal(
          repr(a),
          textwrap.dedent(
              """\
              array([2, 2, 2,
                     2, 2, 2,
                     2])"""
          ),
      )
      np.set_printoptions(linewidth=17, legacy="1.13")
      assert_equal(
          repr(a),
          textwrap.dedent(
              """\
              array([2, 2, 2,
                     2, 2, 2, 2])"""
          ),
      )
  
      a = np.full(8, fill_value=2)
  
      np.set_printoptions(linewidth=18, legacy=False)
      assert_equal(
          repr(a),
          textwrap.dedent(
              """\
              array([2, 2, 2,
                     2, 2, 2,
                     2, 2])"""
          ),
      )
  
      np.set_printoptions(linewidth=18, legacy="1.13")
      assert_equal(
          repr(a),
          textwrap.dedent(
              """\
              array([2, 2, 2, 2,
                     2, 2, 2, 2])"""
          ),
      )
  
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 18 for calling the TestPrintOptions obj's underlying member method code with example usage: obj.test_linewidth_repr() without return types