-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_tex2docx.py
63 lines (54 loc) · 1.9 KB
/
test_tex2docx.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
60
61
62
63
import unittest
from tex2docx import LatexToWordConverter
class TestLatexToWordConverter(unittest.TestCase):
def setUp(self):
# config for tests/en
self.en_config = {
"input_texfile": "./en/main.tex",
"output_docxfile": "./en/main.docx",
"reference_docfile": "../my_temp.docx",
"cslfile": "../ieee.csl",
"bibfile": "./ref.bib",
"debug": True,
}
self.en_chapter_config = {
"input_texfile": "./en_chapter/main.tex",
"output_docxfile": "./en_chapter/main.docx",
"reference_docfile": "../my_temp.docx",
"cslfile": "../ieee.csl",
"bibfile": "./ref.bib",
"debug": True,
}
self.en_include_config = {
"input_texfile": "./en_include/main.tex",
"output_docxfile": "./en_include/main.docx",
"cslfile": "../ieee.csl",
"bibfile": "./ref.bib",
"debug": True,
}
# config for tests/zh
self.zh_config = {
"input_texfile": "./zh/main.tex",
"output_docxfile": "./zh/main.docx",
"bibfile": "./ref.bib",
"fix_table": True,
"debug": False,
}
def test_convert_en(self):
# test convert en
converter = LatexToWordConverter(**self.en_config)
converter.convert()
def test_convert_en_chapter(self):
# test convert en_chapter
converter = LatexToWordConverter(**self.en_chapter_config)
converter.convert()
def test_convert_en_include(self):
# test convert en_include
converter = LatexToWordConverter(**self.en_include_config)
converter.convert()
def test_convert_zh(self):
# test convert zh
converter = LatexToWordConverter(**self.zh_config)
converter.convert()
if __name__ == "__main__":
unittest.main()