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)
def test_reflowemptycells(): res = ''.join(reflow(rfec)) assert res == rfecres
def test_reflowqf2(): res = ''.join(reflow(refl2, sentence=True)) assert res == refl2res
def test_reflowqf1(): res = ''.join(reflow(refl)) assert res == reflres
def test_reflowqf(): res = ''.join(reflow(qfdata)) assert res == reflowqfd
def test_reflow0(): res = ''.join(reflow(badtables, join='0')) assert res == badtablereflow