MCPcopy Create free account
hub / github.com/python/cpython / test_fixnewlines_end

Method test_fixnewlines_end

Lib/idlelib/idle_test/test_iomenu.py:42–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
61def _extension_in_filetypes(extension):

Callers

nothing calls this directly

Calls 5

FuncClass · 0.90
eqFunction · 0.85
fixFunction · 0.85
insertMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected