def make_mock_editor_window(self): """Create a mock EditorWindow instance.""" editwin = NonCallableMagicMock() # isinstance(editwin, PyShell) must be true for Squeezer to enable # auto-squeezing; in practice this will always be true editwin.__class__ = PyShell return editwin
def make_mock_editor_window(self, with_text_widget=False): """Create a mock EditorWindow instance.""" editwin = NonCallableMagicMock() # isinstance(editwin, PyShell) must be true for Squeezer to enable # auto-squeezing; in practice this will always be true. editwin.__class__ = PyShell if with_text_widget: editwin.root = get_test_tk_root(self) text_widget = self.make_text_widget(root=editwin.root) editwin.text = editwin.per.bottom = text_widget return editwin