示例#1
0
def clean_python_kernel(global_python_kernel):
    """
    Takes ``global_python_kernel`` and resets all variables,
    returning the clean kernel.
    """
    R.run_code('%reset -f', global_python_kernel)
    return global_python_kernel
示例#2
0
 def test_ipython_display(self, clean_python_kernel, to):
     s = R.Stitch('', to=to)
     code = dedent('''\
     from IPython import display
     import math
     display.Markdown("$\\alpha^{pi:1.3f}$".format(pi=math.pi))
     ''')
     messages = R.run_code(code, clean_python_kernel)
     wrapped = s.wrap_output('', messages, None)[0]
     assert wrapped['t'] == 'Para'
     assert wrapped['c'][0]['c'][0]['t'] == 'InlineMath'
示例#3
0
 def test_init_python_latex(self, clean_python_kernel):
     R.initialize_kernel('python', clean_python_kernel)
     result = R.run_code(
         'assert pandas.options.display.latex.repr is False',
         clean_python_kernel)
     assert len(result) == 2
示例#4
0
 def test_init_python_pre(self):
     kp = R.kernel_factory('python')
     result = R.run_code(
         'import pandas; assert pandas.options.display.latex.repr is False',
         kp)
     assert len(result) == 1