code: def test_sum_dtypes_warnings(self):
      for dt in (int, np.float16, np.float32, np.float64):
          for v in (0, 1, 2, 7, 8, 9, 15, 16, 19, 127, 128, 1024, 1235):
              # warning if sum overflows, which it does in float16
              import warnings
  
              with warnings.catch_warnings(record=True) as w:
                  warnings.simplefilter("always", RuntimeWarning)
  
                  tgt = dt(v * (v + 1) / 2)
                  overflow = not np.isfinite(tgt)
                  assert_equal(len(w), 1 * overflow)
  
                  d = np.arange(1, v + 1, dtype=dt)
  
                  assert_almost_equal(np.sum(d), tgt)
                  assert_equal(len(w), 2 * overflow)
  
                  assert_almost_equal(np.sum(np.flip(d)), tgt)
                  assert_equal(len(w), 3 * overflow)
  
imports: from unittest import skipIf, SkipTest
  import numpy
  import pytest
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 4 for calling the TestSum obj's underlying member method code with example usage: obj.test_sum_dtypes_warnings() without return types