........................................................................ [ 16%]
........................................................................ [ 33%]
........................................................................ [ 50%]
........................................................................ [ 66%]
........................................................................ [ 83%]
................................................................FFF..FF. [100%]
=================================== FAILURES ===================================
______________ test_exact_graph_and_original_seventeen_unchanged _______________

    def test_exact_graph_and_original_seventeen_unchanged():
        d = doc()
        assert d["fixed_version"]["matched"]
        assert len(BLOCK["fields"]) == 21 and BLOCK["comments"] == []
        assert sum(isinstance(f["value"], dict) for f in BLOCK["fields"]) == 2
        nodes = {n["id"]: n for n in SOURCE["nodes"]}
        assert {k: len(n["widgets_values"]) for k, n in nodes.items()} == {20: 0, 21: 11, 1: 10, 15: 0}
        assert all(n["mode"] == 0 for n in nodes.values())
        assert "frontendVersion" not in SOURCE["extra"] and "definitions" not in SOURCE
        assert SOURCE["links"] == [
            [15, 1, 0, 20, 0, "IMAGE"],
            [16, 20, 0, 15, 0, "IMAGE"],
            [17, 20, 0, 21, 0, "IMAGE"],
            [18, 1, 2, 21, 1, "AUDIO"],
        ]
        for eid, origin, slot, target, inp, typ in SOURCE["links"]:
            assert eid in nodes[origin]["outputs"][slot]["links"]
            assert nodes[origin]["outputs"][slot]["type"] == typ
            assert nodes[target]["inputs"][inp]["link"] == eid
            assert nodes[target]["inputs"][inp]["type"] == typ
        fields = {(f["node_id"], f["field"]): f for f in BLOCK["fields"]}
        assert fields["1", "force_rate"]["value"] == fields["21", "frame_rate"]["value"] == 16
        assert fields["1", "force_rate"]["json_type"] == "int"
        assert fields["1", "choose video to upload"]["role"] == "frontend_control"
        assert all(
            f["role"] == "frontend_history" for f in BLOCK["fields"] if f["field"] == "videopreview"
        )
        text = "".join(BLOCK["flow"])
        for token in [
            "音频link18",
            "绕过Reverse20",
            "torch.flip(images,[0])",
            "没有frontendVersion",
            "-shortest",
            "RETURN_TYPES",
            "未接",
            "历史",
            "未知",
            "内存",
            "VHS1.7.7",
        ]:
            assert token in text
        assert not BLOCK["counts"]["final_prompt_constructed"]
        resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
        old = json.loads(subprocess.check_output(["git", "show", "ab18cd3:" + resource], cwd=REPO))
        now = json.loads((REPO / resource).read_bytes())
        watermark = next(p for p in now if p.endswith("/图像4种添加水印节点.json"))
        now[watermark].pop("fixed_version_document")
        birefnet = next(p for p in now if p.endswith("/birefnet_图像移除背景.json"))
        now[birefnet].pop("fixed_version_document")
        for added in [
            p
            for p in now
            if p.endswith(
                (
                    "视频转gif动图图片.json",
                    "加载图片合成视频.json",
                    "双图像或视频合并显示.json",
                    "截取视频每一帧.json",
                    "加载本地latent解码.json",
                )
            )
        ]:
            now[added].pop("fixed_version_document")
        assert now[PATH].pop("fixed_version_document") == BLOCK
        assert now == old and len(DEFINITIONS) == 25
        blocks = [r["fixed_version_document"] for r in old.values() if "fixed_version_document" in r]
        assert len(blocks) == 17 and sum(len(b["fields"]) for b in blocks) == 495
        assert (
            sum(len(b.get("comments", [])) for b in blocks) == 14
        )  # ASR historical note counted separately
        assert d["status"] == dict(imported=True, doc_done=False, exec_verified=False)
        assert d["dependencies"]["check_state"] == "unchecked"
        for p in DEFINITIONS:
            if p.endswith("/birefnet_图像移除背景.json"):
                continue
            if p.endswith(
                (
                    "视频转gif动图图片.json",
                    "加载图片合成视频.json",
                    "双图像或视频合并显示.json",
                    "截取视频每一帧.json",
                    "加载本地latent解码.json",
                )
            ):
                continue
            if p == PATH:
                continue
            r = copy.deepcopy(REVIEW)
>           r["fixed_version_document"] = old[p]["fixed_version_document"]
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'fixed_version_document'

