Conditions | 6 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
1 | #!/usr/bin/env python |
||
13 | def render(folder, name): |
||
14 | filepath = os.path.join(folder, name + '.text') |
||
15 | with open(filepath) as f: |
||
16 | content = f.read() |
||
17 | |||
18 | html = m.parse(content) |
||
19 | |||
20 | filepath = os.path.join(folder, name + '.html') |
||
21 | with open(filepath) as f: |
||
22 | result = f.read() |
||
23 | |||
24 | html = re.sub(r'\s', '', html) |
||
25 | result = re.sub(r'\s', '', result) |
||
26 | for i, s in enumerate(html): |
||
27 | if s != result[i]: |
||
28 | begin = max(i - 30, 0) |
||
29 | msg = '\n\n%s\n------Not Equal(%d)------\n%s' % ( |
||
30 | html[begin:i + 30], i, result[begin:i + 30] |
||
31 | ) |
||
32 | raise ValueError(msg) |
||
33 | assert html == result |
||
34 | |||
54 |