code: def test_write_stderr_nonencodable(self):
      shell = MockShell()
      f = run.StdOutputFile(
          shell, "stderr", "iso-8859-15", "backslashreplace"
      )
      f.write("t\xe8\u015b\U0001d599\xa4")
      self.assertEqual(
          shell.written, [("t\xe8\\u015b\\U0001d599\\xa4", "stderr")]
      )
      shell.reset()
  
      f.write(S("t\xe8\u015b\U0001d599\xa4"))
      self.assertEqual(
          shell.written, [("t\xe8\\u015b\\U0001d599\\xa4", "stderr")]
      )
      self.assertEqual(type(shell.written[0][0]), str)
      shell.reset()
  
      self.assertRaises(TypeError, f.write)
      self.assertEqual(shell.written, [])
      self.assertRaises(TypeError, f.write, b"test")
      self.assertRaises(TypeError, f.write, 123)
      self.assertEqual(shell.written, [])
      self.assertRaises(TypeError, f.write, "test", "spam")
      self.assertEqual(shell.written, [])
  
imports: from idlelib import run
  import io
  import sys
  from test.support import captured_output, captured_stderr
  import unittest
  from unittest import mock
  import idlelib
  from idlelib.idle_test.mock_idle import Func
label_desc: Use image node_id 4 for calling the StdOutputFilesTest obj's underlying member method code with example usage: obj.test_write_stderr_nonencodable() without return types