From 9d87d533f45ed65b1953ac884685e57a92b3704e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Mon, 16 Oct 2023 23:32:18 +0200 Subject: [PATCH] Add (failing) test --- tests/12-headlines-with-skip-levels.org | 22 ++++++++++++++++++++++ tests/test_org.py | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/12-headlines-with-skip-levels.org diff --git a/tests/12-headlines-with-skip-levels.org b/tests/12-headlines-with-skip-levels.org new file mode 100644 index 0000000..17008be --- /dev/null +++ b/tests/12-headlines-with-skip-levels.org @@ -0,0 +1,22 @@ +#+TITLE: 12-Headlines with skip levels +#+DESCRIPTION: Simple org file to test Headlines with skip levels +#+TODO: TODO(t) PAUSED(p) | DONE(d) + +* Level 1 + :PROPERTIES: + :ID: 12-headlines-with-skip-levels + :CREATED: [2020-01-01 Wed 01:01] + :END: + +*** Level 3 + +*** Level 3-2 + +* Level 1-2 + +** Level 2 + +**** Level 4 + +*** Level3 + diff --git a/tests/test_org.py b/tests/test_org.py index 2f4200d..6981b76 100644 --- a/tests/test_org.py +++ b/tests/test_org.py @@ -757,6 +757,13 @@ class TestSerde(unittest.TestCase): self.assertEqual(children[3].children[0].content, ['2.1']) self.assertEqual(children[3].children[1].content, ['2.2']) + def test_mimic_write_file_12(self): + with open(os.path.join(DIR, "12-headlines-with-skip-levels.org")) as f: + orig = f.read() + doc = loads(orig) + + self.assertEqual(dumps(doc), orig) + def print_tree(tree, indentation=0, headline=None): for element in tree: