Files
comfyui_o1key/tests/test_universal_llm.py
T
Jony ba920f2b66 Publish current ComfyUI O1Key code baseline
Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
2026-09-24 19:56:48 +08:00

41 lines
1.3 KiB
Python

import sys
import types
import unittest
from pathlib import Path
PACKAGE_DIR = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(PACKAGE_DIR.parent))
# Import the node module without running the root registry, whose unrelated
# ComfyUI imports initialize CUDA during package import.
package = types.ModuleType("comfyui_o1key")
package.__path__ = [str(PACKAGE_DIR)]
sys.modules.setdefault("comfyui_o1key", package)
nodes_package = types.ModuleType("comfyui_o1key.nodes")
nodes_package.__path__ = [str(PACKAGE_DIR / "nodes")]
sys.modules.setdefault("comfyui_o1key.nodes", nodes_package)
from comfyui_o1key.nodes.universal_llm import ( # noqa: E402
DEFAULT_MODEL,
SUPPORTED_MODELS,
UniversalLLMChat,
)
class UniversalLLMModelTests(unittest.TestCase):
def test_gpt_6_sol_is_supported_and_default(self):
schema = UniversalLLMChat.GET_SCHEMA()
schema.validate()
model_input = next(item for item in schema.inputs if item.id == "模型")
self.assertEqual(DEFAULT_MODEL, "gpt-6-sol")
self.assertEqual(SUPPORTED_MODELS[0], DEFAULT_MODEL)
self.assertIn("gpt-6-astra", SUPPORTED_MODELS)
self.assertEqual(model_input.options, SUPPORTED_MODELS)
self.assertEqual(model_input.default, DEFAULT_MODEL)
if __name__ == "__main__":
unittest.main()