更新v2版本适配skill
This commit is contained in:
1 parent
7611f13208
commit
2f3f7d00ec
58 files changed
+180419
-526
No files matched your search
@@ -180,6 +180,25 @@ class FileRecognitionTests(unittest.TestCase):
|
||||
|
||||
|
||||
class InspectionTests(unittest.TestCase):
|
||||
def test_v2_inspection_preserves_backend_version_warning(self) -> None:
|
||||
warning = {"code": "COMPONENT_MODEL_VERSION_WARNING", "components": [{"componentId": "mass"}]}
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "project.json"
|
||||
path.write_text(json.dumps({**PROJECT, "projectSchemaVersion": 2}), encoding="utf-8")
|
||||
with mock.patch.object(skill, "http_request", return_value=(json_bytes({**COMPILED_MODEL, "warnings": [warning]}), {})):
|
||||
report = skill.inspect_source(skill.load_source(str(path)), base_url=BASE_URL, timeout=10)
|
||||
self.assertEqual(report["system"]["formatVersion"], 2)
|
||||
self.assertEqual(report["validation"]["issues"][0]["code"], warning["code"])
|
||||
self.assertEqual(report["validation"]["issues"][0]["severity"], "warning")
|
||||
|
||||
def test_backend_invalid_report_is_not_presented_as_success(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "project.json"
|
||||
path.write_text(json.dumps(PROJECT), encoding="utf-8")
|
||||
with mock.patch.object(skill, "http_request", return_value=(json_bytes({**COMPILED_MODEL, "validation": {"valid": False}}), {})):
|
||||
with self.assertRaises(skill.InputError):
|
||||
skill.inspect_source(skill.load_source(str(path)), base_url=BASE_URL, timeout=10)
|
||||
|
||||
def test_inspect_json_returns_system_summary(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / "project.json"
|
||||
|
||||
Reference in new issue
Block a user