40 lines
1.5 KiB
Python
Executable File
40 lines
1.5 KiB
Python
Executable File
import os
|
|
import pytest
|
|
from eorg.parser import parse
|
|
from eorg.generate import html
|
|
|
|
|
|
def test_basic():
|
|
with open(os.path.abspath("./tests/fixtures/test.org"), "r") as fp:
|
|
doc = parse(fp)
|
|
assert doc.title != ""
|
|
assert doc.author != ""
|
|
assert len(doc) == 20
|
|
|
|
|
|
def test_body():
|
|
with open(os.path.abspath("./tests/fixtures/test.org"), "r") as fp:
|
|
doc = parse(fp)
|
|
assert len([i for i in doc.body()]) > 0
|
|
|
|
|
|
def test_html_output():
|
|
with open(os.path.abspath("./tests/fixtures/test.org"), "r") as fp:
|
|
doc = parse(fp)
|
|
htmlbody = html(doc).read()
|
|
print(htmlbody)
|
|
assert (
|
|
htmlbody
|
|
== """<h1> Header 1</h1>
|
|
<h2> Sub Header 1</h2>
|
|
<p class="flow-text">body <code>text</code>
|
|
over multiple <b>lines</b>
|
|
</p><h2> Sub Header 2</h2>
|
|
<h1> Header 2</h1>
|
|
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">some</span> <span class="nv">lispy</span> <span class="nv">code</span><span class="p">)</span>
|
|
</pre></div>
|
|
</td></tr></table><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="p">(</span><span class="nv">test</span> <span class="nv">code</span><span class="p">)</span>
|
|
</pre></div>
|
|
</td></tr></table>"""
|
|
)
|