code: def test_stdio(self):
      code = textwrap.dedent(
          """
              import sys
              print(f"stdin: {sys.stdin.encoding}/{sys.stdin.errors}")
              print(f"stdout: {sys.stdout.encoding}/{sys.stdout.errors}")
              print(f"stderr: {sys.stderr.encoding}/{sys.stderr.errors}")
          """
      )
  
      out = self.get_output(
          "-X", "utf8", "-c", code, PYTHONIOENCODING=""
      )
      self.assertEqual(
          out.splitlines(),
          [
              "stdin: utf-8/surrogateescape",
              "stdout: utf-8/surrogateescape",
              "stderr: utf-8/backslashreplace",
          ],
      )
  
      # PYTHONIOENCODING has the priority over PYTHONUTF8
      out = self.get_output(
          "-X", "utf8", "-c", code, PYTHONIOENCODING="latin1"
      )
      self.assertEqual(
          out.splitlines(),
          [
              "stdin: iso8859-1/strict",
              "stdout: iso8859-1/strict",
              "stderr: iso8859-1/backslashreplace",
          ],
      )
  
      out = self.get_output(
          "-X", "utf8", "-c", code, PYTHONIOENCODING=":namereplace"
      )
      self.assertEqual(
          out.splitlines(),
          [
              "stdin: utf-8/namereplace",
              "stdout: utf-8/namereplace",
              "stderr: utf-8/backslashreplace",
          ],
      )
  
imports: import locale
  import subprocess
  import sys
  import textwrap
  import unittest
  from test import support
  from test.support.script_helper import assert_python_ok, assert_python_failure
  from test.support import os_helper, MS_WINDOWS
label_desc: Use image node_id 7 for calling the UTF8ModeTests obj's underlying member method code with example usage: obj.test_stdio() without return types