MCPcopy Index your code
hub / github.com/python/cpython / test_find_selection

Method test_find_selection

Lib/idlelib/idle_test/test_search.py:59–77  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57 self.assertTrue(self.dialog.find_again(text))
58
59 def test_find_selection(self):
60 # Select some text and make sure it's found
61 text = self.text
62 # Add additional line to find
63 self.text.insert('2.0', 'Hello World!')
64
65 text.tag_add('sel', '1.0', '1.4') # Select 'Hello'
66 self.assertTrue(self.dialog.find_selection(text))
67
68 text.tag_remove('sel', '1.0', 'end')
69 text.tag_add('sel', '1.6', '1.11') # Select 'World!'
70 self.assertTrue(self.dialog.find_selection(text))
71
72 text.tag_remove('sel', '1.0', 'end')
73 text.tag_add('sel', '1.0', '1.11') # Select 'Hello World!'
74 self.assertTrue(self.dialog.find_selection(text))
75
76 # Remove additional line
77 text.delete('2.0', 'end')
78
79if __name__ == '__main__':
80 unittest.main(verbosity=2, exit=2)

Callers

nothing calls this directly

Calls 6

tag_addMethod · 0.80
assertTrueMethod · 0.80
find_selectionMethod · 0.80
insertMethod · 0.45
tag_removeMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected