code: def test_f_size(self):
      # gh8320
      # check that decreasing the size of the returned array raises an error
      # and doesn't segfault
      class fun(object):
          def __init__(self):
              self.count = 0
  
          def __call__(self, x):
              self.count += 1
  
              if not (self.count % 5):
                  ret = x[0] + 0.5 * (x[0] - x[1]) ** 3 - 1.0
              else:
                  ret = [
                      x[0] + 0.5 * (x[0] - x[1]) ** 3 - 1.0,
                      0.5 * (x[1] - x[0]) ** 3 + x[1],
                  ]
  
              return ret
  
      F = fun()
      with assert_raises(ValueError):
          sol = root(F, [0.1, 0.0], method="lm")
  
file_path: catboost/contrib/python/scipy/py2/scipy/optimize/tests/test__root.py
imports: from __future__ import division, print_function, absolute_import
  from numpy.testing import assert_
  from pytest import raises
  import numpy
  from scipy.optimize import root
label_desc: Use image node_id 3 for calling the TestRoot obj's underlying member method code with example usage: obj.test_f_size() and returns: ret