code: def testPromoteDtypesStandard(self):
      for t1 in all_dtypes:
          self.assertEqual(t1, dtypes.promote_types(t1, t1))
  
          self.assertEqual(t1, dtypes.promote_types(t1, np.bool_))
          # TODO(zhangqiaorjc): Consider more dtype promotion rules for fp8.
          if t1 in fp8_dtypes:
              continue
          if t1 in int4_dtypes:
              continue
          self.assertEqual(
              np.dtype(np.complex128),
              dtypes.promote_types(t1, np.complex128),
          )
  
          for t2 in all_dtypes:
              # TODO(zhangqiaorjc): Consider more dtype promotion rules for fp8.
              if t2 in fp8_dtypes:
                  continue
              if t2 in int4_dtypes:
                  continue
              # Symmetry
              self.assertEqual(
                  dtypes.promote_types(t1, t2),
                  dtypes.promote_types(t2, t1),
              )
  
      self.assertEqual(
          np.dtype(np.float32),
          dtypes.promote_types(np.float16, dtypes.bfloat16),
      )
  
      # Promotions of non-inexact types against inexact types always prefer
      # the inexact types.
      for t in float_dtypes + complex_dtypes:
          for i in bool_dtypes + signed_dtypes + unsigned_dtypes:
              # TODO(zhangqiaorjc): Consider more dtype promotion rules for fp8.
              if t in fp8_dtypes:
                  continue
              if t in int4_dtypes or i in int4_dtypes:
                  continue
              self.assertEqual(t, dtypes.promote_types(t, i))
  
      # Promotions between exact types, or between inexact types, match NumPy.
      for groups in [
          bool_dtypes + np_signed_dtypes + np_unsigned_dtypes,
          np_float_dtypes + complex_dtypes,
      ]:
          for t1, t2 in itertools.combinations(groups, 2):
              self.assertEqual(
                  np.promote_types(t1, t2), dtypes.promote_types(t1, t2)
              )
  
      # Promotion between weak types matches numpy promotion
      for t1 in [int, float, complex]:
          for t2 in [int, float, complex]:
              py_result = type(t1(0) + t2(0))
              # np.dtype(int) is int32 on Windows and int64 on Linux/Mac.
              py_result_dtype = (
                  np.dtype(np.int64)
                  if py_result is int
                  else np.dtype(py_result)
              )
              (
                  lattice_dtype,
                  lattice_weak_type,
              ) = dtypes._lattice_result_type(t1, t2)
              self.assertTrue(lattice_weak_type)
              self.assertEqual(lattice_dtype, py_result_dtype)
  
imports: import dataclasses
  import enum
  import functools
  from functools import partial
  import itertools
  import operator
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import jax
  from jax import numpy
  from jax._src import config
  from jax._src import dtypes
  from jax._src import test_util
  from jax._src.lax import lax
label_desc: Use image node_id 6 for calling the DtypesTest obj's underlying member method code with example usage: obj.testPromoteDtypesStandard() without return types