Squashed 'vendor/dumas_h3_continuum/' content from commit d07ed31
git-subtree-dir: vendor/dumas_h3_continuum git-subtree-split: d07ed31b442d283d6a1740f875a843b9feda4c91
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from ComfyUI_H3_Continuum_Join import nodes as continuum_nodes
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOW = ROOT / "examples/workflows/MiniMax_H3_Continuum_V38X2.json"
|
||||
|
||||
|
||||
def test_builtin_helper_preserves_public_node_contract():
|
||||
helper = continuum_nodes.NODE_CLASS_MAPPINGS["H3DecodeCacheHelper"]
|
||||
assert continuum_nodes.NODE_DISPLAY_NAME_MAPPINGS["H3DecodeCacheHelper"] == "Decode Cache Helper"
|
||||
assert helper.RETURN_TYPES == ("IMAGE", "AUDIO", "STRING")
|
||||
assert helper.RETURN_NAMES == ("images", "audio", "report")
|
||||
assert helper.INPUT_IS_LIST is True
|
||||
assert helper.OUTPUT_IS_LIST == (True, True, False)
|
||||
assert helper.CATEGORY == "MiniMax H3/Continuum/Helpers"
|
||||
assert list(helper.INPUT_TYPES()["required"]) == [
|
||||
"cache_mode", "ram_budget_mb", "disk_budget_gb", "reset_token"
|
||||
]
|
||||
required = helper.INPUT_TYPES()["required"]
|
||||
assert required["cache_mode"][1]["default"] == "Auto"
|
||||
assert required["ram_budget_mb"][1]["default"] == 256
|
||||
assert required["disk_budget_gb"][1]["default"] == 8
|
||||
assert required["reset_token"][1]["default"] == 0
|
||||
assert required["reset_token"][0] == "INT"
|
||||
|
||||
|
||||
def test_supplied_workflow_is_preserved_and_routes_through_builtin_helper():
|
||||
payload = WORKFLOW.read_bytes()
|
||||
assert hashlib.sha256(payload).hexdigest().upper() == (
|
||||
"1B2212B7511FAC0B63DFA6E9F006CD8644C72D08C6945AB0E4ED0E722C97A730"
|
||||
)
|
||||
workflow = json.loads(payload)
|
||||
nodes = {node["id"]: node for node in workflow["nodes"]}
|
||||
assert nodes[312]["type"] == "H3ContinuumSamplerV38"
|
||||
assert nodes[344]["type"] == "H3DecodeCacheHelper"
|
||||
assert nodes[306]["type"] == "H3ContinuumAssembleSeamV35"
|
||||
assert nodes[344]["widgets_values"] == ["Auto", 256, 8, 0]
|
||||
links = {(link[1], link[2], link[3], link[4], link[5]) for link in workflow["links"]}
|
||||
assert (312, 0, 344, 0, "LATENT") in links
|
||||
assert (312, 1, 344, 2, "LATENT") in links
|
||||
assert (344, 0, 306, 0, "IMAGE") in links
|
||||
assert (344, 1, 306, 1, "AUDIO") in links
|
||||
assert (312, 2, 306, 2, "H3_CONTINUUM_ASSEMBLY_PLAN") in links
|
||||
assert not any(node["type"] in {"VAEDecode", "VAEDecodeAudio"} for node in workflow["nodes"])
|
||||
|
||||
|
||||
def test_sampler_and_finalize_remain_separate_and_core_direct_workflow_remains():
|
||||
assert "H3ContinuumSamplerV38" in continuum_nodes.NODE_CLASS_MAPPINGS
|
||||
assert "H3ContinuumAssembleSeamV35" in continuum_nodes.NODE_CLASS_MAPPINGS
|
||||
core = json.loads(
|
||||
(ROOT / "examples/workflows/MiniMax_H3_Continuum_V38x.json").read_text(encoding="utf-8")
|
||||
)
|
||||
types = {node["type"] for node in core["nodes"]}
|
||||
assert {"VAEDecode", "VAEDecodeAudio", "H3ContinuumAssembleSeamV35"} <= types
|
||||
Reference in New Issue
Block a user