code: def test_cstrings(self):
      from ctypes import c_char_p, byref
  
      # c_char_p.from_param on a Python String packs the string
      # into a cparam object
      s = "123"
      self.assertIs(c_char_p.from_param(s)._obj, s)
  
      # new in 0.9.1: convert (encode) unicode to ascii
      self.assertEqual(c_char_p.from_param("123")._obj, "123")
      self.assertRaises(
          UnicodeEncodeError, c_char_p.from_param, "123\377"
      )
  
      self.assertRaises(TypeError, c_char_p.from_param, 42)
  
      # calling c_char_p.from_param with a c_char_p instance
      # returns the argument itself:
      a = c_char_p("123")
      self.assertIs(c_char_p.from_param(a), a)
  
file_path: catboost/contrib/tools/python/src/Lib/ctypes/test/test_parameters.py
imports: import unittest, sys
  from ctypes.test import need_symbol
  import test.support
label_desc: Use image node_id 5 for calling the SimpleTypesTestCase obj's underlying member method code with example usage: obj.test_cstrings() without return types