calliope-backend/tests/test_reverse_fixed_document.py:259: KeyError
__________ test_exact_topology_counts_modes_unknowns_and_old_objects ___________

    def test_exact_topology_counts_modes_unknowns_and_old_objects():
        d = doc()
        assert d["fixed_version"]["matched"] and d["fixed_version"]["fields"] == BLOCK["fields"]
        assert len(BLOCK["fields"]) == 74 and len(BLOCK["comments"]) == 0
        assert sum(isinstance(f["value"], dict) for f in BLOCK["fields"]) == 3
        assert sum(f["value"] is None for f in BLOCK["fields"]) == 1
        assert sum(f["role"] == "unknown_saved" for f in BLOCK["fields"]) == 7
        expected = {
            203: 1,
            334: 1,
            340: 1,
            137: 11,
            339: 1,
            373: 11,
            364: 3,
            362: 7,
            363: 0,
            106: 2,
            374: 9,
            370: 1,
            130: 9,
            208: 1,
            376: 1,
            375: 9,
            365: 0,
            335: 2,
            372: 4,
        }
        nodes = {n["id"]: n for n in SOURCE["nodes"]}
        assert {nid: len(n["widgets_values"]) for nid, n in nodes.items()} == expected
        assert {nid for nid, n in nodes.items() if n["mode"] == 4} == {106, 375, 365}
        assert len(SOURCE["links"]) == 22 and "definitions" not in SOURCE
        assert [e[0] for e in SOURCE["links"]] == [
            570,
            621,
            623,
            624,
            625,
            627,
            629,
            648,
            650,
            651,
            653,
            654,
            655,
            656,
            657,
            658,
            659,
            660,
            661,
            662,
            663,
            665,
        ]
        for eid, origin, slot, target, inp, typ in SOURCE["links"]:
            assert eid in nodes[origin]["outputs"][slot]["links"]
            assert nodes[target]["inputs"][inp]["link"] == eid
            assert nodes[target]["inputs"][inp]["type"] == (
                {648: "INT", 661: "INT,FLOAT", 662: "INT,FLOAT"}.get(eid, typ)
            )
        text = "".join(BLOCK["flow"])
        assert all(
            t in text
            for t in [
                "没有warmup",
                "没有per_batch",
                "round(result)",
                "两Combine.audio都未接",
                "临时目录",
                "UE",
                "mode4",
                "0新源注释",
                "冲突不抹平",
                "taichi",
                "提供方",
                "未实跑",
            ]
        )
        assert not BLOCK["counts"]["final_prompt_constructed"]
        resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
        old = json.loads(subprocess.check_output(["git", "show", "7e76510:" + resource], cwd=REPO))
        now = json.loads((REPO / resource).read_bytes())
        watermark = next(p for p in now if p.endswith("/图像4种添加水印节点.json"))
        now[watermark].pop("fixed_version_document")
        birefnet = next(p for p in now if p.endswith("/birefnet_图像移除背景.json"))
        now[birefnet].pop("fixed_version_document")
        latent = next(p for p in now if p.endswith("/加载本地latent解码.json"))
        now[latent].pop("fixed_version_document")
        later = next(p for p in now if p.endswith("/截取视频每一帧.json"))
        now[later].pop("fixed_version_document")
        for added in [
            p
            for p in now
            if p.endswith(
                ("视频转gif动图图片.json", "加载图片合成视频.json", "双图像或视频合并显示.json")
            )
        ]:
            now[added].pop("fixed_version_document")
        reverse = next(p for p in now if p.endswith("/视频倒放.json"))
        now[reverse].pop("fixed_version_document")
        assert now[PATH].pop("fixed_version_document") == BLOCK
        assert now == old and len(DEFINITIONS) == 25
        old_blocks = [
            r["fixed_version_document"] for r in old.values() if "fixed_version_document" in r
        ]
        assert len(old_blocks) == 16 and sum(len(b["fields"]) for b in old_blocks) == 421
        assert (
            sum(len(b.get("comments", [])) for b in old_blocks) == 14
        )  # separate historical ASR flow note
        assert d["status"] == dict(imported=True, doc_done=False, exec_verified=False)
        assert d["dependencies"]["check_state"] == "unchecked"
        for p in DEFINITIONS:
            if p.endswith("/birefnet_图像移除背景.json"):
                continue
            if p.endswith(("/截取视频每一帧.json", "/加载本地latent解码.json")):
                continue
            if p.endswith(
                ("视频转gif动图图片.json", "加载图片合成视频.json", "双图像或视频合并显示.json")
            ):
                continue
            if p == PATH or p.endswith("/视频倒放.json"):
                continue
            r = copy.deepcopy(REVIEW)
>           r["fixed_version_document"] = old[p]["fixed_version_document"]
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'fixed_version_document'

