36 lines
960 B
Python
36 lines
960 B
Python
import snippets
|
|
from io import StringIO
|
|
from eorg import tokens
|
|
from eorg.tokens import Token
|
|
from eorg.parser import parse
|
|
from eorg.generate import html
|
|
|
|
|
|
def test_bullet_block():
|
|
expected = """<ul class="browser-default"><li class="collection-item">Bullet 1</li><li class="collection-item">Bullet 2</li></ul>"""
|
|
result = html(parse(snippets.bullet_plus_snippet).doc)
|
|
assert result.read() == expected
|
|
|
|
|
|
def test_render_results():
|
|
text = StringIO(
|
|
"""
|
|
#+RESULTS:
|
|
[[file:test.png]]
|
|
"""
|
|
)
|
|
expected = [
|
|
Token(tokens.IMAGE, "['file:test.png', '']", attrs=None),
|
|
Token(tokens.TEXT, "\n"),
|
|
]
|
|
doc = parse(text).doc
|
|
assert doc[0].token == tokens.BLANK
|
|
assert len(doc[1].value) == len(expected)
|
|
assert doc[1].token == tokens.RESULTS
|
|
|
|
assert doc[1].value[0] == expected[0]
|
|
assert doc[1].value[1] == expected[1]
|
|
|
|
htmlbody = html(doc).read()
|
|
assert htmlbody == '<img src="test.png"/>\n'
|