code: def test_write(self):
      shell = MockShell()
      f = PseudoOutputFile(shell, "stdout", "utf-8")
      f.write("test")
      self.assertEqual(shell.written, [("test", "stdout")])
      shell.reset()
      f.write("t\xe8st")
      self.assertEqual(shell.written, [("t\xe8st", "stdout")])
      shell.reset()
      f.write("t\xe8st")
      self.assertEqual(shell.written, [("t\xe8st", "stdout")])
      shell.reset()
  
      f.write(S("t\xe8st"))
      self.assertEqual(shell.written, [("t\xe8st", "stdout")])
      self.assertEqual(type(shell.written[0][0]), str)
      shell.reset()
      f.write(BA("t\xe8st"))
      self.assertEqual(shell.written, [("t\xe8st", "stdout")])
      self.assertEqual(type(shell.written[0][0]), str)
      shell.reset()
      f.write(U("t\xe8st"))
      self.assertEqual(shell.written, [("t\xe8st", "stdout")])
      self.assertEqual(type(shell.written[0][0]), unicode)
      shell.reset()
  
      self.assertRaises(TypeError, f.write)
      self.assertEqual(shell.written, [])
      self.assertRaises(TypeError, f.write, 123)
      self.assertEqual(shell.written, [])
      self.assertRaises(TypeError, f.write, "test", "spam")
      self.assertEqual(shell.written, [])
  
imports: import unittest
  import io
  from idlelib.PyShell import PseudoInputFile, PseudoOutputFile
  from test import test_support
label_desc: Use image node_id 3 for calling the PseudeOutputFilesTest obj's underlying member method code with example usage: obj.test_write() without return types