Download tests/test_llm_parse.py from lablab-ai-amd-developer-hackathon/iac-secfix: direct link, hf CLI and curl.
- Browser
- Download file 761 Bytes
-
https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/iac-secfix/resolve/main/tests/test_llm_parse.py
- Command line
-
hf download hf://spaces/lablab-ai-amd-developer-hackathon/iac-secfix/tests/test_llm_parse.py
-
curl -L -o test_llm_parse.py https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/iac-secfix/resolve/main/tests/test_llm_parse.py
761 Bytes
| from iac_secfix_agents.llm import parse_fix_candidate | |
| def test_parse_fix_candidate_from_json(): | |
| candidate, ok = parse_fix_candidate( | |
| '{"patch":"diff","fixed_file":"resource \\"x\\" \\"y\\" {}","resolved_policy_ids":["CKV_X_1"],"explanation":"ok","verification_commands":[],"risk_notes":[],"requires_human_approval":true}' | |
| ) | |
| assert ok | |
| assert candidate is not None | |
| assert candidate.resolved_policy_ids == ["CKV_X_1"] | |
| def test_parse_fix_candidate_from_wrapped_text(): | |
| candidate, ok = parse_fix_candidate( | |
| 'Here is the JSON: {"patch":"","fixed_file":"kind: Pod\\n","resolved":["CKV_K8S_8"],"summary":"fixed"}' | |
| ) | |
| assert ok | |
| assert candidate is not None | |
| assert candidate.resolved_policy_ids == ["CKV_K8S_8"] | |