Add (failing) test for tags property read.
Some checks failed
Some checks failed
This commit is contained in:
parent
bfe60271eb
commit
e0306bf3a5
13
tests/13-tags.org
Normal file
13
tests/13-tags.org
Normal file
@ -0,0 +1,13 @@
|
||||
#+TITLE: 13-Tags
|
||||
#+DESCRIPTION: Simple org file to test tags
|
||||
#+FILETAGS: :filetag:
|
||||
|
||||
* Level 1 :h1tag:
|
||||
:PROPERTIES:
|
||||
:ID: 13-tags
|
||||
:CREATED: [2020-01-01 Wed 01:01]
|
||||
:END:
|
||||
|
||||
** Level2 :h2tag:
|
||||
* Level 1-1 :otherh1tag:
|
||||
** Level2 :otherh2tag:
|
@ -865,6 +865,29 @@ class TestSerde(unittest.TestCase):
|
||||
|
||||
self.assertEqual(dumps(doc), orig)
|
||||
|
||||
def test_mimic_write_file_13(self):
|
||||
with open(os.path.join(DIR, "13-tags.org")) as f:
|
||||
orig = f.read()
|
||||
doc = loads(orig)
|
||||
|
||||
self.assertEqual(dumps(doc), orig)
|
||||
|
||||
def test_tag_property_read_13(self):
|
||||
with open(os.path.join(DIR, "13-tags.org")) as f:
|
||||
orig = f.read()
|
||||
doc = loads(orig)
|
||||
|
||||
self.assertEqual(doc.tags, ['filetag'])
|
||||
|
||||
h1_1, h1_2 = doc.getTopHeadlines()
|
||||
self.assertEqual(sorted(h1_1.tags), ['filetag', 'h1tag'])
|
||||
self.assertEqual(sorted(h1_2.tags), ['filetag', 'otherh1tag'])
|
||||
|
||||
h1_1_h2 = h1_1.children[0]
|
||||
self.assertEqual(sorted(h1_1_h2.tags), ['filetag', 'h1tag', 'h2tag'])
|
||||
|
||||
h1_2_h2 = h1_2.children[0]
|
||||
self.assertEqual(sorted(h1_2_h2.tags), ['filetag', 'otherh1tag', 'otherh2tag'])
|
||||
|
||||
def print_tree(tree, indentation=0, headline=None):
|
||||
for element in tree:
|
||||
|
Loading…
Reference in New Issue
Block a user