def setUp(self):
        self.text.yview(0)
        self.text['font'] = 'TkFixedFont'
        self.cc = codecontext.CodeContext(self.editor)

        self.highlight_cfg = {"background": '#abcdef', "foreground": '#123456'}
        orig_idleConf_GetHighlight = codecontext.idleConf.GetHighlight

        def mock_idleconf_GetHighlight(theme, element):
            if element == 'context':
                return self.highlight_cfg
            return orig_idleConf_GetHighlight(theme, element)

        GetHighlight_patcher = unittest.mock.patch.object(
            codecontext.idleConf, 'GetHighlight', mock_idleconf_GetHighlight)
        GetHighlight_patcher.start()
        self.addCleanup(GetHighlight_patcher.stop)

        self.font_override = 'TkFixedFont'

        def mock_idleconf_GetFont(root, configType, section):
            return self.font_override

        GetFont_patcher = unittest.mock.patch.object(codecontext.idleConf,
                                                     'GetFont',
                                                     mock_idleconf_GetFont)
        GetFont_patcher.start()
        self.addCleanup(GetFont_patcher.stop)
Ejemplo n.º 2
0
    def setUp(self):
        self.text.yview(0)
        self.cc = codecontext.CodeContext(self.editor)

        self.highlight_cfg = {"background": '#abcdef', "foreground": '#123456'}
        orig_idleConf_GetHighlight = codecontext.idleConf.GetHighlight

        def mock_idleconf_GetHighlight(theme, element):
            if element == 'context':
                return self.highlight_cfg
            return orig_idleConf_GetHighlight(theme, element)

        patcher = unittest.mock.patch.object(codecontext.idleConf,
                                             'GetHighlight',
                                             mock_idleconf_GetHighlight)
        patcher.start()
        self.addCleanup(patcher.stop)
Ejemplo n.º 3
0
 def setUp(self):
     self.text.yview(0)
     self.cc = codecontext.CodeContext(self.editor)
Ejemplo n.º 4
0
 def setUp(self):
     self.cc = codecontext.CodeContext(self.editor)