示例#1
0
def test_untable1():
    def rowfun(row, nColumns, org, islast, withheader):
        for rc in row:
            for r in rc:
                assert 'And some more text' not in r
        yield from org

    untable(qfdata, rowfun)
示例#2
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)
示例#3
0
def test_untable0(request):
    res = '\n'.join(untable(undata))
    assert res == undatares
示例#4
0
def test_untable2():
    res = '\n'.join(untable(qfdata))
    assert res == qfdatauntable