53 lines
6.9 KiB
Plaintext
53 lines
6.9 KiB
Plaintext
from pathlib import Path
|
|
R=Path.cwd();p=R/'calliope-backend/tests/test_animate_mask_fixed_document.py';s=p.read_text().replace('animate-mask','animate2-loop').replace('Wan2.2_Animate_人物遮罩替换(官流整理).json','Wan_Animate2_动作迁移_for循环长视频.json').replace('394c3c31ad05255d3eb130f309d8445764f4d3772b40fa07fbf19708bfcc1002','22b7853e22629822dd354b0b768e2961a53b4c2f480cfaceeaea9dc51c0f0d0b').replace('source["nodes"][0]["widgets_values"][0] += 1','next(n for n in source["nodes"] if n["id"]==580)["widgets_values"][0] += 1').replace('n["id"] == 232','n["id"] == 606').replace('host["properties"]["proxyWidgets"][0][1] = "forged"','host["properties"]["proxyWidgets"] = [["589","forged"]]').replace('n["id"] == 161','n["id"] == 574').replace('n["id"] == 430','n["id"] == 292')
|
|
s=s[:s.index('def test_proxy_empty_hosts')]+'''def test_missing_proxy_and_host_caches_do_not_inherit_internal_values():
|
|
hosts={b["host_node_id"]:b for b in BLOCK["boundaries"]}
|
|
assert set(hosts)=={"261","291","477","606"}
|
|
assert all(not b["proxy_mappings"] and "proxyWidgets" not in b["host"]["properties"] for b in hosts.values())
|
|
assert "widgets_values" not in hosts["606"]["host"]
|
|
assert hosts["261"]["host"]["widgets_values"][13] == 807087399737133
|
|
assert next(f for f in BLOCK["fields"] if f["node_id"]=="261:19" and f["field"]=="noise_seed")["value"]==2
|
|
|
|
|
|
def test_vhs_exact_commit_gap_and_real_wan_classes_are_independent():
|
|
gaps={n["node_id"] for n in BLOCK["node_bindings"] if n["source_id"].startswith("unresolved-")}
|
|
assert gaps=={"585","586"}
|
|
assert all(n["implementation_verified"] for n in BLOCK["node_bindings"] if n["class_type"] in ["WanAnimate2ToVideo","WanAnimate2Cache","ContextWindowsManual"])
|
|
nodes={n["id"]:n for n in SOURCE["nodes"]}
|
|
assert nodes[586]["widgets_values"]=={}
|
|
assert nodes[477]["widgets_values"][3].endswith("\\n")
|
|
edges={e[0]:e for e in SOURCE["links"]}
|
|
assert edges[937][1:5]==[606,0,477,2]
|
|
assert edges[938][1:5]==[606,1,477,3]
|
|
assert edges[945][1:5]==[606,2,608,0]
|
|
'''
|
|
(R/'calliope-backend/tests/test_animate2_loop_fixed_document.py').write_text(s)
|
|
for filename in ['animate-mask-document-server.py','run-animate-mask-document.py']:
|
|
s=(R/'e2e'/filename).read_text().replace('animate-mask','animate2-loop').replace('== 144','== 145')
|
|
(R/'e2e'/filename.replace('animate-mask','animate2-loop')).write_text(s)
|
|
s=(R/'e2e/animate-mask-document.mjs').read_text().replace('animate-mask','animate2-loop').replace('new_animate_mask','new_animate2_loop').replace('old_one_hundred_forty_three','old_one_hundred_forty_four').replace("const names=['","const names=['Wan_Animate2_动作迁移_for循环长视频','",1).replace('details.length===144','details.length===145').replace('===9985','===10215').replace('144图9985','145图10215').replace('===282','===287').replace('144图282','145图287')
|
|
a=s.index(' check(b.node_bindings.filter');b=s.index(' const notesBox=',a)
|
|
s=s[:a]+''' const source=JSON.parse(fs.readFileSync('docs/hel-892/animate2-loop-document-evidence/source-check.json'));
|
|
check(b.counts.saved_fields===230&&b.counts.source_nodes===109&&b.counts.physical_edges===221,`${width}230原值/109节点/221原边`);
|
|
const original=JSON.parse(fs.readFileSync('example_ComfyUI_workflows/6-动作迁移/Wan_Animate2_动作迁移_for循环长视频.json'));
|
|
const allGraphs=[original,...original.definitions.subgraphs];
|
|
check(allGraphs.flatMap(g=>g.nodes).filter(n=>n.mode===4).length===4,`${width}四mode4保存不执行`);
|
|
check(b.node_bindings.filter(n=>n.implementation_verified).length===85&&b.node_bindings.filter(n=>n.source_id.startsWith('unresolved-')).length===2&&b.node_bindings.filter(n=>n.source_id==='unknown-no-version').length===13,`${width}85准确/2VHS具体提交缺口/13未知`);
|
|
for(const h of b.boundaries){const host=original.nodes.find(n=>String(n.id)===h.host_node_id);assert.deepEqual(h.host,host);check(!('proxyWidgets'in host.properties)&&h.proxy_mappings.length===0&&h.widgets.length===0,`${width}宿主${h.host_node_id}无proxy不造映射`);}
|
|
check(!('widgets_values'in original.nodes.find(n=>n.id===606))&&original.nodes.find(n=>n.id===586).widgets_values.constructor===Object,`${width}606缺保存/586空dict独立`);
|
|
const scoped=JSON.parse(fs.readFileSync('docs/hel-892/animate2-loop-document-evidence/scoped-edge-check.json'));
|
|
for(const e of scoped.endpoints)check(b.flow.includes(e.scope+' 物理/边界记录 '+JSON.stringify(e.edge).replaceAll(':',': '))||b.flow.some(x=>x.startsWith(e.scope+' 物理/边界记录 ')&&JSON.stringify(JSON.parse(x.slice((e.scope+' 物理/边界记录 ').length)))===JSON.stringify(e.edge)),`${width}分scope原边${e.scope}/${Array.isArray(e.edge)?e.edge[0]:e.edge.id}`);
|
|
for(const [host,inner]of [['261','261:19'],['477','477:468']]){check(b.fields.find(f=>f.node_id===host&&f.field==='noise_seed').value===(host==='261'?807087399737133:2)&&b.fields.find(f=>f.node_id===inner&&f.field==='noise_seed').value===2,`${width}宿主${host}缓存不覆盖内部seed2`);}
|
|
check(b.fields.filter(f=>f.json_type==='dict').length===1&&b.fields.every(f=>!['float','NoneType'].includes(f.json_type)),`${width}唯一完整历史/无float或null保存`);
|
|
check(original.extra.frontendVersion==='1.48.6',`${width}准确前端1.48.6同树内置LG`);
|
|
for(const e of b.sources.filter(e=>e.claim.includes('本图实际复核UTC')))check(Number.isFinite(Date.parse(e.reverified_at))&&(!/^\\d{4}-/.test(e.acquisition_time||'')||Date.parse(e.reverified_at)>=Date.parse(e.acquisition_time)),`${width}来源时间${e.file}`);
|
|
'''+s[b:]
|
|
a=s.index(' for(const [phrase,label]of ');b=s.index(' await dialog.getByText',a)
|
|
s=s[:a]+''' for(const [phrase,label]of [['本图独立根35','scope'],['准确前端1.48.6','frontend'],['参考图189','inputs'],['536原ceil','preview'],['261/477两主宿主','host-caches'],['两个WanAnimate2ToVideo','wan'],['两普通SamplerCustom','sampling'],['ResizeImageMaskNode准确','resize'],['root物理有向回路','cycle'],['606内部590','easy'],['291 mode4比较','video'],['rootTT','identity']]){
|
|
const line=b.flow.filter(x=>x.startsWith(phrase)).sort((a,b)=>a.length-b.length)[0];assert.ok(line,phrase);await fixedCard.getByText(line,{exact:true}).first().evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-${label}.png`});
|
|
}
|
|
'''+s[b:]
|
|
a=s.index(" if(['229.points_store'");b=s.index('\n await summary.click();',a)
|
|
s=s[:a]+''' if(['261.noise_seed','477.noise_seed','477.text_4','261:19.noise_seed','477:468.control_after_generate','261:247.pose_strength','261:224.device','261:257.context_length','261:244.resize_type.width','585.videopreview','536.expression','291:290.expression','606:589.expression','245.fps','292.codec'].includes(f.node_id+'.'+f.field)){await summary.evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-${f.node_id.replaceAll(':','_')}-${f.field}.png`});}'''+s[b:]
|
|
(R/'e2e/animate2-loop-document.mjs').write_text(s)
|