-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplates_test.py
59 lines (42 loc) · 1.66 KB
/
templates_test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
import unittest
from hayaku_templates import expand_value
from hayaku_probe import extract
class ExpandValueTests(unittest.TestCase):
def setUp(self):
self.opts = {
'hayaku_CSS_default_unit': 'px',
'hayaku_CSS_default_unit_decimal': 'em',
}
def test_0(self):
self.assertEqual(expand_value(extract('z8'), self.opts), '8')
def test_1(self):
self.assertEqual(expand_value(extract('zi12'), self.opts), '12')
# TODO: что делать для w0.0 w.0 w0.p w.0p ...
def test_2(self):
self.assertEqual(expand_value(extract('w0'), self.opts), '0')
def test_3(self):
self.assertEqual(expand_value(extract('w0p'), self.opts), '0')
def test_4(self):
self.assertEqual(expand_value(extract('w0px'), self.opts), '0')
@unittest.skip("")
def test_5(self):
self.assertEqual(expand_value(extract('w'), self.opts), '[100%]')
def test_6(self):
self.assertEqual(expand_value(extract('w10%')), '10%')
@unittest.skip("")
def test_7(self):
self.assertEqual(expand_value(extract('w10perc'), self.opts), '10%')
def test_8(self):
self.assertEqual(expand_value(extract('vat')), 'top')
# Тесты 9 и 10 не должены генерировать ошибки
@unittest.skip("")
def test_9(self):
self.assertEqual(expand_value(extract('w')), '[100%]')
@unittest.skip("")
def test_10(self):
self.assertEqual(expand_value(extract('w'), {}), '[100%]')
def test_11(self):
self.assertEqual(expand_value(extract('c#')), '#')
if __name__ == '__main__':
unittest.main()