
    i\                        d Z ddlZddlmc mZ ddlZddl	Z	ddl
Z
ddlmZ ddlZ ee      j                  j                  Zedz  Zej$                  j'                  de      Zg ZdZeeuZeZerej2                  ZdZeeuZeZesB ej:                  defdeef      d ej<                         v s ej>                  e      r ej@                  e      nd ej@                  e      d	z  Z!d
de!iz  Z"ejG                  e"       er ej:                  defdeef      d ej<                         v s ej>                  e      r ej@                  e      nd ej@                  e       ej@                  e      dz  Z$dde$iz  Z%ejG                  e%        ejL                  ed      i z  Z'dde'iz  Z( e) ejT                  e(            dxZxZxZxZxZxZZej$                  jW                  e      Z,e,e
jZ                  d<   ej2                  j]                  e,       dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6 e7e6      Z8dZ9e8e9k  Zes ej:                  defde8e9f      d ej<                         v s ej>                  e7      r ej@                  e7      ndd ej<                         v s ej>                  e6      r ej@                  e6      nd ej@                  e8       ej@                  e9      dz  Z: ejv                  d  e7e6             d!z   d"e:iz  Z< e) ejT                  e<            dxZ8xZZ9 G d# d$      Z= G d% d&      Z> G d' d(      Z? G d) d*      Z@ G d+ d,      ZA G d- d.      ZB G d/ d0      ZC G d1 d2      ZDy)3u0   Tests for skill-judge.py — TDD (RED → GREEN)    N)Pathzskill-judge.pyskill_judgeis not)z%(py2)s is not %(py5)sspec)py2py5z%(py7)spy7)z5%(py11)s
{%(py11)s = %(py9)s.loader
} is not %(py14)s)py9py11py14z%(py16)spy16zassert %(py19)spy19aB  # MySkill

## Description
This skill does something very useful. It can help users accomplish tasks
efficiently by providing structured guidance. The skill is designed for
developers who need to perform complex operations quickly.

## When to Use
Use this skill when the user asks about automated tasks or when you need
to perform repetitive operations. Trigger on keywords like "automate" or
"batch process". This applies broadly to workflow automation scenarios.

## Instructions
Follow these steps:
1. First, analyze the input carefully
2. Then, prepare the execution environment
3. Execute the main logic with proper error handling
4. Validate the output against expected criteria
5. Report results clearly

```python
def example():
    return "done"
```

- Step A: Do the first thing
- Step B: Do the second thing
- Step C: Finalize and clean up

## Output Format
The output should be structured as follows:
- Summary section with key metrics
- Detailed breakdown by category
- Recommendations for next steps

```json
{
  "status": "success",
  "result": "value"
}
```

## Examples
Here is a usage example:

```bash
python3 my_script.py --input file.txt --output result.json
```

Example 1: Basic usage
  Input: simple text file
  Output: processed JSON

Example 2: Advanced usage
  Input: complex dataset
  Output: detailed analysis report
z## Description
Short description.

## When to Use
Trigger condition here.

## Instructions
Do something.

## Output Format
Some output.

## Examples
An example.
aG  ## Overview
This is an overview section with sufficient content to pass the minimum
length requirement. It describes what the skill does in detail.

## Trigger
When this happens, use the skill. Multiple trigger conditions apply here
and should be considered carefully before invoking.

## Workflow
Step 1: Do this
Step 2: Do that
Step 3: Complete
- bullet item one
- bullet item two

## Output
The result will be formatted like this with proper structure and details
about the expected output format for this skill.

## Example
Here is one example of how to use this skill properly.
ue  ## 개요
이 스킬은 매우 유용한 작업을 수행합니다. 사용자가 복잡한 작업을
효율적으로 완료할 수 있도록 구조화된 지침을 제공합니다.

## 사용 시점
자동화 작업이 필요할 때 이 스킬을 사용하세요. 반복 작업이나
배치 처리가 필요한 상황에서 활성화됩니다.

## 지침
다음 단계를 따르세요:
1. 입력을 신중하게 분석합니다
2. 실행 환경을 준비합니다
3. 적절한 오류 처리와 함께 주요 로직을 실행합니다

```python
def 예시():
    return "완료"
```

## 출력 형식
출력은 다음과 같이 구조화됩니다:
- 주요 지표가 있는 요약 섹션
- 카테고리별 세부 분류
- 다음 단계에 대한 권장 사항

## 예시
사용 예시는 다음과 같습니다:

```bash
python3 스크립트.py --입력 파일.txt
```
a  ## Description
This skill has description and instructions but is missing other sections.
The description is detailed enough to pass the minimum length requirement.

## Instructions
Here are the steps:
1. Do the first thing
2. Do the second thing
3. Finish up
 z## Description
Short.
z## Description
A description.

## When to Use
Some trigger.

## Instructions
Do something with steps.

## Output Format
Some format.

## Examples
An example.
i  <)z/%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} < %(py6)slenPENALTY_CONTENTpy0py1py3py6zPENALTY_CONTENT too long: 
>assert %(py8)spy8c                   Z    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zy)TestParseSkillSectionsc                 J   t         j                  t              }|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d
   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y NdescriptionfoundTisz%(py1)s is %(py4)sr   py4assert %(py6)sr   when_to_useinstructionsoutput_formatexamplessjparse_skill_sectionsFULL_SKILL_MD
@pytest_ar_call_reprcompare	_safereprAssertionError_format_explanationselfresult@py_assert0@py_assert3@py_assert2@py_format5@py_format7s          5/home/jay/workspace/scripts/tests/test_skill_judge.py)test_parses_all_english_standard_sectionsz@TestParseSkillSections.test_parses_all_english_standard_sections   s   ((7m$W-55-5555-555-5555555555m$W-55-5555-555-5555555555n%g.6$6.$6666.$666.666$6666666o&w/747/47777/4777/77747777777j!'*2d2*d2222*d222*222d2222222    c                 J   t         j                  t              }|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d
   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y r   )r-   r.   ENGLISH_ALTERNATE_TITLESr0   r1   r2   r3   r4   r5   s          r=   $test_parses_alternate_english_titlesz;TestParseSkillSections.test_parses_alternate_english_titles   s   (()ABm$W-55-5555-555-5555555555m$W-55-5555-555-5555555555n%g.6$6.$6666.$666.666$6666666o&w/747/47777/4777/77747777777j!'*2d2*d2222*d222*222d2222222r?   c                 J   t         j                  t              }|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d
   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y r   )r-   r.   KOREAN_TITLES_MDr0   r1   r2   r3   r4   r5   s          r=   test_parses_korean_titlesz0TestParseSkillSections.test_parses_korean_titles   s   (()9:m$W-55-5555-555-5555555555m$W-55-5555-555-5555555555n%g.6$6.$6666.$666.666$6666666o&w/747/47777/4777/77747777777j!'*2d2*d2222*d222*222d2222222r?   c                 J   t         j                  t              }|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d
   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )Nr    r!   Tr"   r$   r%   r'   r   r)   r(   Fr*   r+   r-   r.   MISSING_SECTIONS_MDr0   r1   r2   r3   r4   r5   s          r=   &test_missing_sections_marked_not_foundz=TestParseSkillSections.test_missing_sections_marked_not_found   s   (()<=m$W-55-5555-555-5555555555n%g.6$6.$6666.$666.666$6666666m$W-66-6666-666-6666666666o&w/858/58888/5888/88858888888j!'*3e3*e3333*e333*333e3333333r?   c                 H   t         j                  t              }dD ]  }||   d   }d}||u }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}} y )	Nr    r(   r)   r*   r+   r!   Fr"   r$   r%   r'   r   )r-   r.   EMPTY_CONTENTr0   r1   r2   r3   r4   )r6   r7   sectionr8   r9   r:   r;   r<   s           r=   'test_empty_content_all_sections_missingz>TestParseSkillSections.test_empty_content_all_sections_missing   sw    ((7b 	5G'?7+4u4+u4444+u444+444u4444444	5r?   c                 B   t         j                  t              }|d   d   }d}||kD  }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d
}||kD  }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )Nr    length2   >)z%(py1)s > %(py4)sr%   r'   r   r)      r,   r5   s          r=   $test_section_content_length_capturedz;TestParseSkillSections.test_section_content_length_captured   s    ((7m$X.33.3333.333.3333333333n%h/5#5/#5555/#555/555#5555555r?   c           	         t         j                  t              }|j                  } |       }t	        |      }h d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	N>   r+   r    r(   r)   r*   ==)zb%(py7)s
{%(py7)s = %(py0)s(%(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.keys
}()
})
} == %(py10)ssetr7   )r   r   r   r	   r
   py10assert %(py12)spy12)r-   r.   r/   keysrY   r0   r1   @py_builtinslocals_should_repr_global_namer2   r3   r4   )	r6   r7   r:   @py_assert4@py_assert6@py_assert9@py_assert8@py_format11@py_format13s	            r=   $test_returns_dict_with_all_five_keysz;TestParseSkillSections.test_returns_dict_with_all_five_keys   sX   ((7;; 	
;= 	
s=! 	
 &
 	
! &
 
 	
 	
 	
! &
 	
 	
 
6	
 	
   	
 	
 
	  	
 	
 
6	
 	
   	
 	
 
	  	
 	
 
	  	
 	
 
	 ! 	
 	
 
	 " 	
 	
 
	&
 	
 	
 	
 	
 	
 	
 	
r?   c                    t         j                  t              }|j                         D ]@  \  }}d}||v }|st	        j
                  d|fd||f      t	        j                  |      dt        j                         v st	        j                  |      rt	        j                  |      nddz  }t	        j                  d|       dz   d|iz  }t        t	        j                  |            d x}}d	}||v }|st	        j
                  d|fd||f      t	        j                  |      dt        j                         v st	        j                  |      rt	        j                  |      nddz  }t	        j                  d
|       dz   d|iz  }t        t	        j                  |            d x}}d}||v }|st	        j
                  d|fd||f      t	        j                  |      dt        j                         v st	        j                  |      rt	        j                  |      nddz  }t	        j                  d|       dz   d|iz  }t        t	        j                  |            d x}}C y )Nr!   inz%(py1)s in %(py3)svalr   r   zMissing 'found' in 
