Esempio n. 1
0
 def setUpClass(cls):
     cls.text = mockText()
     test_text = 'First line\nLine with target\nLast line\n'
     cls.text.insert('1.0', test_text)
     cls.pat = re.compile('target')
     cls.engine = se.SearchEngine(None)
     cls.engine.search_forward = lambda *args: ('f', args)
     cls.engine.search_backward = lambda *args: ('b', args)
     return
Esempio n. 2
0
 def setUpClass(cls):
     cls.root = Tk()
     cls.root.withdraw()
     se.tkMessageBox = Mbox
     cls.engine = se.SearchEngine(cls.root)
     cls.dialog = rd.ReplaceDialog(cls.root, cls.engine)
     cls.dialog.ok = Mock()
     cls.text = Text(cls.root)
     cls.text.undo_block_start = Mock()
     cls.text.undo_block_stop = Mock()
     cls.dialog.text = cls.text
Esempio n. 3
0
 def setUpClass(cls):
     cls.engine = se.SearchEngine(None)
     cls.text = mockText()
     cls.text.index = lambda index: '4.0'
     test_text = 'First line\nLine with target\nLast line\n'
     cls.text.insert('1.0', test_text)
     cls.pat = re.compile('target')
     cls.res = (2, (10, 16))
     cls.failpat = re.compile('xyz')
     cls.emptypat = re.compile('\\w*')
     return
Esempio n. 4
0
    def setUpClass(cls):
        ##        requires('gui')
        ##        cls.root = Tk()
        ##        cls.text = Text(master=cls.root)
        cls.text = mockText()
        test_text = ('First line\n' 'Line with target\n' 'Last line\n')
        cls.text.insert('1.0', test_text)
        cls.pat = re.compile('target')

        cls.engine = se.SearchEngine(None)
        cls.engine.search_forward = lambda *args: ('f', args)
        cls.engine.search_backward = lambda *args: ('b', args)
Esempio n. 5
0
 def setUpClass(cls):
     cls.engine = se.SearchEngine(None)
     ##        requires('gui')
     ##        cls.root = Tk()
     ##        cls.text = Text(master=cls.root)
     cls.text = mockText()
     # search_backward calls index('end-1c')
     cls.text.index = lambda index: '4.0'
     test_text = ('First line\n' 'Line with target\n' 'Last line\n')
     cls.text.insert('1.0', test_text)
     cls.pat = re.compile('target')
     cls.res = (2, (10, 16))  # line, slice indexes of 'target'
     cls.failpat = re.compile('xyz')  # not in text
     cls.emptypat = re.compile('\w*')  # empty match possible
 def setUp(self):
     self.engine = se.SearchEngine(self.root)  # None also seems to work
     self.dialog = sdb.SearchDialogBase(root=self.root, engine=self.engine)
Esempio n. 7
0
 def setUp(self):
     self.engine = se.SearchEngine(root=None)
     return
Esempio n. 8
0
 def setUp(self):
     self.engine = se.SearchEngine(self.root)
     self.dialog = sd.SearchDialog(self.root, self.engine)
     self.text = tk.Text(self.root)
     self.text.insert('1.0', 'Hello World!')