Add base support for markup tests.
This commit is contained in:
parent
d23ee1adba
commit
0dab7e4703
6 changed files with 209 additions and 22 deletions
|
@ -4,7 +4,8 @@ import unittest
|
|||
from datetime import datetime as DT
|
||||
|
||||
from org_dom import dumps, load, loads
|
||||
from utils.dom_assertions import HL, Dom
|
||||
from utils.dom_assertions import (BOLD, CODE, HL, ITALIC, SPAN, STRIKE,
|
||||
UNDERLINED, VERBATIM, Dom)
|
||||
|
||||
DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
@ -23,15 +24,15 @@ class TestSerde(unittest.TestCase):
|
|||
('ID', '01-simple-first-level-id'),
|
||||
('CREATED', DT(2020, 1, 1, 1, 1)),
|
||||
],
|
||||
content='First level content',
|
||||
content=' First level content\n',
|
||||
children=[
|
||||
HL('Second level',
|
||||
props=[('ID', '01-simple-second-level-id')],
|
||||
content='Second level content',
|
||||
content='\n Second level content\n',
|
||||
children=[
|
||||
HL('Third level',
|
||||
props=[('ID', '01-simple-third-level-id')],
|
||||
content='Third level content')
|
||||
content='\n Third level content\n')
|
||||
])
|
||||
])))
|
||||
|
||||
|
@ -44,3 +45,38 @@ class TestSerde(unittest.TestCase):
|
|||
doc = loads(orig)
|
||||
|
||||
self.assertEqual(dumps(doc), orig)
|
||||
|
||||
def test_markup_file_02(self):
|
||||
with open(os.path.join(DIR, '02-markup.org')) as f:
|
||||
doc = load(f)
|
||||
|
||||
ex = Dom(props=[('TITLE', '02-Markup'),
|
||||
('DESCRIPTION', 'Simple org file to test markup'),
|
||||
('TODO', 'TODO(t) PAUSED(p) | DONE(d)')],
|
||||
children=(HL('First level',
|
||||
props=[
|
||||
('ID', '02-markup-first-level-id'),
|
||||
('CREATED', DT(2020, 1, 1, 1, 1)),
|
||||
],
|
||||
content=[
|
||||
SPAN(" This is a ", BOLD("bold phrase"),
|
||||
"."),
|
||||
SPAN(""),
|
||||
SPAN(" This is a ",
|
||||
VERBATIM("verbatim phrase"), "."),
|
||||
SPAN(""),
|
||||
SPAN(" This is a ", ITALIC("italic phrase"),
|
||||
"."),
|
||||
SPAN(""),
|
||||
SPAN(" This is a ",
|
||||
STRIKE("strike-through phrase"), "."),
|
||||
SPAN(""),
|
||||
SPAN(" This is a ",
|
||||
UNDERLINED("underlined phrase"), "."),
|
||||
SPAN(""),
|
||||
SPAN(" This is a ", CODE("code phrase"),
|
||||
"."),
|
||||
SPAN(""),
|
||||
])))
|
||||
|
||||
ex.assert_matches(self, doc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue