Files
ComfyUI-H3-Continuum-Tiled/tests/test_v39_stability_r1.py
T
ukr8b3g-cmyk 190141e03e fix: stabilize V3.9 and bump package to 3.9.1
Preserve Second Pass audio and scoped Review conditioning, strengthen Take compatibility, and align Review Driving Audio.

Keep v5 history readable, document v6 restart requirements, and describe the fixes at the top of both READMEs. Remove workstation-specific paths and private operational records from public documentation.
2026-10-04 19:05:33 +09:00

43 lines
2.0 KiB
Python

import pytest
import torch
from ComfyUI_H3_Continuum_Join.v3 import refine_context as rc
def group(keyframe):
return rc.make_refine_group(
group_id=0,logical_chunks=[1],physical_frames=124,prompt_policy='single',
physical_prompt='prompt',source_video_shape=(1,24,37,2,3),
physical_clip_index=1,context_frames=0,first_image=None,last_image=None,
conditioning=[[torch.zeros(1,2,3),{'minimax_keyframes':[keyframe]}]],
)
@pytest.mark.parametrize('resize',[False,True])
@pytest.mark.parametrize('kind',['audio','video','mixed'])
def test_modalities_preserve_audio_and_frozen_source(kind,resize):
keyframe={'resolved_frame_index':0}
if kind!='video': keyframe['audio_latent']=torch.arange(32*2*7).reshape(1,32,2,7).float()
if kind!='audio': keyframe['latent']=torch.ones(1,24,1,2,3)
source=group(keyframe)
frozen=source['conditioning'][0][1]['minimax_keyframes'][0]
before={k:v.clone() for k,v in frozen.items() if torch.is_tensor(v)}
result,stats=rc.adapt_group_conditioning(source,4 if resize else 2,6 if resize else 3)
actual=result[0][1]['minimax_keyframes'][0]
assert actual is not frozen
assert actual['resolved_frame_index']==0
if kind!='video':
assert actual['audio_latent'] is frozen['audio_latent']
assert torch.equal(actual['audio_latent'],before['audio_latent'])
if kind=='audio':
assert 'latent' not in actual
assert stats['keyframes_resized']==0
else:
assert actual['latent'].shape[-2:]==((4,6) if resize else (2,3))
for k,v in before.items(): assert torch.equal(frozen[k],v)
@pytest.mark.parametrize('payload',[{}, {'latent':torch.zeros(1,2,3)},
{'audio_latent':torch.zeros(1,2)},
{'latent':torch.zeros(1,2,3),'audio_latent':torch.zeros(1,32,2,7)},
{'latent':torch.zeros(1,24,1,2,3),'audio_latent':'broken'}])
def test_invalid_payload_is_not_hidden_by_another_modality(payload):
with pytest.raises(rc.RefineConditioningAdaptationError):
rc.adapt_group_conditioning(group({'resolved_frame_index':0,**payload}),4,6)