calibrate

This commit is contained in:
2026-10-06 17:58:35 +03:00
parent 86222f5f93
commit 476cfe0b17
21 changed files with 1666 additions and 14 deletions
+16 -2
View File
@@ -23,7 +23,10 @@ class TestSpecFile:
def test_version_and_paths(self, spec):
assert spec["openapi"].startswith("3.")
paths = spec["paths"]
for path in ("/api/v1/features", "/api/v1/verify", "/api/v1/profiles", "/health", "/ready"):
for path in (
"/api/v1/features", "/api/v1/verify", "/api/v1/calibrate",
"/api/v1/profiles", "/health", "/ready",
):
assert path in paths, path
def test_security_scheme(self, spec):
@@ -68,11 +71,22 @@ class TestSpecFile:
# все коды из таблицы docs/05 §5.3
assert codes == {
"IMAGE_DECODE_FAILED", "FEATURE_BLOB_INVALID", "FEATURE_FORMAT_UNSUPPORTED",
"TOO_MANY_REFERENCES", "UNKNOWN_PROFILE", "IMAGE_TOO_SMALL",
"TOO_MANY_REFERENCES", "TOO_MANY_CALIBRATION_IMAGES", "CALIBRATION_DATASET_INVALID",
"UNKNOWN_PROFILE", "IMAGE_TOO_SMALL",
"UNAUTHORIZED", "FORBIDDEN", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE",
"VALIDATION_ERROR", "INVALID_SETTINGS", "INTERNAL",
}
def test_calibrate_packs_are_repeated_parts(self, spec):
schema = spec["paths"]["/api/v1/calibrate"]["post"]["requestBody"]["content"][
"multipart/form-data"
]["schema"]
assert schema["required"] == ["positive", "negative"]
positive = schema["properties"]["positive"]
assert positive["type"] == "array"
assert positive["minItems"] == 2
assert positive["maxItems"] == 8 # CALIBRATION_MAX_IMAGES_PER_PACK по умолчанию
def test_settings_match_validation_ranges(self, spec):
comparison = spec["components"]["schemas"]["ComparisonSettings"]["properties"]
assert comparison["lowe_ratio"]["minimum"] == 0.5