code: def testPromoteDtypesStrict(self):
      msg = (
          "Input dtypes .* have no available implicit dtype promotion "
          "path when jax_numpy_dtype_promotion=strict"
      )
  
      assertTypePromotionError = functools.partial(
          self.assertRaisesRegex,
          dtypes.TypePromotionError,
          msg,
          dtypes.promote_types,
      )
  
      # Check that strong types have diagonal promotion table:
      for t1 in all_dtypes:
          for t2 in all_dtypes:
              if t1 == t2:
                  self.assertEqual(t1, dtypes.promote_types(t1, t2))
              else:
                  assertTypePromotionError(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)
  
      # Check that weak promotion only works if strong value is not cast:
      for t1 in bool_dtypes:
          assertTypePromotionError(t1, int)
          assertTypePromotionError(t1, float)
          assertTypePromotionError(t1, complex)
      for t1 in signed_dtypes + unsigned_dtypes:
          self.assertEqual(dtypes.promote_types(t1, int), t1)
          assertTypePromotionError(t1, float)
          assertTypePromotionError(t1, complex)
      for t1 in float_dtypes:
          self.assertEqual(dtypes.promote_types(t1, int), t1)
          self.assertEqual(dtypes.promote_types(t1, float), t1)
          assertTypePromotionError(t1, complex)
      for t1 in complex_dtypes:
          self.assertEqual(dtypes.promote_types(t1, int), t1)
          self.assertEqual(dtypes.promote_types(t1, float), t1)
          self.assertEqual(dtypes.promote_types(t1, complex), t1)
  
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 5 for calling the DtypesTest obj's underlying member method code with example usage: obj.testPromoteDtypesStrict() without return types