| 40 | self.assertIs(self.io.editwin, self.editwin) |
| 41 | |
| 42 | def test_fixnewlines_end(self): |
| 43 | eq = self.assertEqual |
| 44 | io = self.io |
| 45 | fix = io.fixnewlines |
| 46 | text = io.editwin.text |
| 47 | |
| 48 | # Make the editor temporarily look like Shell. |
| 49 | self.editwin.interp = None |
| 50 | shelltext = '>>> if 1' |
| 51 | self.editwin.get_prompt_text = Func(result=shelltext) |
| 52 | eq(fix(), shelltext) # Get... call and '\n' not added. |
| 53 | del self.editwin.interp, self.editwin.get_prompt_text |
| 54 | |
| 55 | text.insert(1.0, 'a') |
| 56 | eq(fix(), 'a'+io.eol_convention) |
| 57 | eq(text.get('1.0', 'end-1c'), 'a\n') |
| 58 | eq(fix(), 'a'+io.eol_convention) |
| 59 | |
| 60 | |
| 61 | def _extension_in_filetypes(extension): |