-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathtest_word.py
More file actions
32 lines (24 loc) · 1.05 KB
/
test_word.py
File metadata and controls
32 lines (24 loc) · 1.05 KB
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
"""Word功能测试模块。
该模块包含对python-office库中Word相关功能的单元测试。
"""
import unittest
from office.api.word import *
from tests.test_utils.comm_utils import *
class TestWechat(unittest.TestCase):
"""Word功能测试类。
该类包含对Word相关API的单元测试方法。
"""
def test_docx2pdf(self):
docx2pdf(path=r'../test_files/docx/demo.docx')
def test_doc2docx(self):
doc2docx(input_path=r'../test_files/word/aaa - 副本.doc', output_path=r'../test_output/word',
output_name='abcd.docx')
# 检查文件是否存在
self.assertTrue(file_exist('../test_output/word/abcd.docx'))
delete_file('../test_output/word/abcd.docx')
def test_docx2doc(self):
docx2doc(input_path=r'../test_output/word/abcd.docx', output_path=r'../test_output/word',
output_name='abce')
# 检查文件是否存在
self.assertTrue(file_exist('../test_output/word/abce.doc'))
delete_file('../test_output/word/abce.doc')