"""Graph shape for the documented texture workflows (no ComfyUI process involved).""" import unittest from comfyui_generate import TEXTURE_PROFILES, texture_workflow class TextureWorkflowTests(unittest.TestCase): def test_sdxl_profile_uses_a_checkpoint_and_a_real_negative(self): graph = texture_workflow("albedobase", "stone", 1024, 1024, 7) self.assertEqual(graph["1"]["class_type"], "CheckpointLoaderSimple") self.assertEqual(graph["5"]["class_type"], "CLIPTextEncode") sampler = graph["7"]["inputs"] self.assertEqual(sampler["steps"], TEXTURE_PROFILES["albedobase"]["steps"]) self.assertEqual(sampler["negative"], ["5", 0]) def test_unet_profile_loads_unet_clip_and_vae(self): graph = texture_workflow("krea2", "stone", 1024, 1024, 7) self.assertEqual(graph["1"]["class_type"], "UNETLoader") self.assertEqual(graph["2"]["class_type"], "CLIPLoader") self.assertEqual(graph["2"]["inputs"]["type"], "krea2") self.assertEqual(graph["3"]["class_type"], "VAELoader") self.assertIn("texture_fix", graph["3"]["inputs"]["vae_name"]) def test_krea2_zeroes_the_negative_at_cfg_one(self): graph = texture_workflow("krea2", "stone", 1024, 1024, 7) self.assertEqual(graph["5"]["class_type"], "ConditioningZeroOut") self.assertEqual(graph["7"]["inputs"]["negative"], ["5", 0]) def test_qwen_profile_uses_its_own_text_encode_node(self): graph = texture_workflow("qwen21", "stone", 1024, 1024, 7) self.assertEqual(graph["4"]["class_type"], "TextEncodeQwenImage21") # CFG 1 with no negative: the positive conditioning is reused. self.assertEqual(graph["7"]["inputs"]["negative"], ["4", 0]) def test_every_profile_names_installed_models(self): for name, spec in TEXTURE_PROFILES.items(): self.assertTrue(spec.get("checkpoint") or spec.get("unet"), name) if "unet" in spec: self.assertTrue(spec["clip"] and spec["vae"], name) if __name__ == "__main__": unittest.main()