def test_construction_raises_no_errors(self): widget = InProcessJupyterConsole() self.assertTrue(hasattr(widget, "kernel_manager")) self.assertTrue(hasattr(widget, "kernel_client")) self.assertGreater(len(widget.banner), 0) self._pre_delete_console_cleanup(widget) del widget
def __init__(self, parent): super(JupyterConsole, self).__init__(parent) # layout self.console = InProcessJupyterConsole(self, banner=BANNER, startup_code=STARTUP_CODE) layout = QVBoxLayout() layout.addWidget(self.console) self.setLayout(layout)
def __init__(self, parent): super(JupyterConsole, self).__init__(parent) # layout font = text_font() self.console = InProcessJupyterConsole(self, startup_code=STARTUP_CODE, font_family=font.family(), font_size=font.pointSize()) layout = QVBoxLayout() layout.addWidget(self.console) self.setLayout(layout)
def test_construction_overrides_python_input_with_qinputdialog( self, mock_input): widget = InProcessJupyterConsole() kernel = widget.kernel_manager.kernel kernel.raw_input("prompt") mock_input.assert_called_with("prompt") self._pre_delete_console_cleanup(widget) widget.kernel_manager.shutdown_kernel() del widget
def run(main_window=None): # frame_dockWidget_ipython temp_layout = QVBoxLayout() main_window.ui.frame_dockWidget_ipython.setLayout(temp_layout) main_window.ui.dockWidget_ipython = InProcessJupyterConsole( main_window, startup_code=IPYTHON_STARTUP_CODE) temp_layout.addWidget(main_window.ui.dockWidget_ipython) main_window.ui.splitter_3.setStyleSheet(""" QSplitter::handle { image: url(':/MPL Toolbar/splitter_icon.png'); } """) main_window.ucams = get_ucams() set_default_folder_path(main_window)
def test_construction_with_startup_code_adds_to_banner_and_executes(self): widget = InProcessJupyterConsole(startup_code="x = 1") self.assertTrue("x = 1" in widget.banner) self.assertEquals(1, widget.kernel_manager.kernel.shell.user_ns['x']) del widget
def test_construction_with_banner_replaces_default(self): widget = InProcessJupyterConsole(banner="Hello!") self.assertEquals("Hello!", widget.banner) del widget
def test_construction_raises_no_errors(self): widget = InProcessJupyterConsole() self.assertTrue(hasattr(widget, "kernel_manager")) self.assertTrue(hasattr(widget, "kernel_client")) self.assertTrue(len(widget.banner) > 0) del widget
def test_construction_with_startup_code_adds_to_banner_and_executes(self): widget = InProcessJupyterConsole(startup_code="x = 1") self.assertEqual(1, widget.kernel_manager.kernel.shell.user_ns['x']) self._pre_delete_console_cleanup(widget) widget.kernel_manager.shutdown_kernel() del widget