forked from kahi/sublime-django-click
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.py
42 lines (37 loc) · 1.59 KB
/
tests.py
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
import unittest
try:
from utils import parse_tag
except ImportError:
from .utils import parse_tag
class MatchTests(unittest.TestCase):
def test_parse_tag(self):
cases = [
(('extends', ['_base/base.html']),
"{% extends '_base/base.html' %}"),
(('extends', ['_base/base.html']),
"{%extends '_base/base.html' %}"),
(('extends', ['ur base/are belong to us.html']),
"{%extends 'ur base/are belong to us.html' %}"),
(('include', ['_base/base.html']),
'{% include "_base/base.html" %}'),
(('include', ['_base/base.html']),
'{% include "_base/base.html" %}'),
(('include', ['_base/base.html']),
'{% include "_base/base.html"%}'),
(('include', ['_base/base.html']),
'{%include "_base/base.html"%}'),
(('include', ['_base/base.html']),
' {%include "_base/base.html"%}'),
(('include', ['_base/base.html']),
'hnidopich{%include "_base/base.html"%} '),
(('include', ['lorem-ipsum/__dolorem']),
" {% include 'lorem-ipsum/__dolorem' %}"),
(('includeblocks', ['_base/base.html', '_base templates/base.html']),
"{% includeblocks '_base/base.html' '_base templates/base.html' %}"),
(('include', ['base/base.html']),
"{% include 'base/base.html' with foo='bar' %}")
]
for exp, line in cases:
self.assertEqual(exp, parse_tag(line))
if __name__ == '__main__':
unittest.main()