>assert %(py5)sr	   rP   zMissing 'length' in contentzMissing 'content' in )r-   r.   r/   itemsr0   r1   r2   r^   r_   r`   _format_assertmsgr3   r4   )r6   r7   keyrl   r8   r:   @py_format4@py_format6s           r=   2test_each_section_has_found_and_length_and_contentzITestParseSkillSections.test_each_section_has_found_and_length_and_content   sr   ((7 	CHC>7c>>>>7c>>>7>>>>>>c>>>c>>>>%8#>>>>>>>@8s?@@@8s@@@8@@@@@@s@@@s@@@@&:3%$@@@@@@@B9#BBB9BBB9BBBBBBBBBBBBB'<SE%BBBBBBBB	Cr?   c                 H   t         j                  t              }|d   d   }d}||k(  }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d	   d   }d}||k(  }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}|d
   d   }d}||k(  }|slt        j                  d|fd||f      t        j
                  |      t        j
                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )Nr(   rP   r   rW   )z%(py1)s == %(py4)sr%   r'   r   r*   r+   rG   r5   s          r=   &test_not_found_section_has_zero_lengthz=TestParseSkillSections.test_not_found_section_has_zero_length  s   (()<=m$X.3!3.!3333.!333.333!3333333o&x05A50A55550A5550555A5555555j!(+0q0+q0000+q000+000q0000000r?   c                 6   d}t         j                  |      }|d   d   }d}||u }|slt        j                  d|fd||f      t        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Na  ## Rules
Do this and that with careful consideration.
## Rules
Do this and that with careful consideration.
## Rules
Do this and that with careful consideration.
## Rules
Do this and that with careful consideration.
## Rules
Do this and that with careful consideration.
r)   r!   Tr"   r$   r%   r'   r   r-   r.   r0   r1   r2   r3   r4   r6   ro   r7   r8   r9   r:   r;   r<   s           r=   %test_rules_title_maps_to_instructionsz<TestParseSkillSections.test_rules_title_maps_to_instructions  sn    P((1n%g.6$6.$6666.$666.666$6666666r?   c                 6   d}t         j                  |      }|d   d   }d}||u }|slt        j                  d|fd||f      t        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Nu  ## 설명
이것은 설명입니다.
설명 내용이 충분히 길어야 합니다.설명 내용이 충분히 길어야 합니다.설명 내용이 충분히 길어야 합니다.설명 내용이 충분히 길어야 합니다.설명 내용이 충분히 길어야 합니다.r    r!   Tr"   r$   r%   r'   r   ry   rz   s           r=   %   test_설명_title_maps_to_descriptionu<   TestParseSkillSections.test_설명_title_maps_to_description  sn    s((1m$W-55-5555-555-5555555555r?   c                 6   d}t         j                  |      }|d   d   }d}||u }|slt        j                  d|fd||f      t        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Nu   ## 트리거
이 조건에서 사용하세요.
트리거 조건 설명.트리거 조건 설명.트리거 조건 설명.트리거 조건 설명.트리거 조건 설명.r(   r!   Tr"   r$   r%   r'   r   ry   rz   s           r=   (   test_트리거_title_maps_to_when_to_useu?   TestParseSkillSections.test_트리거_title_maps_to_when_to_use  sn    f((1m$W-55-5555-555-5555555555r?   c                 6   d}t         j                  |      }|d   d   }d}||u }|slt        j                  d|fd||f      t        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Nu   ## 결과물
결과는 이렇게 나옵니다.
결과 형식 설명.결과 형식 설명.결과 형식 설명.결과 형식 설명.결과 형식 설명.r*   r!   Tr"   r$   r%   r'   r   ry   rz   s           r=   *   test_결과물_title_maps_to_output_formatuA   TestParseSkillSections.test_결과물_title_maps_to_output_format  sn    c((1o&w/747/47777/4777/77747777777r?   N)__name__
__module____qualname__r>   rB   rE   rI   rN   rU   rg   ru   rw   r{   r}   r   r    r?   r=   r   r      sD    33345
6

C17
6
6
8r?   r   c                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestScoreSectionc                 N   t         j                  dd      }|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}|j                  }d
}||u }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )Nr    r   r   rW   z-%(py2)s
{%(py2)s = %(py0)s.score
} == %(py5)sscorer   r   r	   assert %(py7)sr
   Fr"   z-%(py2)s
{%(py2)s = %(py0)s.found
} is %(py5)sr-   score_sectionr   r0   r1   r^   r_   r`   r2   r3   r4   r!   r6   r   @py_assert1ra   r9   rt   @py_format8s          r=   test_empty_content_scores_zeroz/TestScoreSection.test_empty_content_scores_zero%  s      3{{a{a{auu{a{{#e#{e####{e######u###u###{###e#######r?   c                 N   t         j                  dd      }|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}|j                  }d
}||u }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )Nr    zShort text.   rW   r   r   r   r   r
   Tr"   r   r   r   s          r=   test_short_content_scores_fivez/TestScoreSection.test_short_content_scores_five*  s      >{{a{a{auu{a{{"d"{d""""{d""""""u"""u"""{"""d"""""""r?   c                    d}t         j                  d|      }|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
NzOThis is a description that is definitely longer than fifty characters in total.r    
   rW   r   r   r   r   r
   r-   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r6   ro   r   r   ra   r9   rt   r   s           r=   %test_content_over_50_chars_scores_tenz6TestScoreSection.test_content_over_50_chars_scores_ten0  s    c  8{{ b {b    {b      u   u   {   b       r?   c                    d}t         j                  d|      }|j                  }d}||k\  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
NzCDescription.
```python
code here
```
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr       >=z-%(py2)s
{%(py2)s = %(py0)s.score
} >= %(py5)sr   r   r   r
   r   r   s           r=   -test_content_with_code_block_adds_specificityz>TestScoreSection.test_content_with_code_block_adds_specificity5  s    H  8{{ b {b    {b      u   u   {   b       r?   c                    d}t         j                  d|      }|j                  }d}||k\  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
NzoSome content with a list.
- item one
- item two
- item three
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr    r   r   r   r   r   r   r
   r   r   s           r=   'test_content_with_list_adds_specificityz8TestScoreSection.test_content_with_list_adds_specificity:  s    `  8{{ b {b    {b      u   u   {   b       r?   c                    d}t         j                  d|      }|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Na  A very detailed description of the skill.
- Point one
- Point two
- Point three
```python
code example
```
A very detailed description of the skill.
- Point one
- Point two
- Point three
```python
code example
```
A very detailed description of the skill.
- Point one
- Point two
- Point three
```python
code example
```
A very detailed description of the skill.
- Point one
- Point two
- Point three
```python
code example
```
A very detailed description of the skill.
- Point one
- Point two
- Point three
```python
code example
```
r       rW   r   r   r   r   r
   r   r   s           r=   )test_full_marks_for_comprehensive_sectionz:TestScoreSection.test_full_marks_for_comprehensive_section?  s    
   8{{ b {b    {b      u   u   {   b       r?   c                    t         j                  dd      }d}t        ||      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }t        t        j                  |            d x}}d}t        ||      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }t        t        j                  |            d x}}d}t        ||      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }t        t        j                  |            d x}}y )	Nr    zSome content here.r   5assert %(py5)s
{%(py5)s = %(py0)s(%(py1)s, %(py3)s)
}hasattrr   r   r   r	   r!   rP   )
r-   r   r   r^   r_   r0   r`   r2   r3   r4   )r6   r   r:   ra   rt   s        r=   #test_score_is_sectioncore_dataclassz4TestScoreSection.test_score_is_sectioncore_dataclassH  s     0DE%&wug&&&&&&&&w&&&w&&&&&&u&&&u&&&g&&&&&&&&&&%&wug&&&&&&&&w&&&w&&&&&&u&&&u&&&g&&&&&&&&&&&'wuh''''''''w'''w''''''u'''u'''h''''''''''r?   c                    d}t         j                  d|      }|j                  }d}||k  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Na"  Extremely detailed content.
- item
```code```
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr)   r   <=)z-%(py2)s
{%(py2)s = %(py0)s.score
} <= %(py5)sr   r   r   r
   r   r   s           r=   $test_max_score_per_section_is_twentyz5TestScoreSection.test_max_score_per_section_is_twentyN  s    Q  9{{ b {b    {b      u   u   {   b       r?   c                    d}t         j                  d|      }|j                  }t        |      }||k(  }|s7t	        j
                  d|fd||f      dt        j                         v st	        j                  |      rt	        j                  |      ndt	        j                  |      dt        j                         v st	        j                  t              rt	        j                  t              nddt        j                         v st	        j                  |      rt	        j                  |      ndt	        j                  |      dz  }d	d
|iz  }t        t	        j                  |            d x}x}}y )NzHello, world!r    rW   )zL%(py2)s
{%(py2)s = %(py0)s.length
} == %(py7)s
{%(py7)s = %(py4)s(%(py5)s)
}r   r   ro   r   r   r&   r	   r
   assert %(py9)sr   )r-   r   rP   r   r0   r1   r^   r_   r`   r2   r3   r4   )r6   ro   r   r   rb   r9   r   @py_format10s           r=   *test_length_reflects_actual_content_lengthz;TestScoreSection.test_length_reflects_actual_content_lengthS  s    !  8||+s7|+||++++||++++++u+++u+++|++++++s+++s++++++7+++7+++|+++++++r?   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r?   r=   r   r   $  s/    $
#!
!
!
!(!
,r?   r   c                   `    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zy)TestEvaluateSkillc                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k\  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	NSKILL.mdK   r   )z3%(py2)s
{%(py2)s = %(py0)s.total_score
} >= %(py5)sr7   r   r   r
   )
write_textr/   r-   evaluate_skillstrtotal_scorer0   r1   r^   r_   r`   r2   r3   r4   	r6   tmp_path
skill_filer7   r   ra   r9   rt   r   s	            r=   test_full_skill_gets_high_scorez1TestEvaluateSkill.test_full_skill_gets_high_score]  s    
*
m,""3z?3!!'R'!R''''!R''''''v'''v'''!'''R'''''''r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   r   r   )z2%(py2)s
{%(py2)s = %(py0)s.total_score
} < %(py5)sr7   r   r   r
   )r   MINIMAL_SKILL_MDr-   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   #test_minimal_skill_gets_lower_scorez5TestEvaluateSkill.test_minimal_skill_gets_lower_scorec  s    
*
./""3z?3!!&B&!B&&&&!B&&&&&&v&&&v&&&!&&&B&&&&&&&r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   r   r   z3%(py2)s
{%(py2)s = %(py0)s.total_score
} <= %(py5)sr7   r   r   r
   )r   rL   r-   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   (test_empty_file_scores_zero_or_near_zeroz:TestEvaluateSkill.test_empty_file_scores_zero_or_near_zeroi  s    
*
m,""3z?3!!&Q&!Q&&&&!Q&&&&&&v&&&v&&&!&&&Q&&&&&&&r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}| }||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }	t        t        j                  |	            d x}x}x}}y )	Nr   r   rW   )z2%(py2)s
{%(py2)s = %(py0)s.penalties
} == -%(py5)sr7   r   assert %(py8)sr   )r   r   r-   r   r   	penaltiesr0   r1   r^   r_   r`   r2   r3   r4   )
r6   r   r   r7   r   ra   rb   r9   r<   @py_format9s
             r=   #test_penalty_applied_for_short_filez5TestEvaluateSkill.test_penalty_applied_for_short_fileo  s    
*
o.""3z?3&B&B3&3&&&&3&&&&&&v&&&v&&&&&&B&&&&&&&r?   c                    |dz  }t         dz   ddz  z   }t        |      }d}||k\  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t              rt        j                  t              ndd	t	        j
                         v st        j                  |      rt        j                  |      nd	t        j                  |      t        j                  |      d
z  }t        j                  dt        |             dz   d|iz  }t        t        j                  |            d x}x}}|j                  |       t        j                  t        |            }	|	j                  }
d}|
|k(  }|st        j                  d|fd|
|f      dt	        j
                         v st        j                  |	      rt        j                  |	      ndt        j                  |
      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}
x}}y )Nr   
zAdditional content.
iX  '  r   z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} >= %(py6)sr   long_contentr   zContent too short: r   r   r   rW   z/%(py2)s
{%(py2)s = %(py0)s.bonuses
} == %(py5)sr7   r   r   r
   )r/   r   r0   r1   r^   r_   r`   r2   rq   r3   r4   r   r-   r   r   bonuses)r6   r   r   r   r:   @py_assert5ra   r<   r   r7   r   r9   rt   r   s                 r=    test_bonus_applied_for_long_filez2TestEvaluateSkill.test_bonus_applied_for_long_fileu  sY   
*
$t+.E.KK< TET E)TTT ETTTTTTsTTTsTTTTTT<TTT<TTT TTTETTT-@\AR@S+TTTTTTTTl+""3z?3~~""~""""~""""""v"""v"""~""""""""""r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   r   rW   r   r7   r   r   r
   )r   r/   r-   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   test_no_bonus_for_medium_lengthz1TestEvaluateSkill.test_no_bonus_for_medium_length}  s    
*
m,""3z?3~~""~""""~""""""v"""v"""~""""""""""r?   c                 ,   |dz  }|j                  t               t        j                  t	        |            }|j
                  }t	        |      }||k(  }|s7t        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y 
Nr   rW   )zP%(py2)s
{%(py2)s = %(py0)s.skill_path
} == %(py7)s
{%(py7)s = %(py4)s(%(py5)s)
}r7   r   r   r   r   r   )r   r/   r-   r   r   
skill_pathr0   r1   r^   r_   r`   r2   r3   r4   	r6   r   r   r7   r   rb   r9   r   r   s	            r=   test_result_has_skill_pathz,TestEvaluateSkill.test_result_has_skill_path  s    
*
m,""3z?3  3C
O3 O3333 O333333v333v333 333333C333C333333
333
333O3333333r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }g d}||v }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   )ABCDFri   z-%(py2)s
{%(py2)s = %(py0)s.grade
} in %(py5)sr7   r   r   r
   )r   r/   r-   r   r   grader0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   test_result_has_gradez'TestEvaluateSkill.test_result_has_grade  s    
*
m,""3z?3||888|88888|8888888v888v888|88888888888r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   z
rule-basedrW   z,%(py2)s
{%(py2)s = %(py0)s.mode
} == %(py5)sr7   r   r   r
   )r   r/   r-   r   r   moder0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   test_result_mode_is_rule_basedz0TestEvaluateSkill.test_result_mode_is_rule_based  s    
*
m,""3z?3{{*l*{l****{l******v***v***{***l*******r?   c                    |dz  }|j                  t               t        j                  t	        |            }d}t        ||      }|sddt        j                         v st        j                  t
              rt        j                  t
              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }t        t        j                  |            d x}}|j                  }t        |t              }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      d	t        j                         v st        j                  t              rt        j                  t              nd	t        j                  |      d
z  }t        t        j                  |            d x}}y )Nr   sectionsr   r   r7   r   zSassert %(py6)s
{%(py6)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.sections
}, %(py4)s)
}
isinstancedictr   r   r   r&   r   )r   r/   r-   r   r   r   r^   r_   r0   r`   r2   r3   r4   r   r   r   )	r6   r   r   r7   r:   ra   rt   r   r<   s	            r=   test_result_has_sections_dictz/TestEvaluateSkill.test_result_has_sections_dict  sC   
*
m,""3z?3)*wvz********w***w******v***v***z********** //0z/400000000z000z000000&000&000/000000400040000000000r?   c                     t        j                  t              5  t        j	                  d       d d d        y # 1 sw Y   y xY w)Nz/nonexistent/path/SKILL.md)pytestraisesFileNotFoundErrorr-   r   r6   s    r=   'test_missing_file_raises_file_not_foundz9TestEvaluateSkill.test_missing_file_raises_file_not_found  s3    ]],- 	<:;	< 	< 	<s	   9Ac                 4   |dz  }t         dz   dz   }|j                  |       t        j                  t	        |            }|j
                  dk\  r|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      d	z  }d
d|iz  }	t        t        j                  |	            d x}x}}y y )Nr   r   a  More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
More content.
Z   r   rW   z-%(py2)s
{%(py2)s = %(py0)s.grade
} == %(py5)sr7   r   r   r
   )r/   r   r-   r   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   )
r6   r   r   high_qualityr7   r   ra   r9   rt   r   s
             r=   test_grade_a_for_score_90_plusz0TestEvaluateSkill.test_grade_a_for_score_90_plus  s    
*
$t+.DDl+""3z?3#<<&3&<3&&&&<3&&&&&&6&&&6&&&<&&&3&&&&&&& $r?   c                 $   |dz  }|j                  t               t        j                  t	        |            }|j
                  dk  r|j                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y y )
Nr   ,   r   rW   r   r7   r   r   r
   )r   rL   r-   r   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   !test_grade_f_for_score_44_or_lessz3TestEvaluateSkill.test_grade_f_for_score_44_or_less  s    
*
m,""3z?3#<<&3&<3&&&&<3&&&&&&6&&&6&&&<&&&3&&&&&&& $r?   c                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }t        |t              }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dt        j                         v st        j                  t              rt        j                  t              ndt        j                  |      dz  }t        t        j                  |            d x}}y )Nr   zVassert %(py6)s
{%(py6)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.total_score
}, %(py4)s)
}r   r7   intr   )r   r/   r-   r   r   r   r   r   r^   r_   r0   r`   r2   r3   r4   )r6   r   r   r7   r:   r   r<   s          r=   test_total_score_is_intz)TestEvaluateSkill.test_total_score_is_int  s    
*
m,""3z?3 ,,2z,c22222222z222z222222&222&222,222222c222c2222222222r?   N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r?   r=   r   r   \  sH    ('''##49+1<''3r?   r   c                   Z    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zy)TestGradeBoundariesc                 j    |dz  }|j                  |       t        j                  t        |            S )Nr   )r   r-   r   r   )r6   r   ro   r   s       r=   _make_skill_with_scorez*TestGradeBoundaries._make_skill_with_score  s/    
*
g&  Z11r?   c                    | j                  |t              }|j                  }g d}||v }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )N)r   r   r   ri   r   r7   r   r   r
   )r  r   r   r0   r1   r^   r_   r`   r2   r3   r4   )r6   r   r7   r   ra   r9   rt   r   s           r=   test_grade_d_boundaryz)TestGradeBoundaries.test_grade_d_boundary  s    ,,X7GH||..|....|......v...v...|..........r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	Nr   r   rW   zS%(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.compute_grade
}(%(py4)s)
} == %(py9)sr-   r   r   r&   r   r   assert %(py11)sr   
r-   compute_grader0   r1   r^   r_   r`   r2   r3   r4   r6   r   r9   r   rd   @py_assert7r   @py_format12s           r=   test_compute_grade_directly_90z2TestGradeBoundaries.test_compute_grade_directly_90      **#*s*#s****#s******r***r*********#***s********r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	Nd   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_100z3TestGradeBoundaries.test_compute_grade_directly_100  s    ++$++$++++$++++++r+++r+++++++++$+++++++++++r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	NY   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_89z2TestGradeBoundaries.test_compute_grade_directly_89  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	Nr   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_75z2TestGradeBoundaries.test_compute_grade_directly_75  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	NJ   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_74z2TestGradeBoundaries.test_compute_grade_directly_74  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	N<   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_60z2TestGradeBoundaries.test_compute_grade_directly_60  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	N;   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_59z2TestGradeBoundaries.test_compute_grade_directly_59  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	N-   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_45z2TestGradeBoundaries.test_compute_grade_directly_45  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	Nr   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_44z2TestGradeBoundaries.test_compute_grade_directly_44  r  r?   c                    t         j                  }d} ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}}y )	Nr   r   rW   r  r-   r	  r
  r   r  r  s           r=   test_compute_grade_directly_0z1TestGradeBoundaries.test_compute_grade_directly_0  s    ))")c)"c))))"c))))))r)))r)))))))))")))c))))))))r?   c                 "   t         j                  }d}| } ||      }d}||k(  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |      t        j                  |      t        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}x}x}x}}y )	Nr   r   rW   )zU%(py7)s
{%(py7)s = %(py2)s
{%(py2)s = %(py0)s.compute_grade
}(-%(py4)s)
} == %(py10)sr-   )r   r   r&   r
   rZ   r[   r\   r  )	r6   r   r9   r   rb   rc   rd   re   rf   s	            r=   test_compute_grade_negativez/TestGradeBoundaries.test_compute_grade_negative  s    +++$++$++++$++++++r+++r+++++++++$+++++++++++r?   N)r   r   r   r  r  r  r  r  r  r  r  r"  r%  r'  r)  r+  r   r?   r=   r  r    sC    2
/
+,+++++++*,r?   r  c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	TestEvaluateDirectoryc                    t         j                  t        |            }g }||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }dd|iz  }t        t        j                  |            d x}}y )NrW   z%(py0)s == %(py3)sr7   r   r   assert %(py5)sr	   )r-   evaluate_directoryr   r0   r1   r^   r_   r`   r2   r3   r4   r6   r   r7   r:   r   rs   rt   s          r=   'test_empty_directory_returns_empty_listz=TestEvaluateDirectory.test_empty_directory_returns_empty_list  sn    &&s8}5v|vvvr?   c                    |dz  }|j                          |dz  j                  t               t        j	                  t        |            }t        |      }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }d	d
|iz  }t        t        j                  |            d x}x}}y )Nmyskillr      rW   z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sr   r7   r   r   r   )mkdirr   r/   r-   r2  r   r   r0   r1   r^   r_   r`   r2   r3   r4   )	r6   r   	skill_dirr7   r:   r   ra   r<   r   s	            r=   test_single_skill_in_directoryz4TestEvaluateDirectory.test_single_skill_in_directory  s    y(		Z	++M:&&s8}56{a{a{ass66{ar?   c                    t        d      D ]2  }|d| z  }|j                          |dz  j                  t               4 t        j                  t        |            }t        |      }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }d	d
|iz  }	t        t        j                  |	            d x}x}}y )N   skillr   rW   r8  r   r7   r   r   r   )ranger9  r   r/   r-   r2  r   r   r0   r1   r^   r_   r`   r2   r3   r4   )
r6   r   ir:  r7   r:   r   ra   r<   r   s
             r=   !test_multiple_skills_in_directoryz7TestEvaluateDirectory.test_multiple_skills_in_directory  s    q 	?A U1#;.IOO#//>	? &&s8}56{a{a{ass66{ar?   c                    |dz  j                  d       |dz  j                  d       t        j                  t        |            }g }||k(  }|st	        j
                  d|fd||f      dt        j                         v st	        j                  |      rt	        j                  |      ndt	        j                  |      dz  }d	d
|iz  }t        t	        j                  |            d x}}y )Nzother.mdznot a skillz	script.pyz# coderW   r/  r7   r0  r1  r	   )r   r-   r2  r   r0   r1   r^   r_   r`   r2   r3   r4   r3  s          r=   test_directory_with_no_skill_mdz5TestEvaluateDirectory.test_directory_with_no_skill_md  s    	J	**=9	K	++H5&&s8}5v|vvvr?   c                     t        j                  t        t        f      5  t        j                  d       d d d        y # 1 sw Y   y xY w)Nz/nonexistent/directory/path)r   r   r   NotADirectoryErrorr-   r2  r   s    r=   'test_nonexistent_directory_raises_errorz=TestEvaluateDirectory.test_nonexistent_directory_raises_error  s=    ]]-/ABC 	A!!"?@	A 	A 	As	   ?Ac                 @   |dz  }|j                          |dz  j                  t               t        j	                  t        |            }t        |      }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }d	d
|iz  }t        t        j                  |            d x}x}}|d   }	d}t        |	|      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |	      rt        j                  |	      ndt        j                  |      t        j                  |      dz  }
t        t        j                  |
            d x}}d}t        |	|      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |	      rt        j                  |	      ndt        j                  |      t        j                  |      dz  }
t        t        j                  |
            d x}}d}t        |	|      }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |	      rt        j                  |	      ndt        j                  |      t        j                  |      dz  }
t        t        j                  |
            d x}}y )Nskill1r   r7  rW   r8  r   resultsr   r   r   r   r   r   r   r7   r   r   r   )r9  r   r/   r-   r2  r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   )r6   r   r:  rI  r:   r   ra   r<   r   r7   rt   s              r=   'test_results_are_skill_result_instancesz=TestEvaluateDirectory.test_results_are_skill_result_instances	  s=   x'		Z	++M:''H67| q |q    |q      s   s      7   7   |   q       ,-wv}--------w---w------v---v---}----------&'wvw''''''''w'''w''''''v'''v'''w''''''''''+,wv|,,,,,,,,w,,,w,,,,,,v,,,v,,,|,,,,,,,,,,r?   c                    |dz  j                  t               t        j                  t	        |            }t        |      }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  t
              rt        j                  t
              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Nr   r7  rW   r8  r   r7   r   r   r   )r   r/   r-   r2  r   r   r0   r1   r^   r_   r`   r2   r3   r4   )r6   r   r7   r:   r   ra   r<   r   s           r=   test_direct_skill_md_in_rootz2TestEvaluateDirectory.test_direct_skill_md_in_root  s    	J	**=9&&s8}56{a{a{ass66{ar?   N)
r   r   r   r4  r;  rA  rC  rF  rJ  rL  r   r?   r=   r-  r-    s&      A	- r?   r-  c                   $    e Zd Zd Zd Zd Zd Zy)TestLLMStubc                    |dz  }|j                  t               t        j                  t	        |            }|j
                  }d}||k(  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}x}}y )	Nr   zllm-stubrW   r   r7   r   r   r
   )r   r/   r-   llm_evaluater   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   3test_llm_evaluate_returns_result_with_llm_stub_modez?TestLLMStub.test_llm_evaluate_returns_result_with_llm_stub_mode  s    
*
m,Z1{{(j({j(((({j((((((v(((v((({(((j(((((((r?   c                    |dz  }|j                  t               t        j                  t	        |            }d}t        ||      }|sddt        j                         v st        j                  t
              rt        j                  t
              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }t        t        j                  |            d x}}g }d}|j                  }|j                  }	 |	       }
||
v }|}|s'd}|j                  }|j                  } |       }||v }|}|st        j                  d	|fd
||
f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |	      t        j                  |
      dz  }dd|iz  }|j!                  |       |st        j                  d	fdf      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      ndt        j                        t        j                        t        j                  |      dz  }dd|iz  }|j!                  |       t        j"                  |d      i z  }dd|iz  }t        t        j                  |            d x}x}x}x}x}x}	x}
x}x}x}x}}y )Nr   messager   r   r7   r   zapi-keyapi_keyri   )zc%(py3)s in %(py11)s
{%(py11)s = %(py9)s
{%(py9)s = %(py7)s
{%(py7)s = %(py5)s.message
}.lower
}()
})r   r	   r
   r   r   z%(py13)spy13)zi%(py16)s in %(py24)s
{%(py24)s = %(py22)s
{%(py22)s = %(py20)s
{%(py20)s = %(py18)s.message
}.lower
}()
})r   py18py20py22py24z%(py26)spy26r7  zassert %(py29)spy29)r   r/   r-   rP  r   r   r^   r_   r0   r`   r2   r3   r4   rS  lowerr1   append_format_boolop)r6   r   r   r7   r:   ra   rt   r   rb   rd   @py_assert10r8   @py_assert15@py_assert19@py_assert21@py_assert23@py_assert17r  @py_format14@py_format25@py_format27@py_format28@py_format30s                          r=   +test_llm_evaluate_has_message_about_api_keyz7TestLLMStub.test_llm_evaluate_has_message_about_api_key%  s   
*
m,Z1()wvy))))))))w)))w))))))v)))v)))y))))))))))YyYFNNYN00Y02Yy22YiY6>>Y>CWCWYCWCYYiCY6YYYYYy2YYYyYYYYYYFYYYFYYYNYYY0YYY2YYYYYYYiCYYYYiYYYYYY6YYY6YYY>YYYCWYYYCYYYYYYYYYYYYYYYYr?   c                    |dz  }|j                  t               t        j                  t	        |            }d }||u}|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }dd|iz  }t        t        j                  |            d x}}y Nr   r   z%(py0)s is not %(py3)sr7   r0  r1  r	   )r   r/   r-   rP  r   r0   r1   r^   r_   r`   r2   r3   r4   r6   r   r   r7   r:   r   rs   rt   s           r=    test_llm_evaluate_does_not_raisez,TestLLMStub.test_llm_evaluate_does_not_raise,  s    
*
m,Z1!!vT!!!!vT!!!!!!v!!!v!!!T!!!!!!!r?   c                 ,   |dz  }|j                  t               t        j                  t	        |            }|j
                  }t	        |      }||k(  }|s7t        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y r   )r   r/   r-   rP  r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=    test_llm_evaluate_skill_path_setz,TestLLMStub.test_llm_evaluate_skill_path_set3  s    
*
m,Z1  3C
O3 O3333 O333333v333v333 333333C333C333333
333
333O3333333r?   N)r   r   r   rQ  rj  ro  rq  r   r?   r=   rN  rN    s    )Z"4r?   rN  c                   $    e Zd Zd Zd Zd Zd Zy)TestJSONOutputc                 	   |dz  }|j                  t               t        j                  t	        |            }t        j                  |      }d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d	}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d
}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }dd|iz  }t        t        j                  |            d x}}y )Nr   r   ri   rk   drm   r1  r	   r   r   r   r   r   r   )r   r/   r-   r   r   result_to_dictr0   r1   r2   r^   r_   r`   r3   r4   )	r6   r   r   r7   ru  r8   r:   rs   rt   s	            r=   *test_result_to_json_dict_has_required_keysz9TestJSONOutput.test_result_to_json_dict_has_required_keys>  s   
*
m,""3z?3f% |q    |q   |      q   q       !}!!!!}!!!}!!!!!!!!!!!!!!!!w!|w!w!!zQzQzQQ{a{a{aayA~yAyAAv{vvr?   c                    |dz  }|j                  t               t        j                  t	        |            }t        j                  |      }t        j                  |      }t        |t              }|sddt        j                         v st        j                  t              rt        j                  t              nddt        j                         v st        j                  |      rt        j                  |      nddt        j                         v st        j                  t              rt        j                  t              ndt        j                  |      dz  }t        t        j                  |            d }y )Nr   z5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}r   json_strr   )r   r   r   r&   )r   r/   r-   r   r   rv  jsondumpsr   r^   r_   r0   r`   r2   r3   r4   )r6   r   r   r7   ru  ry  r9   r;   s           r=   #test_result_to_json_is_serializablez2TestJSONOutput.test_result_to_json_is_serializableK  s    
*
m,""3z?3f%::a=(C((((((((z(((z(((((((((((((((((C(((C((((((((((r?   c                 R   |dz  }|j                  t               t        j                  t	        |            }t        j                  |      }|d   }dD ]  }||v }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      nddt        j                         v st        j                  |      rt        j                  |      nddz  }dd	|iz  }	t        t        j                  |	            d } y )
Nr   r   rK   ri   )z%(py0)s in %(py2)srr   )r   r   zassert %(py4)sr&   )r   r/   r-   r   r   rv  r0   r1   r^   r_   r`   r2   r3   r4   )
r6   r   r   r7   ru  r   rr   r   @py_format3r;   s
             r=   $test_sections_dict_contains_all_fivez3TestJSONOutput.test_sections_dict_contains_all_fiveT  s    
*
m,""3z?3f%Z=^ 	#C(?"""3(""""""3"""3""""""("""("""""""	#r?   c                 L   |dz  }|j                  t               t        j                  t	        |            }t        j                  |      }|d   j                         D ]@  \  }}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }	t        j                  d|       d	z   d
|	iz  }
t        t        j                  |
            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }	t        j                  d|       d	z   d
|	iz  }
t        t        j                  |
            d x}}d}||v }|st        j                  d|fd||f      t        j                  |      dt        j                         v st        j                  |      rt        j                  |      nddz  }	t        j                  d|       d	z   d
|	iz  }
t        t        j                  |
            d x}}C y )Nr   r   r!   ri   rk   rl   rm   zMissing 'found' in section rn   r	   r   zMissing 'score' in section rP   zMissing 'length' in section )r   r/   r-   r   r   rv  rp   r0   r1   r2   r^   r_   r`   rq   r3   r4   )r6   r   r   r7   ru  rr   rl   r8   r:   rs   rt   s              r=   0test_each_section_in_dict_has_found_score_lengthz?TestJSONOutput.test_each_section_in_dict_has_found_score_length]  s   
*
m,""3z?3f%*++- 	IHCF7c>FFF7cFFF7FFFFFFcFFFcFFFF%@#FFFFFFFF7c>FFF7cFFF7FFFFFFcFFFcFFFF%@#FFFFFFFH8s?HHH8sHHH8HHHHHHsHHHsHHHH&B3%$HHHHHHHH	Ir?   N)r   r   r   rw  r|  r  r  r   r?   r=   rs  rs  =  s    )#Ir?   rs  c                   *    e Zd Zd Zd Zd Zd Zd Zy)TestEdgeCasesc                    |dz  }|j                  d       t        j                  t        |            }|j                  }d}||k  }|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      dz  }dd	|iz  }t        t        j                  |            d x}x}}y )
Nr   z# Just a Title
r   r   r   r7   r   r   r
   )r   r-   r   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   s	            r=   test_skill_with_only_h1_headingz-TestEdgeCases.test_skill_with_only_h1_headingl  s    
*
01""3z?3!!'R'!R''''!R''''''v'''v'''!'''R'''''''r?   c                    |dz  }|j                  d       t        j                  t        |            }d }||u}|st	        j
                  d|fd||f      dt        j                         v st	        j                  |      rt	        j                  |      ndt	        j                  |      dz  }dd|iz  }t        t	        j                  |            d x}}y )	Nr   z/##NoSpace
Content
#AnotherNoSpace
More content
r   rm  r7   r0  r1  r	   )r   r-   r   r   r0   r1   r^   r_   r`   r2   r3   r4   rn  s           r=   "test_skill_with_malformed_markdownz0TestEdgeCases.test_skill_with_malformed_markdownr  s    
*
ST""3z?3!!vT!!!!vT!!!!!!v!!!v!!!T!!!!!!!r?   c                    |dz  }t         dz   ddz  z   }t        |      }d}||k\  }|st        j                  d|fd||f      dt	        j
                         v st        j                  t              rt        j                  t              ndd	t	        j
                         v st        j                  |      rt        j                  |      nd	t        j                  |      t        j                  |      d
z  }dd|iz  }t        t        j                  |            d x}x}}|j                  |       t        j                  t        |            }	|	j                  }
d}|
|k(  }|st        j                  d|fd|
|f      dt	        j
                         v st        j                  |	      rt        j                  |	      ndt        j                  |
      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}
x}}|	j                  }
d}|
|kD  }|st        j                  d|fd|
|f      dt	        j
                         v st        j                  |	      rt        j                  |	      ndt        j                  |
      t        j                  |      dz  }dd|iz  }t        t        j                  |            d x}
x}}y )Nr   r   xi N  r   r   r   r   large_contentr   r   r   r   rW   r   r7   r   r   r
   r   rR   z2%(py2)s
{%(py2)s = %(py0)s.total_score
} > %(py5)s)r/   r   r0   r1   r^   r_   r`   r2   r3   r4   r   r-   r   r   r   r   )r6   r   r   r  r:   r   ra   r<   r   r7   r   r9   rt   r   s                 r=   test_very_large_filez"TestEdgeCases.test_very_large_filex  s   
*
%,sU{:=!*U*!U****!U******s***s******=***=***!***U*******m,""3z?3~~""~""""~""""""v"""v"""~""""""""""!!%A%!A%%%%!A%%%%%%v%%%v%%%!%%%A%%%%%%%r?   c                    |dz  }|j                  t               t        j                  t	        |            }d }||u}|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }dd|iz  }t        t        j                  |            d x}}y rl  )r   rD   r-   r   r   r0   r1   r^   r_   r`   r2   r3   r4   rn  s           r=   test_unicode_contentz"TestEdgeCases.test_unicode_content  s    
*
./""3z?3!!vT!!!!vT!!!!!!v!!!v!!!T!!!!!!!r?   c                    |dz  }t         j                  dd      }|j                  |j                  d             t        j                  t        |            }d }||u}|st        j                  d|fd||f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }d	d
|iz  }t        t        j                  |            d x}}|j                  }d}	||	kD  }
|
st        j                  d|
fd||	f      dt        j                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |	      dz  }dd|iz  }t        t        j                  |            d x}x}
}	y )Nr   r   z
zutf-8r   rm  r7   r0  r1  r	   r   rR   r  r   r   r
   )r/   replacewrite_bytesencoder-   r   r   r0   r1   r^   r_   r`   r2   r3   r4   r   )r6   r   r   ro   r7   r:   r   rs   rt   ra   r9   r   s               r=   test_windows_line_endingsz'TestEdgeCases.test_windows_line_endings  s   
*
''f5w~~g67""3z?3!!vT!!!!vT!!!!!!v!!!v!!!T!!!!!!!!!%A%!A%%%%!A%%%%%%v%%%v%%%!%%%A%%%%%%%r?   N)r   r   r   r  r  r  r  r  r   r?   r=   r  r  k  s    ("&"&r?   r  )E__doc__builtinsr^   _pytest.assertion.rewrite	assertionrewriter0   importlib.util	importlibrz  syspathlibr   r   __file__parent_SCRIPTS_DIR_MODULE_PATHutilspec_from_file_locationr   r   ra   r9   r8   loaderr_  @py_assert13@py_assert12r1   r_   r`   r2   rt   r   r]  @py_format15@py_format17r^  @py_format18@py_format20r3   r4   module_from_specr-   modulesexec_moduler/   r   rA   rD   rH   rL   SHORT_CONTENTr   r   r:   r   r<   rq   r   r   r   r   r  r-  rN  rs  r  r   r?   r=   <module>r     s   6      
   H~$$++..~~--m\J 34 3t4 3DKK 3t 3Kt3 3 3 3t4 3 3 3 3 3t 3 3 3t 3 3 34 3 3 3 3 3 3 3Kt 3 3 3 3 3D 3 3 3D 3 3 3K 3 3t 3 3 3 3 3 3 3 3 3 3 3 3 3^^$$T*M     9v " 0  D
  $ ? Vc Vc! V V Vc V V V V Vs V V Vs V V V V V? V V V? V V V V Vc V V V%?O@T?U#V V V V V V VT8 T8t2, 2,pX3 X3|*, *,`.  . h4 4>(I (I\"& "&r?   