code: def test_unicode_conversion():
      """Tests unicode conversion and error reporting."""
      import pybind11_tests
      from pybind11_tests import (
          good_utf8_string,
          bad_utf8_string,
          good_utf16_string,
          bad_utf16_string,
          good_utf32_string,  # bad_utf32_string,
          good_wchar_string,  # bad_wchar_string,
          u8_Z,
          u8_eacute,
          u16_ibang,
          u32_mathbfA,
          wchar_heart,
      )
  
      assert good_utf8_string() == "Say utf8‽ 🎂 𝐀"
      assert good_utf16_string() == "b‽🎂𝐀z"
      assert good_utf32_string() == "a𝐀🎂‽z"
      assert good_wchar_string() == "a⸘𝐀z"
  
      with pytest.raises(UnicodeDecodeError):
          bad_utf8_string()
  
      with pytest.raises(UnicodeDecodeError):
          bad_utf16_string()
  
      # These are provided only if they actually fail (they don't when 32-bit and under Python 2.7)
      if hasattr(pybind11_tests, "bad_utf32_string"):
          with pytest.raises(UnicodeDecodeError):
              pybind11_tests.bad_utf32_string()
      if hasattr(pybind11_tests, "bad_wchar_string"):
          with pytest.raises(UnicodeDecodeError):
              pybind11_tests.bad_wchar_string()
  
      assert u8_Z() == "Z"
      assert u8_eacute() == "é"
      assert u16_ibang() == "‽"
      assert u32_mathbfA() == "𝐀"
      assert wchar_heart() == "♥"
  
file_path: coremltools/deps/pybind11/tests/test_python_types.py
imports: import pytest
  from pybind11_tests import ExamplePythonTypes, ConstructorStats, has_optional, has_exp_optional
label_desc: Use image node_id 16 for calling a global function with example usage: test_unicode_conversion() without return types