code: def test_constructors():
      """C++ default and converting constructors are equivalent to type calls in Python"""
      types = [
          bytes,
          bytearray,
          str,
          bool,
          int,
          float,
          tuple,
          list,
          dict,
          set,
      ]
      expected = {t.__name__: t() for t in types}
      assert m.default_constructors() == expected
  
      data = {
          bytes: b"41",  # Currently no supported or working conversions.
          bytearray: bytearray(b"41"),
          str: 42,
          bool: "Not empty",
          int: "42",
          float: "+1e3",
          tuple: range(3),
          list: range(3),
          dict: [("two", 2), ("one", 1), ("three", 3)],
          set: [4, 4, 5, 6, 6, 6],
          frozenset: [4, 4, 5, 6, 6, 6],
          memoryview: b"abc",
      }
      inputs = {k.__name__: v for k, v in data.items()}
      expected = {k.__name__: k(v) for k, v in data.items()}
  
      assert m.converting_constructors(inputs) == expected
      assert m.cast_functions(inputs) == expected
  
      # Converting constructors and cast functions should just reference rather
      # than copy when no conversion is needed:
      noconv1 = m.converting_constructors(expected)
      for k in noconv1:
          assert noconv1[k] is expected[k]
  
      noconv2 = m.cast_functions(expected)
      for k in noconv2:
          assert noconv2[k] is expected[k]
  
imports: import contextlib
  import sys
  import types
  import pytest
  import env
  from pybind11_tests import detailed_error_messages_enabled
  from pybind11_tests import pytypes
label_desc: Use image node_id 24 for calling a global function with example usage: test_constructors() without return types