code: def test_float_types(tp):
      """Check formatting.
  
      This is only for the str function, and only for simple types.
      The precision of np.float32 and np.longdouble aren't the same as the
      python float precision.
  
      """
      for x in [0, 1, -1, 1e20]:
          assert_equal(
              str(tp(x)),
              str(float(x)),
              err_msg="Failed str formatting for type %s" % tp,
          )
  
      if tp(1e16).itemsize > 4:
          assert_equal(
              str(tp(1e16)),
              str(float("1e16")),
              err_msg="Failed str formatting for type %s" % tp,
          )
      else:
          ref = "1e+16"
          assert_equal(
              str(tp(1e16)),
              ref,
              err_msg="Failed str formatting for type %s" % tp,
          )
  
file_path: catboost/contrib/python/numpy/py3/numpy/core/tests/test_print.py
imports: import sys
  import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, IS_MUSL
  from __tests__.numpy.core.tests._locales import CommaDecimalPointLocale
  from io import StringIO
label_desc: Use image node_id 1 for calling a global function with example usage: test_float_types(tp) without return types