Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 37 lines (28 sloc) 1.02 kb
048bf0a @bjonnh Version 0.03a (lot of changes see ChangeLog for details)
authored
1
2 import PyOrgMode
3 import tempfile
4 import unittest
5
6
7 class TestParser(unittest.TestCase):
8 """Test the org file parser with a simple org structure"""
9
10 def setUp(self):
11 """Parse the org structure from a temporary file"""
12 orgfile = tempfile.NamedTemporaryFile()
13 orgfile.write('\n'.join((
14 '* one',
15 '* two',
16 '** two point one',
17 '* three',
18 '')).encode('UTF-8'))
19 orgfile.flush()
20 self.tree = PyOrgMode.OrgDataStructure()
21 try:
22 self.tree.load_from_file(orgfile.name)
23 finally:
24 orgfile.close()
25
26 def test_has_three_top_level_headings(self):
27 """The example has three top-level headings"""
28 self.assertEqual(len(self.tree.root.content), 3)
29
30 def test_second_item_has_a_subheading(self):
31 """The second top-level heading has one subheading"""
32 self.assertEqual(len(self.tree.root.content[1].content), 1)
33
34
35 if __name__ == '__main__':
36 unittest.main()
Something went wrong with that request. Please try again.