diff --git a/python/tests/test_base_component.py b/python/tests/test_base_component.py index 7c60c5dd..12ad2f9d 100644 --- a/python/tests/test_base_component.py +++ b/python/tests/test_base_component.py @@ -14,6 +14,7 @@ def test_valid_output_with_str(self): out2 = self.component.create_output(type="code", text="import appbuilder") out3 = self.component.create_output(type="urls", text="http://www.baidu.com") out4 = self.component.create_output(type="oral_text", text="你是哪个") + out5 = self.component.create_output(type="json", text="{'key':'value'}") self.assertIsInstance(out1, ComponentOutput) self.assertIsInstance(out2, ComponentOutput) self.assertIsInstance(out3, ComponentOutput) @@ -55,15 +56,7 @@ def test_valid_output_type_with_same_key(self): def test_invalid_output_type_json(self): with self.assertRaises(ValueError): - output = self.component.create_output(type="json", text="") - # with self.assertRaises(AssertionError): - # output = self.component.create_output(type="files", text={}) - # with self.assertRaises(AssertionError): - # output = self.component.create_output(type="references", text={"info": "text"}) - # with self.assertRaises(AssertionError): - # output = self.component.create_output(type="image", text={"url": "https://example.com/img"}) - # with self.assertRaises(AssertionError): - # output = self.component.create_output(type="chart", text={"url": "https://example.com/chart"}) + output = self.component.create_output(type="test", text="") if __name__ == '__main__': diff --git a/python/tests/test_core_components.py b/python/tests/test_core_components.py deleted file mode 100644 index ebeb1544..00000000 --- a/python/tests/test_core_components.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2024 Baidu, Inc. 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 os -import json -import unittest - -from appbuilder.core.component import Component - - -@unittest.skipUnless(os.getenv("TEST_CASE", "UNKNOWN") == "CPU_PARALLEL", "") -class TestObjectRecognition(unittest.TestCase): - def setUp(self): - self.com = Component() - self.json = json.dumps({ - "type": "object_recognition", - "text": "https://baidu.com/1.jpg", - }) - - def test_create_output(self): - result = self.com.create_output( - type="json", - text=self.json, - ) - print(result) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file