|
| 1 | +"""Tests for test generation configuration. |
| 2 | +
|
| 3 | +Module: workflows/test_gen/config.py (88 lines) |
| 4 | +""" |
| 5 | + |
| 6 | +import pytest |
| 7 | + |
| 8 | +from empathy_os.workflows.test_gen.config import ( |
| 9 | + DEFAULT_SKIP_PATTERNS, |
| 10 | + TEST_GEN_STEPS, |
| 11 | +) |
| 12 | +from empathy_os.workflows.step_config import WorkflowStepConfig |
| 13 | + |
| 14 | + |
| 15 | +# ============================================================================ |
| 16 | +# DEFAULT_SKIP_PATTERNS Tests |
| 17 | +# ============================================================================ |
| 18 | + |
| 19 | + |
| 20 | +@pytest.mark.unit |
| 21 | +class TestDefaultSkipPatterns: |
| 22 | + """Test suite for DEFAULT_SKIP_PATTERNS constant.""" |
| 23 | + |
| 24 | + def test_skip_patterns_is_list(self): |
| 25 | + """Test that DEFAULT_SKIP_PATTERNS is a list.""" |
| 26 | + assert isinstance(DEFAULT_SKIP_PATTERNS, list) |
| 27 | + |
| 28 | + def test_skip_patterns_not_empty(self): |
| 29 | + """Test that DEFAULT_SKIP_PATTERNS is not empty.""" |
| 30 | + assert len(DEFAULT_SKIP_PATTERNS) > 0 |
| 31 | + |
| 32 | + def test_skip_patterns_contains_git(self): |
| 33 | + """Test that skip patterns includes .git directory.""" |
| 34 | + assert ".git" in DEFAULT_SKIP_PATTERNS |
| 35 | + |
| 36 | + def test_skip_patterns_contains_pycache(self): |
| 37 | + """Test that skip patterns includes __pycache__.""" |
| 38 | + assert "__pycache__" in DEFAULT_SKIP_PATTERNS |
| 39 | + |
| 40 | + def test_skip_patterns_contains_node_modules(self): |
| 41 | + """Test that skip patterns includes node_modules.""" |
| 42 | + assert "node_modules" in DEFAULT_SKIP_PATTERNS |
| 43 | + |
| 44 | + def test_skip_patterns_contains_venv(self): |
| 45 | + """Test that skip patterns includes venv directories.""" |
| 46 | + assert "venv" in DEFAULT_SKIP_PATTERNS |
| 47 | + assert ".venv" in DEFAULT_SKIP_PATTERNS |
| 48 | + |
| 49 | + def test_skip_patterns_all_strings(self): |
| 50 | + """Test that all skip patterns are strings.""" |
| 51 | + for pattern in DEFAULT_SKIP_PATTERNS: |
| 52 | + assert isinstance(pattern, str) |
| 53 | + |
| 54 | + |
| 55 | +# ============================================================================ |
| 56 | +# TEST_GEN_STEPS Tests |
| 57 | +# ============================================================================ |
| 58 | + |
| 59 | + |
| 60 | +@pytest.mark.unit |
| 61 | +class TestTestGenSteps: |
| 62 | + """Test suite for TEST_GEN_STEPS constant.""" |
| 63 | + |
| 64 | + def test_steps_is_dict(self): |
| 65 | + """Test that TEST_GEN_STEPS is a dictionary.""" |
| 66 | + assert isinstance(TEST_GEN_STEPS, dict) |
| 67 | + |
| 68 | + def test_steps_has_identify(self): |
| 69 | + """Test that TEST_GEN_STEPS has identify step.""" |
| 70 | + assert "identify" in TEST_GEN_STEPS |
| 71 | + assert isinstance(TEST_GEN_STEPS["identify"], WorkflowStepConfig) |
| 72 | + |
| 73 | + def test_steps_has_analyze(self): |
| 74 | + """Test that TEST_GEN_STEPS has analyze step.""" |
| 75 | + assert "analyze" in TEST_GEN_STEPS |
| 76 | + assert isinstance(TEST_GEN_STEPS["analyze"], WorkflowStepConfig) |
| 77 | + |
| 78 | + def test_steps_has_generate(self): |
| 79 | + """Test that TEST_GEN_STEPS has generate step.""" |
| 80 | + assert "generate" in TEST_GEN_STEPS |
| 81 | + assert isinstance(TEST_GEN_STEPS["generate"], WorkflowStepConfig) |
| 82 | + |
| 83 | + def test_steps_has_review(self): |
| 84 | + """Test that TEST_GEN_STEPS has review step.""" |
| 85 | + assert "review" in TEST_GEN_STEPS |
| 86 | + assert isinstance(TEST_GEN_STEPS["review"], WorkflowStepConfig) |
| 87 | + |
| 88 | + def test_steps_count(self): |
| 89 | + """Test that TEST_GEN_STEPS has exactly 4 steps.""" |
| 90 | + assert len(TEST_GEN_STEPS) == 4 |
| 91 | + |
| 92 | + def test_identify_step_tier_cheap(self): |
| 93 | + """Test that identify step uses cheap tier.""" |
| 94 | + assert TEST_GEN_STEPS["identify"].tier_hint == "cheap" |
| 95 | + |
| 96 | + def test_analyze_step_tier_capable(self): |
| 97 | + """Test that analyze step uses capable tier.""" |
| 98 | + assert TEST_GEN_STEPS["analyze"].tier_hint == "capable" |
| 99 | + |
| 100 | + def test_generate_step_tier_capable(self): |
| 101 | + """Test that generate step uses capable tier.""" |
| 102 | + assert TEST_GEN_STEPS["generate"].tier_hint == "capable" |
| 103 | + |
| 104 | + def test_review_step_tier_premium(self): |
| 105 | + """Test that review step uses premium tier.""" |
| 106 | + assert TEST_GEN_STEPS["review"].tier_hint == "premium" |
| 107 | + |
| 108 | + def test_all_steps_have_max_tokens(self): |
| 109 | + """Test that all steps have max_tokens configured.""" |
| 110 | + for step_name, step_config in TEST_GEN_STEPS.items(): |
| 111 | + assert step_config.max_tokens > 0 |
0 commit comments