From cdb379fb7f9207517551479ce7c4b9bb3be5f10c Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Wed, 16 Jul 2025 09:45:37 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=A7=AA=20test:=20=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/test/conftest.py | 43 ---- .../integration/views/test_graph_views.py | 214 ----------------- .../test_layout_hierarchy_controller.py | 44 ---- .../test_match_nodes_controller.py | 76 ------ .../test/unit/utils/test_graph_utils.py | 222 ------------------ 5 files changed, 599 deletions(-) delete mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py delete mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/integration/views/test_graph_views.py delete mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_layout_hierarchy_controller.py delete mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py delete mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_graph_utils.py diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py deleted file mode 100644 index 93be4c86c..000000000 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2025, Huawei Technologies. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import pytest -from server.app.utils.global_state import GraphState -from data.test_case_factory import TestCaseFactory - - -@pytest.fixture(scope="function", autouse=True) -def reset_global_state(request): - """每个测试后重置全局状态""" - # 执行测试 - yield - # 恢复原始状态 - if request.module.__name__ != "test_graph_views": - GraphState.init_defaults() - - -def pytest_addoption(parser): - """添加自定义命令行选项""" - parser.addoption("--runslow", action="store_true", default=False, - help="Run slow tests") - parser.addoption("--dataset", action="store", default="small", - help="Test dataset size: small|medium|large") - - -@pytest.fixture -def test_case_factory(): - """提供测试用例工厂实例""" - return TestCaseFactory diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/integration/views/test_graph_views.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/integration/views/test_graph_views.py deleted file mode 100644 index 3c58ceb5c..000000000 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/integration/views/test_graph_views.py +++ /dev/null @@ -1,214 +0,0 @@ -# Copyright (c) 2025, Huawei Technologies. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import pytest -import json -from types import SimpleNamespace -from pathlib import Path -from werkzeug.wrappers import Request -from werkzeug.test import EnvironBuilder -from data.test_case_factory import TestCaseFactory -from server.app.utils.global_state import GraphState -from server.app.views.graph_views import GraphView - - -@pytest.mark.integration -class TestGraphViews: - - captured = SimpleNamespace(status=None, headers=None) - - mock_vis_tag = 'mock_compare_resnet_data' - - @staticmethod - def start_response(status, response_headers): - TestGraphViews.captured.status = status - TestGraphViews.captured.headers = dict(response_headers) - return lambda x: None # 必须返回一个 writer callable - - @staticmethod - def create_mock_request(path="/meta"): - builder = EnvironBuilder(path=path) - return builder.get_environ() - - @pytest.mark.parametrize("test_case", - [ - {"case_id": "1", - "description": "测试index.html", - "input": "/data/plugin/graph_ascend/index.html", - "excepted": "200 OK" - }, - {"case_id": "2", - "description": "测试index.js", - "input": "/data/plugin/graph_ascend/index.js", - "excepted": "200 OK" - }, - {"case_id": "3", - "description": "测试404文件", - "input": "/data/plugin/graph_ascend/index.css", - "excepted": "404 NOT FOUND" - }, - - ], ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_static_file_route(self, test_case): - request = TestGraphViews.create_mock_request(test_case['input']) - excepted = test_case['excepted'] - GraphView.static_file_route(request, TestGraphViews.start_response) - assert TestGraphViews.captured.status == excepted - - @pytest.mark.parametrize("test_case", - [ - {"case_id": "1", - "description": "test_load_meta_dir", - "excepted":{'data': {'st_test_cases': ['mock_compare_resnet_data']}, 'error': []} - } - ], - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_load_meta_dir(self, test_case): - logdir = Path(__file__).resolve().parent.parent.parent / 'data' / 'st_test_cases' - GraphState.set_global_value('logdir', str(logdir)) - # 构造请求 - request = TestGraphViews.create_mock_request("/data/plugin/graph_ascend/load_meta_dir") - response_iter = GraphView.load_meta_dir(request, TestGraphViews.start_response) - excepted = test_case['excepted'] - # 获取响应内容 - response_body = json.loads(b''.join(response_iter).decode('utf-8')) - assert response_body == excepted - assert TestGraphViews.captured.status == "200 OK" - assert TestGraphViews.captured.headers["Content-Type"] == "application/json" - - @pytest.mark.parametrize("test_case", [{"case_id": "2", "description": "test_load_graph_data"}], ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_load_graph_data(self, test_case): - request = TestGraphViews.create_mock_request(f"/data/plugin/graph_ascend/load_graph_data?run=st_test_cases&tag={TestGraphViews.mock_vis_tag}") - response_iter = GraphView.load_graph_data(request, TestGraphViews.start_response) - response_body = b''.join(response_iter) - runs = GraphState.get_global_value('runs') - current_run = GraphState.get_global_value('current_run') - current_tag = GraphState.get_global_value('current_tag') - assert current_run == runs.get('st_test_cases') - assert current_tag == TestGraphViews.mock_vis_tag - assert TestGraphViews.captured.status == "200 OK" - assert TestGraphViews.captured.headers["Content-Type"] == "text/event-stream; charset=utf-8" - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_load_graph_config_info_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_load_graph_config_info(self, test_case): - request = TestGraphViews.create_mock_request(f"/data/plugin/graph_ascend/load_graph_config_info?run=st_test_cases&tag={TestGraphViews.mock_vis_tag}") - response_iter = GraphView.load_graph_config_info(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - excepted = test_case['expected'] - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_load_graph_all_node_list_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_load_graph_all_node_list(self, test_case): - request = TestGraphViews.create_mock_request(f"/data/plugin/graph_ascend/load_graph_all_node_list?run=st_test_cases&tag={TestGraphViews.mock_vis_tag}") - response_iter = GraphView.load_graph_all_node_list(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - excepted = test_case['expected'] - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_change_node_expand_state_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_change_node_expand_state(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.change_node_expand_state(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_add_match_nodes_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_add_match_nodes(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.add_match_nodes(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_update_hierarchy_data_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_update_hierarchy_data(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.update_hierarchy_data(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", [ - { - "case_id": "1", - "description": "测试save_matched_relations接口", - "expected": {"success": True, "data": "mock_compare_resnet_data.vis.config"} - - } - ], ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_save_matched_relations(self, test_case): - request = TestGraphViews.create_mock_request("/data/plugin/graph_ascend/saveMatchedRelations?metaData={\"run\":\"st_test_cases\",\"tag\":\"mock_compare_resnet_data\"}") - response_iter = GraphView.save_matched_relations(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - excepted = test_case['expected'] - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_add_match_nodes_by_config_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_add_match_nodes_by_config(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.add_match_nodes_by_config(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_delete_match_nodes_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_delete_match_nodes(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.delete_match_nodes(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_update_colors_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_update_colors(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.update_colors(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_test_get_node_info_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_get_node_info(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.get_node_info(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - - @pytest.mark.parametrize("test_case", [ - { - "case_id": "1", - "description": "测试save_data接口", - "input": "/data/plugin/graph_ascend/saveData?metaData={\"run\":\"st_test_cases\",\"tag\":\"mock_compare_resnet_data\"}", - "expected": {"success": True} - } - ], ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_save_data(self, test_case): - input = test_case['input'] - excepted = test_case['expected'] - request = TestGraphViews.create_mock_request(input) - response_iter = GraphView.save_data(request, TestGraphViews.start_response) - response_body = b''.join(response_iter).decode('utf-8') - assert response_body == json.dumps(excepted) - diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_layout_hierarchy_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_layout_hierarchy_controller.py deleted file mode 100644 index 2ef561d69..000000000 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_layout_hierarchy_controller.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2025, Huawei Technologies. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import pytest -from data.test_case_factory import TestCaseFactory -from server.app.utils.global_state import SINGLE -from server.app.controllers.layout_hierarchy_controller import LayoutHierarchyController - - -@pytest.mark.unit -class TestLayoutHierarchyController: - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_change_expand_state_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_change_expand_state(self, test_case): - graph_type = test_case['input']['graph_type'] - if graph_type == SINGLE: - test_case['input']['graph'] = TestCaseFactory.load_single_graph_test_data() - else: - test_case['input']['graph'] = TestCaseFactory.load_compare_graph_test_data().get(graph_type, {}) - node_name, graph_type, graph, micro_step = test_case['input'].values() - excepted = test_case['expected'] - actual = LayoutHierarchyController.change_expand_state(node_name, graph_type, graph, micro_step) - assert actual == excepted - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_update_hierarchy_data_cases(), ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_update_hierarchy_data(self, test_case): - graph_type = test_case['input']['graph_type'] - excepted = test_case['expected'] - actual = LayoutHierarchyController.update_hierarchy_data(graph_type) - assert actual == excepted - \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py deleted file mode 100644 index a677b968b..000000000 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (c) 2025, Huawei Technologies. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import pytest - -from server.app.controllers.match_nodes_controller import MatchNodesController -from server.app.utils.global_state import GraphState -from data.test_case_factory import TestCaseFactory - - -@pytest.mark.unit -class TestMatchNodesController: - """测试匹配节点功能""" - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_cases(), - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_process_task_add(self, test_case): - """测试添加节点功能""" - graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() - expected = test_case['expected'] - actual = MatchNodesController.process_task_add(graph_data, npu_node_name, bench_node_name, task) - assert actual == expected - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_delete_cases(), - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_process_task_delete(self, test_case): - """测试删除节点功能""" - if(test_case.get('config', None)): - GraphState.set_global_value("config_data", test_case['config']) - graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() - expected = test_case['expected'] - actual = MatchNodesController.process_task_delete(graph_data, npu_node_name, bench_node_name, task) - assert actual == expected - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_child_layer_cases(), - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_process_task_add_child_layer(self, test_case): - """测试添加子节点层功能""" - graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() - excepted = test_case['expected'] - actual = MatchNodesController.process_task_add_child_layer(graph_data, npu_node_name, bench_node_name, task) - assert actual == excepted - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_delete_child_layer_cases(), - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_process_task_delete_child_layer(self, test_case): - """测试删除子节点层功能""" - if(test_case.get('config', None)): - GraphState.set_global_value("config_data", test_case['config']) - graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() - excepted = test_case['expected'] - actual = MatchNodesController.process_task_delete_child_layer(graph_data, npu_node_name, bench_node_name, task) - assert actual == excepted - - @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_child_layer_by_config_cases(), - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_process_task_add_child_layer_by_config(self, test_case): - """测试根据配置文件添加子节点层功能""" - graph_data, match_node_links, task = test_case['input'].values() - excepted = test_case['expected'] - actual = MatchNodesController.process_task_add_child_layer_by_config(graph_data, match_node_links, task) - assert actual == excepted - diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_graph_utils.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_graph_utils.py deleted file mode 100644 index 4a0306169..000000000 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_graph_utils.py +++ /dev/null @@ -1,222 +0,0 @@ -# Copyright (c) 2025, Huawei Technologies. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== - -import pytest -from server.app.utils.graph_utils import GraphUtils - - -class TestGraphUtils: - - @pytest.mark.parametrize("test_case", - [ - { - "case_id": "1", - "description": "正常的多层节点 A -> B -> C", - "input": { - "graph_data": { - "node": { - "C": {"upnode": "B"}, - "B": {"upnode": "A"}, - "A": {"upnode": None} - } - }, - "node_name": "C" - }, - "expected": ["A", "B", "C"] - }, - { - "case_id": "2", - "description": "单一节点无上级", - "input": { - "graph_data": { - "node": { - "A": {"upnode": None} - } - }, - "node_name": "A" - }, - "expected": ["A"] - }, - { - "case_id": "3", - "description": "节点不存在于图中", - "input": { - "graph_data": { - "node": { - "A": {"upnode": None} - } - }, - "node_name": "B" - }, - "expected": ["B"] - }, - { - "case_id": "4", - "description": "图为空", - "input": { - "graph_data": {}, - "node_name": "A" - }, - "expected": [] - }, - { - "case_id": "5", - "description": "节点名为空", - "input": { - "graph_data": { - "node": { - "A": {"upnode": None} - } - }, - "node_name": "" - }, - "expected": [] - } - ], - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_get_parent_node_list(self, test_case): - graph_data, node_name = test_case['input'].values() - expected = test_case['expected'] - actual = GraphUtils.get_parent_node_list(graph_data, node_name) - assert actual == expected - - @pytest.mark.parametrize("test_case", - [ - { - "case_id": "1", - "description": "数字大小比较,10 大于 2", - "input": {"a": "file_10", "b": "file_2"}, - "expected": 1 - }, - { - "case_id": "2", - "description": "相同前缀,数字部分较小", - "input": {"a": "item_3_part", "b": "item_12_part"}, - "expected":-1 - }, - { - "case_id": "3", - "description": "路径比较,a/b/c 小于 a/b/d", - "input": {"a": "a/b/c", "b": "a/b/d"}, - "expected":-1 - }, - { - "case_id": "4", - "description": "混合路径和下划线分隔,等价内容", - "input": {"a": "a_b_1", "b": "a/b/1"}, - "expected": 0 - }, - { - "case_id": "5", - "description": "子路径多一级,a/b 小于 a/b/c", - "input": {"a": "a/b", "b": "a/b/c"}, - "expected":-1 - }, - { - "case_id": "6", - "description": "数字 vs 字母,数字优先", - "input": {"a": "file_1", "b": "file_a"}, - "expected":-1 - }, - { - "case_id": "7", - "description": "完全相同", - "input": {"a": "dir/subdir_10/file_5", "b": "dir/subdir_10/file_5"}, - "expected": 0 - }, - { - "case_id": "8", - "description": "字母 vs 数字,字母在后", - "input": {"a": "a2b", "b": "a10"}, - "expected":-1 - } - ], - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_compare_tag_names(self, test_case): - - def normalize(val: int) -> int: - return 0 if val == 0 else (1 if val > 0 else -1) - - a, b = test_case['input'].values() - expected = test_case['expected'] - actual = GraphUtils.compare_tag_names(a, b) - assert normalize(actual) == expected - - @pytest.mark.parametrize("test_case", - [ - { - "case_id": "1", - "description": "输入为 0 字节", - "input": {"size_bytes": 0}, - "expected": "0 B" - }, - { - "case_id": "2", - "description": "输入为字节(小于 1KB)", - "input": {"size_bytes": 512}, - "expected": "512.00 B" - }, - { - "case_id": "3", - "description": "输入为 1KB", - "input": {"size_bytes": 1024}, - "expected": "1.00 KB" - }, - { - "case_id": "4", - "description": "输入为 1MB", - "input": {"size_bytes": 1024 * 1024}, - "expected": "1.00 MB" - }, - { - "case_id": "5", - "description": "输入为 1.5MB", - "input": {"size_bytes": 1.5 * 1024 * 1024}, - "expected": "1.50 MB" - }, - { - "case_id": "6", - "description": "输入为 1GB,保留 3 位小数", - "input": {"size_bytes": 1024 ** 3, "decimal_places": 3}, - "expected": "1.000 GB" - }, - { - "case_id": "7", - "description": "输入为 2TB", - "input": {"size_bytes": 2 * 1024 ** 4}, - "expected": "2.00 TB" - }, - { - "case_id": "8", - "description": "输入为浮点字节数", - "input": {"size_bytes": 12345678.9}, - "expected": "11.77 MB" - }, - { - "case_id": "9", - "description": "输入为 PB 范围", - "input": {"size_bytes": 1.2 * 1024 ** 5}, - "expected": "1.20 PB" - } - ], - ids=lambda c: f"{c['case_id']}:{c['description']}") - def test_bytes_to_human_readable(self, test_case): - size_bytes = test_case["input"]["size_bytes"] - decimal_places = test_case["input"].get("decimal_places", 2) - expected = test_case['expected'] - actual = GraphUtils.bytes_to_human_readable(size_bytes, decimal_places) - assert actual == expected - -- Gitee From 8ad2b897313aff4d4100a56dc5206b5d71809101 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Wed, 16 Jul 2025 10:17:53 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20code=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/app/controllers/match_nodes_controller.py | 8 ++++---- .../tb_graph_ascend/test/data/test_case_factory.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py index f5a01f0e1..0b7e955c2 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py @@ -33,10 +33,10 @@ class MatchNodesController: @staticmethod def process_task_add(graph_data, npu_node_name, bench_node_name, task): if not MatchNodesController.is_same_node_type(graph_data, npu_node_name, bench_node_name): - return { - 'success': False, - 'error': '节点类型不一致,无法添加匹配关系' - } + return { + 'success': False, + 'error': '节点类型不一致,无法添加匹配关系' + } result = {} if task == 'md5': diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py index 9e13bb431..5a49fa744 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py @@ -60,9 +60,9 @@ class TestCaseFactory: return cls._load_ut_cases('test_layout_hierarchy_controller/mock_compare_statis_graph.vis') @classmethod - def _load_ut_cases(cls, filename): + def _load_ut_cases(cls, file_name): """从JSON文件加载测试用例""" - path = os.path.join(cls.UT_CASE_DIR, filename) + path = os.path.join(cls.UT_CASE_DIR, file_name) with open(path, 'r', encoding='utf-8') as f: return json.load(f) -- Gitee From 028bda12f4384628d4373b7177306022552cc98a Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Wed, 16 Jul 2025 15:26:12 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20code=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/test/data/test_case_factory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py index 5a49fa744..79d2b9085 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py @@ -108,8 +108,8 @@ class TestCaseFactory: return cls._load_st_cases('mock_compare_resnet_data.vis') @classmethod - def _load_st_cases(cls, filename): + def load_st_cases(cls, file_name): """从JSON文件加载测试用例""" - path = os.path.join(cls.ST_CASE_DIR, filename) + path = os.path.join(cls.ST_CASE_DIR, file_name) with open(path, 'r', encoding='utf-8') as f: return json.load(f) -- Gitee From 548effa5e9daa783de5e39f46ded10c0603187ee Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Wed, 16 Jul 2025 15:38:02 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20code=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/test/data/test_case_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py index 79d2b9085..81f789cf7 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py @@ -60,7 +60,7 @@ class TestCaseFactory: return cls._load_ut_cases('test_layout_hierarchy_controller/mock_compare_statis_graph.vis') @classmethod - def _load_ut_cases(cls, file_name): + def load_ut_cases(cls, file_name): """从JSON文件加载测试用例""" path = os.path.join(cls.UT_CASE_DIR, file_name) with open(path, 'r', encoding='utf-8') as f: -- Gitee From f259946845c720d0cbdbba1ea98e0c2a97acd640 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 09:28:19 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/app/controllers/match_nodes_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py index 0b7e955c2..a15005adb 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/match_nodes_controller.py @@ -52,7 +52,7 @@ class MatchNodesController: @staticmethod def process_task_delete(graph_data, npu_node_name, bench_node_name, task): - + result = {} if task == 'md5': result = MatchNodesController.process_md5_task_delete(graph_data, npu_node_name, bench_node_name) elif task == 'summary': -- Gitee From c6e66a7b14e16fd911f6d30fc04715d430db46e6 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 09:24:11 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/server/app/controllers/hierarchy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/hierarchy.py b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/hierarchy.py index afa19c8fe..33bd1b7ba 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/hierarchy.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/server/app/controllers/hierarchy.py @@ -292,6 +292,7 @@ class Hierarchy: for node_name, node_info in self.current_hierarchy.items(): graph_node_info = self.graph.get('node', {}).get(node_name, {}) node_info['matchedNodeLink'] = graph_node_info.get('matched_node_link', []) + node_info['precisionIndex'] = graph_node_info.get('data', {}).get('precision_index', "NaN") return self.current_hierarchy def get_hierarchy(self): -- Gitee From 8c5f24ce13f03b64b9d779ba4f0956a87c01437b Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 11:39:51 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/test/data/__init__.py | 15 ++++++++ .../test/data/test_case_factory.py | 38 +++++++++---------- 2 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/data/__init__.py diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/__init__.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/__init__.py new file mode 100644 index 000000000..ee2432f47 --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/__init__.py @@ -0,0 +1,15 @@ +# Copyright (c) 2025, Huawei Technologies. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py index 81f789cf7..ba2604342 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/test_case_factory.py @@ -25,39 +25,39 @@ class TestCaseFactory: @classmethod def get_process_task_add_cases(cls): - return cls._load_ut_cases('test_match_node_controller/process_task_add_case.json') + return cls.load_ut_cases('test_match_node_controller/process_task_add_case.json') @classmethod def get_process_task_delete_cases(cls): - return cls._load_ut_cases('test_match_node_controller/process_task_delete_case.json') + return cls.load_ut_cases('test_match_node_controller/process_task_delete_case.json') @classmethod def get_process_task_add_child_layer_cases(cls): - return cls._load_ut_cases('test_match_node_controller/process_task_add_child_layer.json') + return cls.load_ut_cases('test_match_node_controller/process_task_add_child_layer.json') @classmethod def get_process_task_delete_child_layer_cases(cls): - return cls._load_ut_cases('test_match_node_controller/process_task_delete_child_layer.json') + return cls.load_ut_cases('test_match_node_controller/process_task_delete_child_layer.json') @classmethod def get_process_task_add_child_layer_by_config_cases(cls): - return cls._load_ut_cases('test_match_node_controller/process_task_add_child_layer_by_config.json') + return cls.load_ut_cases('test_match_node_controller/process_task_add_child_layer_by_config.json') @classmethod def get_change_expand_state_cases(cls): - return cls._load_ut_cases('test_layout_hierarchy_controller/change_expand_state_case.json') + return cls.load_ut_cases('test_layout_hierarchy_controller/change_expand_state_case.json') @classmethod def get_update_hierarchy_data_cases(cls): - return cls._load_ut_cases('test_layout_hierarchy_controller/update_hierarchy_data_case.json') + return cls.load_ut_cases('test_layout_hierarchy_controller/update_hierarchy_data_case.json') @classmethod def load_single_graph_test_data(cls): - return cls._load_ut_cases('test_layout_hierarchy_controller/mock_single_statis_graph.vis') + return cls.load_ut_cases('test_layout_hierarchy_controller/mock_single_statis_graph.vis') @classmethod def load_compare_graph_test_data(cls): - return cls._load_ut_cases('test_layout_hierarchy_controller/mock_compare_statis_graph.vis') + return cls.load_ut_cases('test_layout_hierarchy_controller/mock_compare_statis_graph.vis') @classmethod def load_ut_cases(cls, file_name): @@ -69,43 +69,43 @@ class TestCaseFactory: # ST @classmethod def get_load_graph_config_info_cases(cls): - return cls._load_st_cases('test_load_graph_config_info.json') + return cls.load_st_cases('test_load_graph_config_info.json') @classmethod def get_load_graph_all_node_list_cases(cls): - return cls._load_st_cases('test_load_graph_all_node_list.json') + return cls.load_st_cases('test_load_graph_all_node_list.json') @classmethod def get_change_node_expand_state_cases(cls): - return cls._load_st_cases('test_change_node_expand_state.json') + return cls.load_st_cases('test_change_node_expand_state.json') @classmethod def get_test_add_match_nodes_cases(cls): - return cls._load_st_cases('test_add_match_nodes.json') + return cls.load_st_cases('test_add_match_nodes.json') @classmethod def get_test_update_hierarchy_data_cases(cls): - return cls._load_st_cases('test_update_hierarchy_data.json') + return cls.load_st_cases('test_update_hierarchy_data.json') @classmethod def get_test_delete_match_nodes_cases(cls): - return cls._load_st_cases('test_delete_match_nodes.json') + return cls.load_st_cases('test_delete_match_nodes.json') @classmethod def get_test_get_node_info_cases(cls): - return cls._load_st_cases('test_get_node_info.json') + return cls.load_st_cases('test_get_node_info.json') @classmethod def get_test_add_match_nodes_by_config_cases(cls): - return cls._load_st_cases('test_add_match_nodes_by_config.json') + return cls.load_st_cases('test_add_match_nodes_by_config.json') @classmethod def get_test_update_colors_cases(cls): - return cls._load_st_cases('test_update_colors.json') + return cls.load_st_cases('test_update_colors.json') @classmethod def load_compare_resnet_test_data(cls): - return cls._load_st_cases('mock_compare_resnet_data.vis') + return cls.load_st_cases('mock_compare_resnet_data.vis') @classmethod def load_st_cases(cls, file_name): -- Gitee From b4083bb43b6be9884d01f0e2afd2b2e9d03c3078 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 15:22:31 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=A7=AA=20test:=20TEST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test_match_nodes_controller.py | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py new file mode 100644 index 000000000..12d3caa2e --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py @@ -0,0 +1,78 @@ +# Copyright (c) 2025, Huawei Technologies. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +import pytest + +from server.app.controllers.match_nodes_controller import MatchNodesController +from server.app.utils.global_state import GraphState +from data.test_case_factory import TestCaseFactory + + +@pytest.mark.unit +class TestMatchNodesController: + """测试匹配节点功能""" + + @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_cases(), + ids=lambda c: f"{c['case_id']}:{c['description']}") + def test_process_task_add(self, test_case): + """测试添加节点功能""" + graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() + expected = test_case['expected'] + actual = MatchNodesController.process_task_add(graph_data, npu_node_name, bench_node_name, task) + assert actual == expected + + @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_delete_cases(), + ids=lambda c: f"{c['case_id']}:{c['description']}") + def test_process_task_delete(self, test_case): + """测试删除节点功能""" + if(test_case.get('config', None)): + GraphState.set_global_value("config_data", test_case['config']) + graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() + expected = test_case['expected'] + actual = MatchNodesController.process_task_delete(graph_data, npu_node_name, bench_node_name, task) + assert actual == expected + + @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_child_layer_cases(), + ids=lambda c: f"{c['case_id']}:{c['description']}") + def test_process_task_add_child_layer(self, test_case): + """测试添加子节点层功能""" + graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() + excepted = test_case['expected'] + actual = MatchNodesController.process_task_add_child_layer(graph_data, npu_node_name, bench_node_name, task) + assert actual == excepted + + @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_delete_child_layer_cases(), + ids=lambda c: f"{c['case_id']}:{c['description']}") + def test_process_task_delete_child_layer(self, test_case): + """测试删除子节点层功能""" + if(test_case.get('config', None)): + GraphState.set_global_value("config_data", test_case['config']) + graph_data, npu_node_name, bench_node_name, task = test_case['input'].values() + excepted = test_case['expected'] + actual = MatchNodesController.process_task_delete_child_layer(graph_data, npu_node_name, bench_node_name, task) + assert actual == excepted + + @pytest.mark.parametrize("test_case", TestCaseFactory.get_process_task_add_child_layer_by_config_cases(), + ids=lambda c: f"{c['case_id']}:{c['description']}") + def test_process_task_add_child_layer_by_config(self, test_case): + """测试根据配置文件添加子节点层功能""" + + graph_data, match_node_links, task = test_case['input'].values() + excepted = test_case['expected'] + actual = MatchNodesController.process_task_add_child_layer_by_config(graph_data, match_node_links, task) + print(test_case['case_id'], actual) + assert actual == excepted + -- Gitee From b1f6f71c0ae78db0d845c75c97cab091c76a0582 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 15:25:22 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=90=9E=20fix:=20FIX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tb_graph_ascend/test/conftest.py | 43 +++++++++++++++++++ .../test_update_hierarchy_data.json | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py new file mode 100644 index 000000000..93be4c86c --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/conftest.py @@ -0,0 +1,43 @@ +# Copyright (c) 2025, Huawei Technologies. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +import pytest +from server.app.utils.global_state import GraphState +from data.test_case_factory import TestCaseFactory + + +@pytest.fixture(scope="function", autouse=True) +def reset_global_state(request): + """每个测试后重置全局状态""" + # 执行测试 + yield + # 恢复原始状态 + if request.module.__name__ != "test_graph_views": + GraphState.init_defaults() + + +def pytest_addoption(parser): + """添加自定义命令行选项""" + parser.addoption("--runslow", action="store_true", default=False, + help="Run slow tests") + parser.addoption("--dataset", action="store", default="small", + help="Test dataset size: small|medium|large") + + +@pytest.fixture +def test_case_factory(): + """提供测试用例工厂实例""" + return TestCaseFactory diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/st_test_cases/test_update_hierarchy_data.json b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/st_test_cases/test_update_hierarchy_data.json index 8883046f1..268ca229b 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/data/st_test_cases/test_update_hierarchy_data.json +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/data/st_test_cases/test_update_hierarchy_data.json @@ -255,7 +255,7 @@ "DefaultModel", "Module.fc.Linear.forward.0" ], - "precisionIndex": "NaN", + "precisionIndex": 0.0, "overflowLevel": "NaN", "matchedDistributed": {} }, -- Gitee From 58b293af400058d954a5441063dd57b63e1ce810 Mon Sep 17 00:00:00 2001 From: sunchao <1299792067@qq.com> Date: Thu, 17 Jul 2025 15:29:21 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E2=9C=A8=20feat:=20FIX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/unit/controllers/test_match_nodes_controller.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py index 12d3caa2e..a677b968b 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/controllers/test_match_nodes_controller.py @@ -69,10 +69,8 @@ class TestMatchNodesController: ids=lambda c: f"{c['case_id']}:{c['description']}") def test_process_task_add_child_layer_by_config(self, test_case): """测试根据配置文件添加子节点层功能""" - graph_data, match_node_links, task = test_case['input'].values() excepted = test_case['expected'] actual = MatchNodesController.process_task_add_child_layer_by_config(graph_data, match_node_links, task) - print(test_case['case_id'], actual) assert actual == excepted -- Gitee