Beispiel #1
0
def test_lurg(tmpdir  #temporary directory for the -lurg converted rest file
              ):
    '''
    This tests rstlisttable, rstuntable, rstreflow, rstreimg.
    '''
    cwd = os.getcwd()
    try:
        with open(os.path.join(os.path.dirname(__file__), 'fixtures',
                               'doc.rest'),
                  encoding='utf-8') as f:
            expected = f.read().replace('\\', '/')
        rstfile = os.path.join(os.path.dirname(__file__),
                               'fixtures/doc/doc.rest')
        os.chdir(tmpdir)
        shutil.copy2(rstfile, 'doc.rest')
        listtable(rstfile='doc.rest', in_place=True, sentence=True)
        untable(rstfile='doc.rest', in_place=True, sentence=True)
        reflow(rstfile='doc.rest', join='0', in_place=True, sentence=True)
        reimg(rstfile='doc.rest', in_place=True, sentence=True)
        with open('doc.rest', encoding='utf-8') as fp:
            got = fp.read()
        assert expected == got.replace('\\', '/')
    finally:
        os.chdir(cwd)
Beispiel #2
0
def test_reflowemptycells():
    res = ''.join(reflow(rfec))
    assert res == rfecres
Beispiel #3
0
def test_reflowqf2():
    res = ''.join(reflow(refl2, sentence=True))
    assert res == refl2res
Beispiel #4
0
def test_reflowqf1():
    res = ''.join(reflow(refl))
    assert res == reflres
Beispiel #5
0
def test_reflowqf():
    res = ''.join(reflow(qfdata))
    assert res == reflowqfd
Beispiel #6
0
def test_reflow0():
    res = ''.join(reflow(badtables, join='0'))
    assert res == badtablereflow