Commits

Gabriele Lanaro committed aa9225a

test for parsing first elements: headline; level; childs;

  • Participants
  • Parent commits 2b5c265

Comments (0)

Files changed (1)

pyorg/tests/test_parser.py

 from attest import Assert, Tests
-from pyorg.parser import splitheads, maxhead
+from pyorg.parser import splitheads, maxhead, Node
 
 tpars = Tests()
 
     """
     headings = splitheads(SAMPLE)
     Assert(headings[0]) == H1
+    Assert(splitheads('')) == []
+    Assert(splitheads(H1)) == [H1]
 
 @tpars.test
 def test_maxhead():
     Assert(maxhead(SAMPLE)) == 1
+    Assert(maxhead(H1)) == 1
+
+@tpars.test
+def test_node():
+    node = Node(H1)
+    Assert(node.headline) == '* Heading 1'
+    Assert(node.level) == 1
+    
+
+    Assert(node.childs[0].text) == '** Heading 1.1\ntext H1.1'
 if __name__ == '__main__':
     tpars.run()