
    8i                    8   d Z ddlmZ ddlZddlmc mZ ddl	Z	ddl
mZ ddlmZ ddlZ ed      Zedz  Zedz  Zg d	Zg d
Z e	j(                  d      Zh dZddZddZddZd Zd Zd Zd Zd Zd Zd Z d Z!d Z"e#dk(  r ejH                  e%dg       yy)uY   
IDS Phase 4 (task-2390) — design-md 라이브러리 60→130+ 확장 회귀 테스트
    )annotationsN)SequenceMatcher)Pathz'/home/jay/workspace/resources/design-mdzINDEX.mdzCONTRIBUTING.md)zVisual ThemezColor Palette
Typography	ComponentLayout)Depth	ElevationShadow)zDo'szDon'tsDoszDon't)zAgent PromptzPrompt GuidezAgent Guide)zinsurance/financeb2bb2cluxurytechminimalkoreanz#[0-9A-Fa-f]{6}>:   x.ai
linear.app
mistral.aiopencode.aitogether.aibmwcalibmclayexpomirouberwarpwiseapplefigmateslaairbnbclaudecoherecursorframerkrakennotionnvidiaollamaresendsanitysentryspacexstripevercelzapierferrarilovableminimaxmongodbposthograycastrenaultrevolutspotifywebflowairtablecoinbasecomposiointercommintlifyrunwaymlsupabase	hashicorp	pinterest	replicate	voltagent
clickhouse
elevenlabs
superhumanlamborghinic                 J    t        d t        j                         D              S )Nc              3  f   K   | ])  }|j                         r|d z  j                         r| + yw)	DESIGN.mdN)is_direxists).0ps     I/home/jay/workspace/tests/design-team/test_ids_phase4_design_md_expand.py	<genexpr>z#_list_brand_dirs.<locals>.<genexpr>5   s0      88:1{?224 	
s   /1)sortedDESIGN_MD_DIRiterdir     rT   _list_brand_dirsr[   4   s%      ((*  rZ   c                ,    | dz  j                  d      S )NrO   utf-8encoding)	read_text)	brand_dirs    rT   _read_design_mdrb   ;   s    #...@@rZ   c                     t        |t              r |j                          j                         v S t         fd|D              S )Nc              3  ^   K   | ]$  }|j                         j                         v  & y wN)lower)rR   mcontents     rT   rU   z_has_section.<locals>.<genexpr>B   s"     <qwwyGMMO+<s   *-)
isinstancestrrf   any)rh   markers   ` rT   _has_sectionrm   ?   s5    &#||~00<V<<<rZ   c                    t               } 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      d	z   d
|iz  }t        t        j                  |            d x}x}}y )N   >=)z0%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} >= %(py6)slen
brand_dirs)py0py1py3py6zFAIL: brand count = , expected >= 130z
>assert %(py8)spy8)r[   rr   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_saferepr_format_assertmsgAssertionError_format_explanation)rs   @py_assert2@py_assert5@py_assert4@py_format7@py_format9s         rT   (test_scenario_1_brand_count_at_least_130r   F   s   !#Jz? c ?c!   ?c                            "    s://@A     rZ   c                    t               } | D cg c]  }|j                  t        vs| }}g }|D ]m  }t        |      }t        D cg c].  }t        ||      s t        |t              rt        |      n|d   0 }}|sN|j                  |j                   d|        o | }|st        j                  dt        |       ddj                  |d d       z         dz   dd	t        j                         v st        j                  |      rt        j                   |      nd	iz  }t#        t        j$                  |            d }y c c}w c c}w )
Nr   z
: missing FAIL: z new brands missing sections.


   
>assert not %(py0)srt   failures)r[   nameEXISTING_60_BRANDSrb   REQUIRED_SECTIONSrm   ri   rj   appendrz   r   rr   joinr|   r}   r~   r   r   r   )	rs   d
new_brandsr   rh   rg   missing@py_assert1@py_format2s	            rT   -test_scenario_2_new_design_md_have_8_sectionsr   O   sC   !#J'L1669K+K!LJLH <!!$ '
+ "!S)SVqt3
 

 OOqvvhj	:;< < <   X>?
))HSbM
"	#               M
s   EE3Ec                    t         j                  }  |        }|st        j                  d      dz   dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }t        t        j                  |            d x} }t         j                  d      }t        D cg c]	  }||vs| }}| } | s~t        j                  d|       dz   d	d
t	        j
                         v st        j                  |      rt        j                  |      nd
iz  }t        t        j                  |            d } y c c}w )NzFAIL: INDEX.md missingC
>assert %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.exists
}()
}
INDEX_PATHrt   py2py4r]   r^   z$FAIL: INDEX.md missing categories = r   rt   missing_cats)r   rQ   rz   r   r|   r}   r~   r   r   r   r`   REQUIRED_CATEGORIES)r   @py_assert3@py_format5rh   cr   r   s          rT   )test_scenario_3_index_md_has_7_categoriesr   c   s    8888 8888888:888:888888888888""G"4G2G!aw6FAGLGRRRCL>RRRRRRR|RRR|RRRRRR Hs   '	E=1E=c                 
   t         j                  d      } t        j                  d|       }|s{t	        j
                  d      dz   ddt        j                         v st	        j                  |      rt	        j                  |      ndiz  }t        t	        j                  |            t        |j                  d            }d	}||k\  }|st	        j                  d
|fd||f      dt        j                         v st	        j                  |      rt	        j                  |      ndt	        j                  |      dz  }t	        j
                  d| d      dz   d|iz  }t        t	        j                  |            d x}}y )Nr]   r^   u   (\d{3})\s*개z"FAIL: INDEX.md missing brand countz
>assert %(py0)srt   count_match   ro   rp   z%(py0)s >= %(py3)scountrt   rv   zFAIL: INDEX.md displays rx   
>assert %(py5)spy5)r   r`   researchrz   r   r|   r}   r~   r   r   r   intgroupr{   )rh   r   @py_format1r   r   r   @py_format4@py_format6s           rT   %test_scenario_3b_index_md_brand_countr   j   s    ""G"4G)),g6K<<<<<<<<<;<<<;<<<<<!!!$%EL5C<LLL5CLLLLLL5LLL5LLLCLLL3E7:KLLLLLLLrZ   c                    t               } | D cg c],  }dt        |      v rdt        |      j                         v r|. }}|D cg c]"  }|dz  j                         r|j                  $ }}| }|s~t        j                  d|       dz   ddt        j                         v st        j                  |      rt        j                  |      ndiz  }t        t        j                  |            d }y c c}w c c}w )Nz
Apache-2.0zopen-designLICENSEz,FAIL: open-design extracts missing LICENSE: r   rt   r   )r[   rb   rf   rQ   r   rz   r   r|   r}   r~   r   r   r   )rs   r   open_design_extractsr   r   r   s         rT   $test_scenario_4_license_preservationr   s   s    !#J?1--_Q/5577 	
 
 !5U1Q]<R<R<TUHU<R<RRGzRRRRRRRxRRRxRRRRRR
 Vs   1C5C:C:c                   	 t         j                  }  |        }|st        j                  d      dz   dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }t        t        j                  |            d x} }t         j                  d      		fddD        } t        |       }|st        j                  d	      d
z   dt	        j
                         v st        j                  t              rt        j                  t              ndt        j                  |       t        j                  |      dz  }t        t        j                  |            d x} }d}d}t        d ||      j                         }d}||k\  } | st        j                  d| fd||f      dt	        j
                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }t        j                  d|d      dz   d|iz  }t        t        j                  |            d x} }d}||k\  } | st        j                  d| fd||f      dt	        j
                         v st        j                  |      rt        j                  |      ndt        j                  |      dz  }t        j                  d      dz   d|iz  }t        t        j                  |            d x} }y )NFAIL: CONTRIBUTING.md missingr   CONTRIBUTING_PATHr   r]   r^   c              3  &   K   | ]  }|v  
 y wre   rY   )rR   trh   s     rT   rU   z7test_scenario_5_copyright_block_mock.<locals>.<genexpr>   s     <qG|<s   )z70%z0.70z0.7z"FAIL: 70% threshold policy missingz.
>assert %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
}rk   z>The quick brown fox jumps over the lazy dog with golden shadowz=The quick brown fox jumps over the lazy dog with silver lightgffffff?rp   r   ratior   u   FAIL: mock 비정상 ratio=z.2fr   r   zFAIL: 80% case not blocked)r   rQ   rz   r   r|   r}   r~   r   r   r   r`   rk   r   r   r{   )
r   r   r   originalcopiedr   r   r   r   rh   s
            @rT   $test_scenario_5_copyright_block_mockr      s   ##F#%F%FF'FFFFFFFFFFFFF#FFF%FFFFFF))7);G<%;< 3<< <   	-             =    =      PHLFD(F399;EC5D=CCC5DCCCCCC5CCC5CCCDCCC7c{CCCCCCC65D=6665D66666656665666D6666666666rZ   c                 $   t               } g }| D ][  }t        |      }t        j                  |      }t	        |      dk  s2|j                  |j                   dt	        |       d       ] | }|st        j                  dt	        |       ddj                  |d d       z         dz   d	d
t        j                         v st        j                  |      rt        j                  |      nd
iz  }t        t        j                  |            d }y )N   z: only z HEXr   z brands not satori-compatible.
r   r   r   rt   r   )r[   rb   HEX_REfindallrr   r   r   rz   r   r   r|   r}   r~   r   r   r   )rs   r   r   rh   
hex_colorsr   r   s          rT   /test_scenario_6_all_design_md_satori_compatibler      s    !#JH E!!$^^G,
z?QOOqvvhgc*o->dCD	E
 < <   X?@
))HSbM
"	#              rZ   c                 l   t               D  ch c]  } | j                   }} t        |z
  }| }|s~t        j                  d|       dz   ddt        j                         v st        j                  |      rt        j                  |      ndiz  }t        t        j                  |            d }y c c} w )Nu   FAIL: 기존 브랜드 누락: r   rt   r   )r[   r   r   rz   r   r|   r}   r~   r   r   r   )r   rs   r   r   r   s        rT   test_existing_brands_preservedr      sv    "2"45Q!&&5J5 :-G;C;CC9'CCCCCCCwCCCwCCCCCC 6s   B1c                    t         j                  }  |        }|st        j                  d      dz   dt	        j
                         v st        j                  t               rt        j                  t               ndt        j                  |       t        j                  |      dz  }t        t        j                  |            d x} }y )Nr   r   r   r   )
r   rQ   rz   r   r|   r}   r~   r   r   r   )r   r   r   s      rT   test_contributing_md_existsr      sn    ##F#%F%FF'FFFFFFFFFFFFF#FFF%FFFFFFrZ   __main__z-v)returnz
list[Path])ra   r   r   rj   )rh   rj   r   bool)&__doc__
__future__r   builtinsr|   _pytest.assertion.rewrite	assertionrewriterz   r   difflibr   pathlibr   pytestrW   r   r   r   r   compiler   r   r[   rb   rm   r   r   r   r   r   r   r   r   r   __name__main__file__rY   rZ   rT   <module>r      s    #   	 #  >?Z'
!$55 	   
&	'
 A=(SMS7DG zFKK4 ! rZ   