code: def test_user_command(self):
      result = None
  
      def testfunc(arg):
          nonlocal result
          result = arg
          return arg
  
      self.interp.createcommand("testfunc", testfunc)
      self.addCleanup(self.interp.tk.deletecommand, "testfunc")
  
      def check(value, expected=None, *, eq=self.assertEqual):
          if expected is None:
              expected = value
          nonlocal result
          result = None
          r = self.interp.call("testfunc", value)
          self.assertIsInstance(result, str)
          eq(result, expected)
          self.assertIsInstance(r, str)
          eq(r, expected)
  
      def float_eq(actual, expected):
          self.assertAlmostEqual(
              float(actual), expected, delta=abs(expected) * 1e-10
          )
  
      check(True, "1")
      check(False, "0")
      check("string")
      check("string\xbd")
      check("string\u20ac")
      check("string\U0001f4bb")
      if sys.platform != "win32":
          check("<\udce2\udc82\udcac>", "<\u20ac>")
          check(
              "<\udced\udca0\udcbd\udced\udcb2\udcbb>", "<\U0001f4bb>"
          )
      check("")
      check(b"string", "string")
      check(b"string\xe2\x82\xac", "string\xe2\x82\xac")
      check(b"string\xbd", "string\xbd")
      check(b"", "")
      check("str\x00ing")
      check("str\x00ing\xbd")
      check("str\x00ing\u20ac")
      check(b"str\x00ing", "str\x00ing")
      check(b"str\xc0\x80ing", "str\xc0\x80ing")
      check(b"str\xc0\x80ing\xe2\x82\xac", "str\xc0\x80ing\xe2\x82\xac")
      for i in self.get_integers():
          check(i, str(i))
      for f in (0.0, 1.0, -1.0):
          check(f, repr(f))
      for f in (
          1 / 3.0,
          sys.float_info.min,
          sys.float_info.max,
          -sys.float_info.min,
          -sys.float_info.max,
      ):
          check(f, eq=float_eq)
      check(float("inf"), eq=float_eq)
      check(-float("inf"), eq=float_eq)
      # XXX NaN representation can be not parsable by float()
      check((), "")
      check((1, (2,), (3, 4), "5 6", ()), "1 2 {3 4} {5 6} {}")
      check(
          [
              1,
              [
                  2,
              ],
              [3, 4],
              "5 6",
              [],
          ],
          "1 2 {3 4} {5 6} {}",
      )
  
imports: import unittest
  import subprocess
  import sys
  import os
  from test import support
  from test.support import import_helper
  from test.support import os_helper
  import tkinter
  from tkinter import Tcl
  from _tkinter import TclError
label_desc: Use image node_id 36 for calling the TclTest obj's underlying member method code with example usage: obj.test_user_command() and returns: arg