Download tests/test_environment_flow.py from jester1177/cloudnative-devops-debug-env: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/main/tests/test_environment_flow.py
- Command line
-
hf download hf://spaces/jester1177/cloudnative-devops-debug-env/tests/test_environment_flow.py
-
curl -L -o test_environment_flow.py https://huggingface.co/spaces/jester1177/cloudnative-devops-debug-env/resolve/main/tests/test_environment_flow.py
1.28 kB
| from server.environment import CloudNativeDebugEnvironment | |
| from server.models import Action, ActionType, FileEdit | |
| def test_episode_flow_fix_and_autocomplete(): | |
| env = CloudNativeDebugEnvironment() | |
| obs = env.reset(task_id="dockerfile_syntax", scenario_id="typo_filename", seed=7) | |
| assert obs.task_id == "dockerfile_syntax" | |
| assert obs.total_issues >= 1 | |
| action = Action( | |
| action_type=ActionType.REPLACE_LINE, | |
| edits=[ | |
| FileEdit( | |
| file_path="Dockerfile", | |
| line_number=3, | |
| new_content="COPY requirements.txt .", | |
| ) | |
| ], | |
| reasoning="Fix typo in requirements filename", | |
| ) | |
| next_obs, reward, done, info = env.step(action) | |
| assert reward > 0 | |
| assert info["issues_fixed"] >= 1 | |
| assert done is True | |
| assert next_obs.issues_fixed >= 1 | |
| def test_submit_runs_combined_simulation(): | |
| env = CloudNativeDebugEnvironment() | |
| env.reset(task_id="workflow_secrets_permissions", scenario_id="missing_env_secrets", seed=42) | |
| obs, reward, done, info = env.step(Action(action_type=ActionType.SUBMIT, reasoning="validate")) | |
| assert done is True | |
| assert "issues_total" in info | |
| assert reward >= 0.0 | |
| assert obs.task_id == "workflow_secrets_permissions" | |