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

Method test_goto_file_line

Lib/idlelib/idle_test/test_outwin.py:111–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

109 eq(get('insert linestart', 'insert lineend'), '')
110
111 def test_goto_file_line(self):
112 eq = self.assertEqual
113 w = self.window
114 text = self.text
115
116 w.flist = mock.Mock()
117 gfl = w.flist.gotofileline = Func()
118 showerror = w.showerror = Mbox_func()
119
120 # No file/line number.
121 w.write('Not a file line')
122 self.assertIsNone(w.goto_file_line())
123 eq(gfl.called, 0)
124 eq(showerror.title, 'No special line')
125
126 # Current file/line number.
127 w.write(f'{str(__file__)}: 42: spam\n')
128 w.write(f'{str(__file__)}: 21: spam')
129 self.assertIsNone(w.goto_file_line())
130 eq(gfl.args, (str(__file__), 21))
131
132 # Previous line has file/line number.
133 text.delete('1.0', 'end')
134 w.write(f'{str(__file__)}: 42: spam\n')
135 w.write('Not a file line')
136 self.assertIsNone(w.goto_file_line())
137 eq(gfl.args, (str(__file__), 42))
138
139 del w.flist.gotofileline, w.showerror
140
141
142class ModuleFunctionTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 8

FuncClass · 0.90
Mbox_funcClass · 0.90
eqFunction · 0.85
strFunction · 0.85
assertIsNoneMethod · 0.80
goto_file_lineMethod · 0.80
writeMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected