code: def test_fixnewlines_end(self):
      eq = self.assertEqual
      io = self.io
      fix = io.fixnewlines
      text = io.editwin.text
  
      # Make the editor temporarily look like Shell.
      self.editwin.interp = None
      shelltext = ">>> if 1"
      self.editwin.get_prompt_text = Func(result=shelltext)
      eq(fix(), shelltext)  # Get... call and '\n' not added.
      del self.editwin.interp, self.editwin.get_prompt_text
  
      text.insert(1.0, "a")
      eq(fix(), "a" + io.eol_convention)
      eq(text.get("1.0", "end-1c"), "a\n")
      eq(fix(), "a" + io.eol_convention)
  
file_path: cpython/Lib/idlelib/idle_test/test_iomenu.py
imports: from idlelib import iomenu
  import unittest
  from test.support import requires
  from tkinter import Tk
  from idlelib.editor import EditorWindow
  from idlelib import util
  from idlelib.idle_test.mock_idle import Func
  from tokenize import open, detect_encoding
label_desc: Use image node_id 4 for calling the IOBindingTest obj's underlying member method code with example usage: obj.test_fixnewlines_end() without return types