-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·56 lines (47 loc) · 1.54 KB
/
test.py
File metadata and controls
executable file
·56 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2017 jianglin
# File Name: test.py
# Author: jianglin
# Email: xiyang0807@gmail.com
# Created: 2017-03-16 16:28:32 (CST)
# Last Update: Thursday 2020-02-06 14:32:51 (CST)
# By:
# Description:
# **************************************************************************
import unittest
from orgpython import Block
TEXT = '''* Heading1
** Heading2
*** Heading3.1
*bold* bold* *bold\* \*bold\* \*bold*
**italic** italic** **italic\** \**italic\** \**italic**
=code= code= =code\= \=code\= \=code=
~code~ code~ ~code\~ \~code\~ \~cod~
*** Heading3.2
[[link][url]]
'''
class TestOrg(unittest.TestCase):
def test_heading(self):
text = "* TODO heading :TAG1:TAG2:"
b = Block(text)
b.init()
heading = b.children[0]
self.assertEqual(heading.title, "heading")
self.assertEqual(heading.stars, 1)
self.assertEqual(heading.tags, ["TAG1", "TAG2"])
self.assertEqual(heading.keyword, "TODO")
text = "* [#B] heading :TAG1:TAG2:"
b = Block(text)
b.init()
heading = b.children[0]
self.assertEqual(heading.title, "heading")
self.assertEqual(heading.stars, 1)
self.assertEqual(heading.tags, ["TAG1", "TAG2"])
self.assertEqual(heading.keyword, None)
self.assertEqual(heading.priority, "[#B]")
def test_src(self):
pass
if __name__ == '__main__':
unittest.main()