Commits

Gabriele Lanaro committed 4243507

first parsers tests

Comments (0)

Files changed (1)

pyorg/tests/test_parser.py

+from attest import Assert, Tests
+from pyorg.parser import splitheads, maxhead
+
+tpars = Tests()
+
+H1 = """* Heading 1
+text H1
+** Heading 1.1
+text H1.1
+"""
+ 
+H2 = """* Heading 2
+text H2
+** Heading 2.1
+text H2.1
+"""
+
+SAMPLE = ''.join([H1,H2])
+
+@tpars.test
+def test_splitting():
+    """Splitting the text in the major sections
+    """
+    headings = splitheads(SAMPLE)
+    Assert(headings[0]) == H1
+
+@tpars.test
+def test_maxhead():
+    Assert(maxhead(SAMPLE)) == 1
+if __name__ == '__main__':
+    tpars.run()