Download tasks/fastapilabs__fastapi-cloud-cli__09ecc6d14b/trained.patch from WardenOfPluto/build-spec-tasks: direct link, hf CLI and curl.
- Browser
- Download file 2.79 kB
-
https://huggingface.co/datasets/WardenOfPluto/build-spec-tasks/resolve/main/tasks/fastapilabs__fastapi-cloud-cli__09ecc6d14b/trained.patch
- Command line
-
hf download hf://datasets/WardenOfPluto/build-spec-tasks/tasks/fastapilabs__fastapi-cloud-cli__09ecc6d14b/trained.patch
-
curl -L -o trained.patch https://huggingface.co/datasets/WardenOfPluto/build-spec-tasks/resolve/main/tasks/fastapilabs__fastapi-cloud-cli__09ecc6d14b/trained.patch
2.79 kB
| --- a/src/fastapi_cloud_cli/api/_models.py | |
| +++ b/src/fastapi_cloud_cli/api/_models.py | |
| building_image = "building_image" | |
| building_image_failed = "building_image_failed" | |
| building_image_failed_timeout = "building_image_failed_timeout" | |
| + build_skipped = "build_skipped" | |
| deploying = "deploying" | |
| deploying_skipped = "deploying_skipped" | |
| deploying_failed = "deploying_failed" | |
| cls.building_image: "Building Image", | |
| cls.building_image_failed: "Build Failed", | |
| cls.building_image_failed_timeout: "Build Timed Out", | |
| + cls.build_skipped: "Build Skipped", | |
| cls.deploying: "Deploying Image", | |
| cls.deploying_skipped: "Deployment Skipped", | |
| cls.deploying_failed: "Deployment Failed", | |
| cls.degraded: "Degraded", | |
| cls.expired: "Expired", | |
| cls.failed: "Failed", | |
| - }[status] | |
| + }.get(status, "Unknown") | |
| class Deployment(BaseModel): | |
| --- /dev/null | |
| +++ b/tests/test_deployment_status.py | |
| +from fastapi_cloud_cli.api._models import DeploymentStatus | |
| + | |
| + | |
| +def test_build_skipped_status_exists(): | |
| + # Fails today: DeploymentStatus has no build_skipped member (src/fastapi_cloud_cli/api/_models.py, class DeploymentStatus). | |
| + assert DeploymentStatus("build_skipped") is DeploymentStatus.build_skipped | |
| + | |
| + | |
| +def test_build_skipped_human_readable(): | |
| + # Fails today: no build_skipped member, so the lookup raises KeyError (src/fastapi_cloud_cli/api/_models.py, to_human_readable). | |
| + assert ( | |
| + DeploymentStatus.to_human_readable(DeploymentStatus.build_skipped) | |
| + == "Build Skipped" | |
| + ) | |
| + | |
| + | |
| +def test_unknown_status_returns_unknown(): | |
| + # Fails today: the dict lookup `}[status]` raises KeyError for a non-member (src/fastapi_cloud_cli/api/_models.py, to_human_readable). | |
| + assert DeploymentStatus.to_human_readable("some_new_status") == "Unknown" | |
| + | |
| + | |
| +def test_existing_labels_unchanged(): | |
| + # Fails today: "some_new_status" raises KeyError before the fix; guards the existing mapping. | |
| + assert DeploymentStatus.to_human_readable(DeploymentStatus.success) == "Ready" | |
| + assert ( | |
| + DeploymentStatus.to_human_readable(DeploymentStatus.verifying_skipped) | |
| + == "Verification Skipped" | |
| + ) | |
| + assert ( | |
| + DeploymentStatus.to_human_readable(DeploymentStatus.deploying_skipped) | |
| + == "Deployment Skipped" | |
| + ) | |
| + | |
| + | |
| +def test_every_member_has_a_label(): | |
| + # Fails today: build_skipped is missing, and any gap would surface as "Unknown". | |
| + for member in DeploymentStatus: | |
| + label = DeploymentStatus.to_human_readable(member) | |
| + assert isinstance(label, str) | |
| + assert label != "Unknown" | |