code: def test_complex_constructor(self):
      # Test all scalar types
      def fn_int(real: int, img: int):
          return complex(real, img)
  
      self.checkScript(
          fn_int,
          (
              0,
              0,
          ),
      )
      self.checkScript(
          fn_int,
          (
              -1234,
              0,
          ),
      )
      self.checkScript(
          fn_int,
          (
              0,
              -1256,
          ),
      )
      self.checkScript(
          fn_int,
          (
              -167,
              -1256,
          ),
      )
  
      def fn_float(real: float, img: float):
          return complex(real, img)
  
      self.checkScript(
          fn_float,
          (
              0.0,
              0.0,
          ),
      )
      self.checkScript(
          fn_float,
          (
              -1234.78,
              0,
          ),
      )
      self.checkScript(
          fn_float,
          (
              0,
              56.18,
          ),
      )
      self.checkScript(
          fn_float,
          (
              -1.9,
              -19.8,
          ),
      )
  
      def fn_bool(real: bool, img: bool):
          return complex(real, img)
  
      self.checkScript(
          fn_bool,
          (
              True,
              True,
          ),
      )
      self.checkScript(
          fn_bool,
          (
              False,
              False,
          ),
      )
      self.checkScript(
          fn_bool,
          (
              False,
              True,
          ),
      )
      self.checkScript(
          fn_bool,
          (
              True,
              False,
          ),
      )
  
      def fn_bool_int(real: bool, img: int):
          return complex(real, img)
  
      self.checkScript(
          fn_bool_int,
          (
              True,
              0,
          ),
      )
      self.checkScript(
          fn_bool_int,
          (
              False,
              0,
          ),
      )
      self.checkScript(
          fn_bool_int,
          (
              False,
              -1,
          ),
      )
      self.checkScript(
          fn_bool_int,
          (
              True,
              3,
          ),
      )
  
      def fn_int_bool(real: int, img: bool):
          return complex(real, img)
  
      self.checkScript(
          fn_int_bool,
          (
              0,
              True,
          ),
      )
      self.checkScript(
          fn_int_bool,
          (
              0,
              False,
          ),
      )
      self.checkScript(
          fn_int_bool,
          (
              -3,
              True,
          ),
      )
      self.checkScript(
          fn_int_bool,
          (
              6,
              False,
          ),
      )
  
      def fn_bool_float(real: bool, img: float):
          return complex(real, img)
  
      self.checkScript(
          fn_bool_float,
          (
              True,
              0.0,
          ),
      )
      self.checkScript(
          fn_bool_float,
          (
              False,
              0.0,
          ),
      )
      self.checkScript(
          fn_bool_float,
          (
              False,
              -1.0,
          ),
      )
      self.checkScript(
          fn_bool_float,
          (
              True,
              3.0,
          ),
      )
  
      def fn_float_bool(real: float, img: bool):
          return complex(real, img)
  
      self.checkScript(
          fn_float_bool,
          (
              0.0,
              True,
          ),
      )
      self.checkScript(
          fn_float_bool,
          (
              0.0,
              False,
          ),
      )
      self.checkScript(
          fn_float_bool,
          (
              -3.0,
              True,
          ),
      )
      self.checkScript(
          fn_float_bool,
          (
              6.0,
              False,
          ),
      )
  
      def fn_float_int(real: float, img: int):
          return complex(real, img)
  
      self.checkScript(
          fn_float_int,
          (
              0.0,
              1,
          ),
      )
      self.checkScript(
          fn_float_int,
          (
              0.0,
              -1,
          ),
      )
      self.checkScript(
          fn_float_int,
          (
              1.8,
              -3,
          ),
      )
      self.checkScript(
          fn_float_int,
          (
              2.7,
              8,
          ),
      )
  
      def fn_int_float(real: int, img: float):
          return complex(real, img)
  
      self.checkScript(
          fn_int_float,
          (
              1,
              0.0,
          ),
      )
      self.checkScript(
          fn_int_float,
          (
              -1,
              1.7,
          ),
      )
      self.checkScript(
          fn_int_float,
          (
              -3,
              0.0,
          ),
      )
      self.checkScript(
          fn_int_float,
          (
              2,
              -8.9,
          ),
      )
  
imports: import torch
  import os
  import sys
  from torch.testing._internal.jit_utils import JitTestCase, execWrapper
  from torch.testing._internal.common_utils import IS_MACOS
  from typing import List, Dict
  from itertools import product
  from textwrap import dedent
  import cmath
label_desc: Use image node_id 8 for calling the TestComplex obj's underlying member method code with example usage: obj.test_complex_constructor() and returns: complex, complex, complex, complex, complex, complex, complex, complex, complex