calliope-backend/tests/test_nlf_fixed_document.py:304: KeyError
________________ test_exact_document_topology_and_preservation _________________

    def test_exact_document_topology_and_preservation():
        d = doc()
        assert d["fixed_version"]["matched"] and d["fixed_version"]["fields"] == BLOCK["fields"]
        assert len(BLOCK["fields"]) == 27 and len(BLOCK["comments"]) == 1
        assert sum(isinstance(f["value"], dict) for f in BLOCK["fields"]) == 2
        assert len(SOURCE["nodes"]) == 5 and len(SOURCE["links"]) == 4
        assert SOURCE["links"] == [
            [4, 1, 0, 4, 0, "IMAGE"],
            [10, 2, 0, 1, 0, "IMAGE"],
            [11, 2, 3, 9, 0, "VHS_VIDEOINFO"],
            [12, 9, 0, 4, 4, "FLOAT"],
        ]
        nodes = {n["id"]: n for n in SOURCE["nodes"]}
        for edge, origin, slot, target, inp, typ in SOURCE["links"]:
            assert edge in nodes[origin]["outputs"][slot]["links"]
            assert nodes[target]["inputs"][inp]["link"] == edge
            assert nodes[target]["inputs"][inp]["type"] == typ
        assert nodes[9]["widgets_values"] == {} and type(nodes[9]["widgets_values"]) is dict
        assert all(n["mode"] == 0 for n in SOURCE["nodes"])
        assert pointer(SOURCE, BLOCK["comments"][0]["pointer"]) == BLOCK["comments"][0]["text"]
        assert not BLOCK["counts"]["final_prompt_constructed"]
        assert all(
            s in "".join(BLOCK["flow"])
            for s in [
                "未实跑",
                "包同字节不等于提交绑定",
                "loaded_fps",
                "外线覆盖",
                "音频",
                "UE7.5.2",
                "空对象",
                "不是缺键/null/[]",
            ]
        )
        resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
        previous = json.loads(subprocess.check_output(["git", "show", "fec5cca:" + resource], cwd=REPO))
        current = json.loads((REPO / resource).read_bytes())
        watermark = next(p for p in current if p.endswith("/图像4种添加水印节点.json"))
        current[watermark].pop("fixed_version_document")
        birefnet = next(p for p in current if p.endswith("/birefnet_图像移除背景.json"))
        current[birefnet].pop("fixed_version_document")
        latent = next(p for p in current if p.endswith("/加载本地latent解码.json"))
        current[latent].pop("fixed_version_document")
        later = next(p for p in current if p.endswith("/截取视频每一帧.json"))
        current[later].pop("fixed_version_document")
        for added in [
            p
            for p in current
            if p.endswith(
                ("视频转gif动图图片.json", "加载图片合成视频.json", "双图像或视频合并显示.json")
            )
        ]:
            current[added].pop("fixed_version_document")
        reverse = next(p for p in current if p.endswith("/视频倒放.json"))
        current[reverse].pop("fixed_version_document")
        nlf = next(p for p in current if p.endswith("NLF_视频人物动作骨架获取.json"))
        current[nlf].pop("fixed_version_document")
        assert current[PATH].pop("fixed_version_document") == BLOCK
        assert current == previous and len(DEFINITIONS) == 25
        old = [r["fixed_version_document"] for r in previous.values() if "fixed_version_document" in r]
        assert len(old) == 15 and sum(len(b["fields"]) for b in old) == 394
        assert sum(len(b.get("comments", [])) for b in old) == 13  # one historical ASR flow note
        assert d["status"] == dict(imported=True, doc_done=False, exec_verified=False)
        assert d["dependencies"]["check_state"] == "unchecked"
        assert not doc(path="untrusted.json").get("fixed_version")
        for p in DEFINITIONS:
            if p.endswith("/birefnet_图像移除背景.json"):
                continue
            if p.endswith(("/截取视频每一帧.json", "/加载本地latent解码.json")):
                continue
            if p.endswith(
                ("视频转gif动图图片.json", "加载图片合成视频.json", "双图像或视频合并显示.json")
            ):
                continue
            if p in [PATH, nlf, reverse]:
                continue
            r = copy.deepcopy(REVIEW)
>           r["fixed_version_document"] = previous[p]["fixed_version_document"]
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E           KeyError: 'fixed_version_document'

