From f08d9428d61e71fc1669e818777c162fb1b0f161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Sat, 7 Nov 2020 00:24:28 +0100 Subject: [PATCH] Add test for headlines with no content lines. --- tests/01-simple-2.org | 26 ++++++++++++++++++++++++++ tests/test_dom.py | 10 +++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/01-simple-2.org diff --git a/tests/01-simple-2.org b/tests/01-simple-2.org new file mode 100644 index 0000000..42da1c2 --- /dev/null +++ b/tests/01-simple-2.org @@ -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 diff --git a/tests/test_dom.py b/tests/test_dom.py index a0010cf..b8349c8 100644 --- a/tests/test_dom.py +++ b/tests/test_dom.py @@ -40,7 +40,15 @@ class TestSerde(unittest.TestCase): 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.""" - 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() doc = loads(orig)