Skip to content

Commit 0cec158

Browse files
author
Jason Ward
committed
refs #29: updated the xml based tests for the new expected html
1 parent de04609 commit 0cec158

File tree

3 files changed

+60
-94
lines changed

3 files changed

+60
-94
lines changed

pydocx/tests/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
)
1212
from unittest import TestCase
1313

14+
STYLE = '<style>.insert {color:green;}.delete {color:red;text-decoration:line-through;}.center {text-align:center;}.right {text-align:right;}.left {text-align:left;}.comment {color:blue;}body {width:0px;margin:0px auto;}</style>' # noqa
15+
16+
BASE_HTML = '''
17+
<html>
18+
<head>
19+
%s
20+
</head>
21+
<body>%%s</body>
22+
</html>
23+
''' % STYLE
24+
1425

1526
def assert_html_equal(actual_html, expected_html):
1627
assert collapse_html(
@@ -99,8 +110,8 @@ def _parse_styles(self):
99110
'1': 'decimal',
100111
},
101112
'2': {
102-
'0': 'none',
103-
'1': 'none',
113+
'0': 'lowerLetter',
114+
'1': 'lowerLetter',
104115
},
105116
}
106117

@@ -136,4 +147,4 @@ def test_expected_output(self):
136147
numbering_dict=self.numbering_dict,
137148
).parsed
138149

139-
assert_html_equal(html, self.expected_output)
150+
assert_html_equal(html, BASE_HTML % self.expected_output)

pydocx/tests/test_docx.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@
66
from nose.plugins.skip import SkipTest
77
#from nose.tools import assert_raises
88

9-
from pydocx.tests import assert_html_equal
9+
from pydocx.tests import assert_html_equal, BASE_HTML
1010
from pydocx.parsers.Docx2Html import Docx2Html
1111

1212

1313
def convert(path):
1414
return Docx2Html(path).parsed
1515

16-
STYLE = '<style>.insert {color:green;}.delete {color:red;text-decoration:line-through;}.center {text-align:center;}.right {text-align:right;}.left {text-align:left;}.comment {color:blue;}body {width:0px;margin:0px auto;}</style>' # noqa
17-
18-
BASE_HTML = '''
19-
<html>
20-
<head>
21-
%s
22-
</head>
23-
<body>%%s</body>
24-
</html>
25-
''' % STYLE
26-
2716

2817
def test_extract_html():
2918
file_path = path.join(

0 commit comments

Comments
 (0)