calliope-backend/tests/test_openpose_fixed_document.py:245: KeyError
______________ test_real_document_and_frozen_old_fourteen_blocks _______________

    def test_real_document_and_frozen_old_fourteen_blocks():
        d = doc()
        assert d["fixed_version"]["matched"] and d["fixed_version"]["fields"] == BLOCK["fields"]
        assert d["status"] == dict(imported=True, doc_done=False, exec_verified=False)
        assert d["dependencies"]["check_state"] == "unchecked"
        assert "fixed_version" not in doc(path="untrusted.json")
        review = copy.deepcopy(REVIEW)
        other = next(
            p
            for p in DEFINITIONS
            if p != PATH
            and not p.endswith("/birefnet_图像移除背景.json")
            and not p.endswith(("/截取视频每一帧.json", "/加载本地latent解码.json"))
            and not p.endswith(
                ("NLF_视频人物动作骨架获取.json", "/视频倒放.json", "双图像或视频合并显示.json")
            )
        )
        resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
        now = json.loads((REPO / resource).read_bytes())
        watermark = next(p for p in now if p.endswith("/图像4种添加水印节点.json"))
        now[watermark].pop("fixed_version_document")
        birefnet = next(p for p in now if p.endswith("/birefnet_图像移除背景.json"))
        now[birefnet].pop("fixed_version_document")
        latent = next(p for p in now if p.endswith("/加载本地latent解码.json"))
        now[latent].pop("fixed_version_document")
        later = next(p for p in now if p.endswith("/截取视频每一帧.json"))
        now[later].pop("fixed_version_document")
        for added in [
            p
            for p in now
            if p.endswith(
                (
                    "视频转gif动图图片.json",
                    "加载图片合成视频.json",
                    "双图像或视频合并显示.json",
                )
            )
        ]:
            now[added].pop("fixed_version_document")
        reverse = next(p for p in now if p.endswith("/视频倒放.json"))
        now[reverse].pop("fixed_version_document")
        nlf = next(p for p in now if p.endswith("NLF_视频人物动作骨架获取.json"))
        now[nlf].pop("fixed_version_document")
        openpose = next(p for p in now if p.endswith("openpose-video-姿态检测.json"))
>       review["fixed_version_document"] = now[other]["fixed_version_document"]
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       KeyError: 'fixed_version_document'

calliope-backend/tests/test_sdpose_fixed_document.py:190: KeyError
______ test_ten_documents_only_gain_overview_and_new_block_is_independent ______

    def test_ten_documents_only_gain_overview_and_new_block_is_independent():
        p = "calliope-backend/src/calliope/comfyui/source_reviews.json"
        old = json.loads(subprocess.check_output(["git", "show", "ec3388a:" + p], cwd=REPO))
        now = json.loads((REPO / p).read_bytes())
        watermark = next(p for p in now if p.endswith("/图像4种添加水印节点.json"))
        now[watermark].pop("fixed_version_document")
        birefnet = next(p for p in now if p.endswith("/birefnet_图像移除背景.json"))
        now[birefnet].pop("fixed_version_document")
        # Freeze the historical eleven-document revision; the two grid additions are
        # independently compared against 27e6d56 in test_grid_fixed_document.
        # Gemma is separately checked against 9dac1b4 in test_gemma_fixed_document.
        additions = [
            p
            for p in DEFINITIONS
            if p.endswith(
                (
                    "图像合并成四宫格.json",
                    "图像分割-多宫格分割.json",
                    "gemma4_提示词反推(图像视频音频).json",
                    "sdpose_视频人物姿势骨架提取.json",
                    "openpose-video-姿态检测.json",
                    "NLF_视频人物动作骨架获取.json",
                    "/视频倒放.json",
                    "视频转gif动图图片.json",
                    "加载图片合成视频.json",
                    "双图像或视频合并显示.json",
                    "截取视频每一帧.json",
                    "加载本地latent解码.json",
                )
            )
        ]
        assert len(additions) == 12
        for p in additions:
            now[p].pop("fixed_version_document")
        historical = [p for p in DEFINITIONS if p not in additions and p != birefnet]
>       assert len(historical) == 11
E       AssertionError: assert 12 == 11
E        +  where 12 = len(['example_ComfyUI_workflows/0-基础处理：图像合并-音频分离-视频截取合并-图像视频放大/图像4种添加水印节点.json', 'example_ComfyUI_workflows/3-图像生成/Qwen-Im...图像视频放大/Minimax-H3提示词增强.json', 'example_ComfyUI_workflows/0-基础处理：图像合并-音频分离-视频截取合并-图像视频放大/ControlNet_aux_常用样例.json', ...])

calliope-backend/tests/test_background_fixed_document.py:224: AssertionError
=============================== warnings summary ===============================
calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53
  /home/xiaomo/multica_workspaces/hello-af23464d222e/hel-892-7681e8af13d0/workdir/aigc-home/calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
    _PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED calliope-backend/tests/test_reverse_fixed_document.py::test_exact_graph_and_original_seventeen_unchanged
FAILED calliope-backend/tests/test_nlf_fixed_document.py::test_exact_topology_counts_modes_unknowns_and_old_objects
FAILED calliope-backend/tests/test_openpose_fixed_document.py::test_exact_document_topology_and_preservation
FAILED calliope-backend/tests/test_sdpose_fixed_document.py::test_real_document_and_frozen_old_fourteen_blocks
FAILED calliope-backend/tests/test_background_fixed_document.py::test_ten_documents_only_gain_overview_and_new_block_is_independent
5 failed, 427 passed, 1 warning in 6.31s
