diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/.keep b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_global_state b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_global_state new file mode 100644 index 0000000000000000000000000000000000000000..c8aa01b01af7d5f2c4bb4f93485f8e2c5b7eb6cb --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/test/unit/utils/test_global_state @@ -0,0 +1,34 @@ +# 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 unittest +from server.app.utils.global_state import GraphState + +class TestGlobalState(unittest.TestCase): + def setUp(self): + GraphState.init_defaults() + + def test_set_global_value(self): + GraphState.set_global_value('logdir', "./") + assert GraphState.get_global_value("logdir") == "./" + + def test_get_global_value(self): + assert GraphState.get_global_value("logdir") == "" + + def test_reset_global_state(self): + GraphState.set_global_value('logdir', "./") + GraphState.reset_global_state() + assert GraphState.get_global_value("logdir") == ""