code: def test_dict_type_refinement_annotation_key_mismatch(self):
      def fn():
          l1 = [1, 2, "foo", 3]
          l2 = ["foo", "bar", "baz", "qux"]
          d: Dict[int, str] = dict(zip(l1, l2))
          return d
  
      with self.assertRaisesRegex(
          RuntimeError,
          "Dicts may only "
          "contain homogeneous keys, but the "
          "type of the first generated key "
          r"was Union\[int, str\]",
      ):
          torch.jit.script(fn)
  
imports: import os
  import sys
  import torch
  from torch.testing._internal.jit_utils import JitTestCase, make_global
  from torch.testing._internal.common_utils import IS_WINDOWS
  from collections import namedtuple
  from typing import List, Tuple, Dict, NamedTuple
label_desc: Use image node_id 3 for calling the TestTyping obj's underlying member method code with example usage: obj.test_dict_type_refinement_annotation_key_mismatch() and returns: d