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

Method test_font

Lib/idlelib/idle_test/test_sidebar.py:622–646  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

620 self.assertEqual(self.get_sidebar_lines(), ['>>>'])
621
622 def test_font(self):
623 sidebar = self.shell.shell_sidebar
624
625 test_font = 'TkTextFont'
626
627 def mock_idleconf_GetFont(root, configType, section):
628 return test_font
629 GetFont_patcher = unittest.mock.patch.object(
630 idlelib.sidebar.idleConf, 'GetFont', mock_idleconf_GetFont)
631 GetFont_patcher.start()
632 def cleanup():
633 GetFont_patcher.stop()
634 sidebar.update_font()
635 self.addCleanup(cleanup)
636
637 def get_sidebar_font():
638 canvas = sidebar.canvas
639 texts = list(canvas.find(tk.ALL))
640 fonts = {canvas.itemcget(text, 'font') for text in texts}
641 self.assertEqual(len(fonts), 1)
642 return next(iter(fonts))
643
644 self.assertNotEqual(get_sidebar_font(), test_font)
645 sidebar.update_font()
646 self.assertEqual(get_sidebar_font(), test_font)
647
648 def test_highlight_colors(self):
649 sidebar = self.shell.shell_sidebar

Callers

nothing calls this directly

Calls 5

addCleanupMethod · 0.80
assertNotEqualMethod · 0.80
startMethod · 0.45
update_fontMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected