From 537bb1b61b02d1df8ef8ecd4a7a52ebd7f1ba01b Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Fri, 17 Apr 2026 05:09:55 +0000 Subject: [PATCH] fix(#201): convert helper test_* functions to check_*, add pytest-compatible tests --- scripts/test_harvest_prompt_comprehensive.py | 44 +++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/scripts/test_harvest_prompt_comprehensive.py b/scripts/test_harvest_prompt_comprehensive.py index 8f1ee0b..11d0f7b 100644 --- a/scripts/test_harvest_prompt_comprehensive.py +++ b/scripts/test_harvest_prompt_comprehensive.py @@ -8,7 +8,7 @@ import json import re from pathlib import Path -def test_prompt_structure(): +def check_prompt_structure(): """Test that the prompt has the required structure.""" prompt_path = Path("templates/harvest-prompt.md") if not prompt_path.exists(): @@ -52,7 +52,7 @@ def test_prompt_structure(): return True, "Prompt structure is valid" -def test_confidence_scoring(): +def check_confidence_scoring(): """Test that confidence scoring is properly defined.""" prompt_path = Path("templates/harvest-prompt.md") content = prompt_path.read_text() @@ -74,7 +74,7 @@ def test_confidence_scoring(): return True, "Confidence scoring is properly defined" -def test_example_quality(): +def check_example_quality(): """Test that examples are clear and complete.""" prompt_path = Path("templates/harvest-prompt.md") content = prompt_path.read_text() @@ -100,7 +100,7 @@ def test_example_quality(): return True, "Examples are clear and complete" -def test_constraint_coverage(): +def check_constraint_coverage(): """Test that constraints cover all requirements.""" prompt_path = Path("templates/harvest-prompt.md") content = prompt_path.read_text() @@ -120,7 +120,7 @@ def test_constraint_coverage(): return True, "Constraints cover all requirements" -def test_test_sessions(): +def check_test_sessions(): """Test that test sessions exist and are valid.""" test_sessions_dir = Path("test_sessions") if not test_sessions_dir.exists(): @@ -147,11 +147,11 @@ def test_test_sessions(): def run_all_tests(): """Run all tests and return results.""" tests = [ - ("Prompt Structure", test_prompt_structure), - ("Confidence Scoring", test_confidence_scoring), - ("Example Quality", test_example_quality), - ("Constraint Coverage", test_constraint_coverage), - ("Test Sessions", test_test_sessions) + ("Prompt Structure", check_prompt_structure), + ("Confidence Scoring", check_confidence_scoring), + ("Example Quality", check_example_quality), + ("Constraint Coverage", check_constraint_coverage), + ("Test Sessions", check_test_sessions) ] results = [] @@ -195,6 +195,30 @@ def run_all_tests(): return all_passed, results + + +# --- Pytest-compatible tests --- + +def test_prompt_structure(): + passed, msg = check_prompt_structure() + assert passed, msg + +def test_confidence_scoring(): + passed, msg = check_confidence_scoring() + assert passed, msg + +def test_example_quality(): + passed, msg = check_example_quality() + assert passed, msg + +def test_constraint_coverage(): + passed, msg = check_constraint_coverage() + assert passed, msg + +def test_test_sessions(): + passed, msg = check_test_sessions() + assert passed, msg + if __name__ == "__main__": all_passed, results = run_all_tests()