Add test for headlines with no content lines.

This commit is contained in:
Sergio Martínez Portela 2020-11-07 00:24:28 +01:00
parent 2372fc597c
commit f08d9428d6
2 changed files with 35 additions and 1 deletions

26
tests/01-simple-2.org Normal file
View File

@ -0,0 +1,26 @@
#+TITLE: 01-Simple-second
#+DESCRIPTION: Simple org file
#+TODO: TODO(t) PAUSED(p) | DONE(d)
* First level
:PROPERTIES:
:ID: 01-simple-first-level-id
:CREATED: [2020-01-01 Wed 01:01]
:END:
First level content
** Second level
:PROPERTIES:
:ID: 01-simple-second-level-id
:END:
Second level content with no indentation
*** Third level with no content
**** Forth level
:PROPERTIES:
:ID: 01-simple-forth-level-id
:END:
Forth level content

View File

@ -40,7 +40,15 @@ class TestSerde(unittest.TestCase):
def test_mimic_write_file_01(self): def test_mimic_write_file_01(self):
"""A goal of this library is to be able to update a file without changing parts not directly modified.""" """A goal of this library is to be able to update a file without changing parts not directly modified."""
with open(os.path.join(DIR, '01-simple.org')) as f: with open(os.path.join(DIR, "01-simple.org")) as f:
orig = f.read()
doc = loads(orig)
self.assertEqual(dumps(doc), orig)
def test_mimic_write_file_01_second(self):
"""A goal of this library is to be able to update a file without changing parts not directly modified."""
with open(os.path.join(DIR, "01-simple-2.org")) as f:
orig = f.read() orig = f.read()
doc = loads(orig) doc = loads(orig)