Exemple #1
0
def test_si_non_imports():
    x = _read_ex_fi('tests/reprexes/non-imports.py')
    out = reprex(code=x, si=True)
    not_in_x = ['pickledb', 'matplotlib', 'ipython']
    not_in_x = [i + '==' for i in not_in_x]

    mout = _all_match(out, not_in_x)
    for i, j in zip(mout, not_in_x):
        assert not i, '%r found in session info' % j
Exemple #2
0
def test_si_imports():
    x = _read_ex_fi("tests/reprexes/imports.py")
    out = reprex(code=x)
    x_in = [
        'nbconvert', 'asttokens', 'pyimgur', 'stdlib-list', 'ipython', 'pyzmq'
    ]
    x_in = [i + "==" for i in x_in]

    mout = _all_match(out, x_in)
    for i, j in zip(mout, x_in):
        assert i, '%r not found in output' % j
Exemple #3
0
def test_misc_params():
    code = """
    var = "some var"
    var
    """
    out = reprex(_ptxt(code), venue='so', comment='#<>', advertise=True)
    mlst = [
        '    var = "some var"', '#<>',
        'Created on.*by the \[reprexpy package\]'
    ]
    mout = _all_match(out, mlst)
    for i, j in zip(mout, mlst):
        assert i, '%r not found in output' % j
Exemple #4
0
def _reprex_basic(*args, **kargs):
    return reprex(si=False, advertise=False, *args, **kargs)
Exemple #5
0
def test_sphinx_venue():
    x = _read_ex_fi_pair('sphinx-venue')
    out = reprex(code=x[0], venue='sx')
    assert out.splitlines()[0:12] == x[1].splitlines()[0:12]
    assert re.search('    \.\. image:: https://i\.imgur\.com', out)