Replace H3 nodes with generic sequential video tools
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import importlib.util
|
||||
import sys
|
||||
import types
|
||||
import unittest
|
||||
|
||||
|
||||
class DumasVideoNodeTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
folder_paths = types.ModuleType("folder_paths")
|
||||
folder_paths.get_output_directory = lambda: "/tmp"
|
||||
sys.modules.setdefault("folder_paths", folder_paths)
|
||||
spec = importlib.util.spec_from_file_location("dumas_video_nodes", "dumas_video_nodes.py")
|
||||
cls.module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(cls.module)
|
||||
|
||||
def test_registers_two_generic_video_nodes(self):
|
||||
self.assertEqual(
|
||||
set(self.module.NODE_CLASS_MAPPINGS),
|
||||
{"DumasStandaloneVideo", "DumasJoinVideoClips"},
|
||||
)
|
||||
|
||||
def test_standalone_node_exposes_full_and_complete_outputs(self):
|
||||
node = self.module.DumasStandaloneVideoNode
|
||||
self.assertEqual(node.RETURN_NAMES, ("full_clip", "complete_clip", "complete_frames", "duration"))
|
||||
self.assertIn("overlap_frames", node.INPUT_TYPES()["required"])
|
||||
|
||||
def test_join_signature_contains_stream_compatibility_fields(self):
|
||||
signature = self.module._join_signature(
|
||||
{
|
||||
"streams": [
|
||||
{"codec_type": "video", "codec_name": "h264", "width": 1920, "height": 1088, "pix_fmt": "yuv420p", "r_frame_rate": "24/1"},
|
||||
{"codec_type": "audio", "codec_name": "aac", "sample_rate": "48000", "channels": 2},
|
||||
]
|
||||
}
|
||||
)
|
||||
self.assertEqual(signature, ("h264", 1920, 1088, "yuv420p", "24/1", "aac", "48000", 2))
|
||||
|
||||
def test_join_requires_a_clip(self):
|
||||
with self.assertRaises(ValueError):
|
||||
self.module.DumasJoinVideoClipsNode().join("")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user