-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathtest_ruiming.py
More file actions
35 lines (27 loc) · 1.56 KB
/
test_ruiming.py
File metadata and controls
35 lines (27 loc) · 1.56 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
33
34
35
"""瑞明功能测试模块。
该模块包含对python-office库中瑞明相关功能的单元测试。
"""
import unittest
from office.api.testApi.ruiming import screen_unmarked_image, change_label_in_xml, screen_without_label_json_file
from tests.test_utils.comm_utils import *
class TestRuiming(unittest.TestCase):
"""瑞明功能测试类。
该类包含对瑞明相关API的单元测试方法。
"""
def test_screen_unmarked_image(self):
screen_unmarked_image(dir_path='../test_files/ruiming/screen_unmarked_image')
# 预期结果:2.jpg被移动到“未标注图片”目录下
def test_change_label_in_xml(self):
# TODO:相对路径问题
change_label_in_xml(dir_path="../test_files/ruiming/change_label_in_xml", old_label="测试", new_label="测试1")
# 预期结果:name标签内容从“测试”改为“测试1”
file_names = get_file_by_suffix('../test_files/ruiming/change_label_in_xml', 'xml')
for file_name in file_names:
names = get_all_name_values('../test_files/ruiming/change_label_in_xml/' + file_name)
self.assertNotIn('测试', names)
# 还原
change_label_in_xml(dir_path="../test_files/ruiming/change_label_in_xml", old_label="测试1", new_label="测试")
def test_screen_without_label_json_file(self):
# TODO:相对路径问题
screen_without_label_json_file(dir_path="../test_files/ruiming/screen_without_label_json_file")
# 预期结果:除1.json外均被移动到”无标签json文件“文件夹中