code: def test_PyOS_snprintf(self):
      PyOS_snprintf = pythonapi.PyOS_snprintf
      PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p
  
      buf = create_string_buffer(256)
      PyOS_snprintf(buf, sizeof(buf), b"Hello from %s", b"ctypes")
      self.assertEqual(buf.value, b"Hello from ctypes")
  
      PyOS_snprintf(
          buf,
          sizeof(buf),
          b"Hello from %s (%d, %d, %d)",
          b"ctypes",
          1,
          2,
          3,
      )
      self.assertEqual(buf.value, b"Hello from ctypes (1, 2, 3)")
  
      # not enough arguments
      self.assertRaises(TypeError, PyOS_snprintf, buf)
  
file_path: cpython/Lib/test/test_ctypes/test_python_api.py
imports: import _ctypes
  import sys
  import unittest
  from test import support
  from ctypes import pythonapi, POINTER, create_string_buffer, sizeof, py_object, c_char_p, c_char, c_long, c_size_t
label_desc: Use image node_id 5 for calling the PythonAPITestCase obj's underlying member method code with example usage: obj.test_PyOS_snprintf() without return types