Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /tests /test_checkup_target.py
| from __future__ import annotations | |
| from pathlib import Path | |
| import pytest | |
| from pdd.checkup_target import CheckupTargetKind, classify_checkup_target, is_prompt_shaped_target | |
| def test_classify_prompt_file_target() -> None: | |
| assert classify_checkup_target("prompts/foo_python.prompt") == CheckupTargetKind.PROMPT_FILE | |
| def test_classify_prompt_directory_target(tmp_path: Path) -> None: | |
| prompts_dir = tmp_path / "prompts" | |
| prompts_dir.mkdir() | |
| assert classify_checkup_target("prompts", project_root=tmp_path) == CheckupTargetKind.PROMPT_DIRECTORY | |
| def test_classify_directory_with_prompts_is_prompt_directory(tmp_path: Path) -> None: | |
| nested = tmp_path / "feature" | |
| nested.mkdir() | |
| (nested / "foo_python.prompt").write_text("% test\n", encoding="utf-8") | |
| assert ( | |
| classify_checkup_target("feature", project_root=tmp_path) | |
| == CheckupTargetKind.PROMPT_DIRECTORY | |
| ) | |
| def test_classify_non_prompt_directory_is_not_prompt_directory(tmp_path: Path) -> None: | |
| src = tmp_path / "src" | |
| src.mkdir() | |
| (src / "module.py").write_text("x = 1\n", encoding="utf-8") | |
| # A bare source directory must not be treated as a prompt directory; it | |
| # falls through to devunit/unknown handling instead of "No .prompt files". | |
| assert ( | |
| classify_checkup_target("src/", project_root=tmp_path) | |
| == CheckupTargetKind.UNKNOWN | |
| ) | |
| assert is_prompt_shaped_target("src/", project_root=tmp_path) is False | |
| def test_classify_directory_named_prompts_without_files(tmp_path: Path) -> None: | |
| (tmp_path / "prompts").mkdir() | |
| assert ( | |
| classify_checkup_target("prompts", project_root=tmp_path) | |
| == CheckupTargetKind.PROMPT_DIRECTORY | |
| ) | |
| def test_classify_devunit_target() -> None: | |
| assert classify_checkup_target("refund_payment") == CheckupTargetKind.DEVUNIT | |
| def test_classify_github_issue_target() -> None: | |
| assert ( | |
| classify_checkup_target("https://github.com/org/repo/issues/123") | |
| == CheckupTargetKind.GITHUB_ISSUE | |
| ) | |
| def test_is_prompt_shaped_target_for_devunit(tmp_path: Path) -> None: | |
| prompts_dir = tmp_path / "prompts" | |
| prompts_dir.mkdir() | |
| (prompts_dir / "refund_payment_python.prompt").write_text("% test\n", encoding="utf-8") | |
| assert is_prompt_shaped_target("refund_payment", project_root=tmp_path) is True | |
| def test_is_prompt_shaped_target_for_unresolved_devunit(tmp_path: Path) -> None: | |
| assert is_prompt_shaped_target("refund_payment", project_root=tmp_path) is False | |
| def test_is_prompt_shaped_target_for_issue_url() -> None: | |
| assert is_prompt_shaped_target("https://github.com/org/repo/issues/123") is False | |
Xet Storage Details
- Size:
- 2.64 kB
- Xet hash:
- e1db28c6e6639a5de34ce148b1ed356f9667666b0fc2120a4d2b07be2a22f636
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.