示例#1
0
    def test_stdout(self):
        """ Does the in-process kernel correctly capture IO?
        """
        kernel = InProcessKernel()

        with capture_output() as io:
            kernel.shell.run_cell('print("foo")')
        self.assertEqual(io.stdout, "foo\n")

        kc = BlockingInProcessKernelClient(kernel=kernel)
        kernel.frontends.append(kc)
        kc.execute('print("bar")')
        out, err = assemble_output(kc.iopub_channel)
        self.assertEqual(out, "bar\n")
示例#2
0
    def test_stdout(self):
        """ Does the in-process kernel correctly capture IO?
        """
        kernel = InProcessKernel()

        with capture_output() as io:
            kernel.shell.run_cell('print("foo")')
        self.assertEqual(io.stdout, 'foo\n')

        kc = BlockingInProcessKernelClient(kernel=kernel)
        kernel.frontends.append(kc)
        kc.execute('print("bar")')
        out, err = assemble_output(kc.iopub_channel)
        self.assertEqual(out, 'bar\n')
示例#3
0
 def test_pylab(self):
     """Does %pylab work in the in-process kernel?"""
     kc = self.kc
     kc.execute("%pylab")
     out, err = assemble_output(kc.iopub_channel)
     self.assertIn("matplotlib", out)
示例#4
0
 def test_pylab(self):
     """Does %pylab work in the in-process kernel?"""
     kc = self.kc
     kc.execute('%pylab')
     out, err = assemble_output(kc.iopub_channel)
     self.assertIn('matplotlib', out)