
    !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	m
Z
 ddlZ e
ej                  j                  dd            Z ee      ej                   vr"ej                   j#                  d ee             ddlmZmZmZmZ  G d d      Zy)	uc   
test_composite_constants.py

composite_constants.py 상수 검증 테스트 (아르고스 작성)
    N)PathWORKSPACE_ROOTz/home/jay/workspace)COMPOSITE_ALLOWED_TEAMSDEFAULT_HANDOFF_FIELDSHANDOFF_REQUIRED_FIELDSMAX_COMPOSITE_TEAMSc                   F    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zy)TestCompositeConstantsu0   COMPOSITE_ALLOWED_TEAMS 및 관련 상수 검증c                 \   t        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                  t              rt        j                  t              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 )N5assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}
isinstancer   	frozensetpy0py1py2py4)
r   r   r   @py_builtinslocals
@pytest_ar_should_repr_global_name	_safereprAssertionError_format_explanation)self@py_assert3@py_format5s      5/home/jay/workspace/tests/test_composite_constants.pytest_allowed_teams_is_frozensetz6TestCompositeConstants.test_allowed_teams_is_frozenset   s    19========z===z======1===1======9===9==========    c                    h d}t         |k(  }|st        j                  d|fdt         |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dz  }dd|iz  }t        t        j                  |            d }y )	N>   design	marketing
consulting
publishing==)z%(py0)s == %(py2)sr   expectedr   r   assert %(py4)sr   )	r   r   _call_reprcomparer   r   r   r   r   r   )r   r(   @py_assert1@py_format3r   s        r   $test_allowed_teams_contains_expectedz;TestCompositeConstants.test_allowed_teams_contains_expected   sr    F&(2222&(222222&222&222222(222(2222222r    c                 p   d}t         |k(  }|st        j                  d|fdt         |f      dt        j                         v st        j
                  t               rt        j                  t               ndt        j                  |      dz  }dd|iz  }t        t        j                  |            d x}}y )N   r&   )z%(py0)s == %(py3)sr   )r   py3zassert %(py5)spy5)	r   r   r+   r   r   r   r   r   r   )r   @py_assert2r,   @py_format4@py_format6s        r   test_max_composite_teams_is_3z4TestCompositeConstants.test_max_composite_teams_is_3#   s_    &''"a''''"a''''''"'''"'''a'''''''r    c                    t         D ]=  }t        |t              }|s%t        j                  d| d      dz   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 )NzKey z is not frozenset7
>assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}r   keyr   r   )r   r   r   r   _format_assertmsgr   r   r   r   r   r   )r   r9   r   r   s       r   'test_handoff_fields_keys_are_frozensetsz>TestCompositeConstants.test_handoff_fields_keys_are_frozensets&   s    * 	MCc9-L-LLcU:K/LLLLLLL:LLL:LLLLLLcLLLcLLLLLL9LLL9LLL-LLLLLL	Mr    c                 
   t        j                         D ]k  \  }}t        |t              }|s%t	        j
                  d| d      dz   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 }t        |      }d}||kD  }|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| d      dz   d|iz  }	t        t	        j                  |	            d x}x}}n y )Nz
Value for z is not listr8   r   valuelistr   r   >z/%(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} > %(py6)slenr   r   r1   py6z	 is emptyz
>assert %(py8)spy8)r   itemsr   r>   r   r:   r   r   r   r   r   r   rB   r+   )
r   r9   r=   r   r   r3   @py_assert5@py_assert4@py_format7@py_format9s
             r   $test_handoff_fields_values_are_listsz;TestCompositeConstants.test_handoff_fields_values_are_lists*   sY   1779 	?JCeT*J*JJj\,JJJJJJJ:JJJ:JJJJJJeJJJeJJJJJJTJJJTJJJ*JJJJJJu:>>:>>>>:>>>>>>3>>>3>>>>>>u>>>u>>>:>>>>>>ZuI#>>>>>>>>	?r    c                    t        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                  t              rt        j                  t              nddt        j                         v st        j                  t              rt        j                  t              ndt        j                  |      dz  }t        t        j                  |            d }t        t              }d}||kD  }|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                  t              rt        j                  t              ndt        j                  |      t        j                  |      d
z  }dd|iz  }t        t        j                  |            d x}x}}y )Nr   r   r   r>   r   r   r?   rA   rB   rC   zassert %(py8)srE   )r   r   r>   r   r   r   r   r   r   r   rB   r+   )r   r   r   r3   rG   rH   rI   rJ   s           r   #test_default_handoff_fields_is_listz:TestCompositeConstants.test_default_handoff_fields_is_list/   s    0$77777777z777z77777707770777777$777$7777777777)*.Q.*Q....*Q......s...s......)...)...*...Q.......r    c                    t        ddh      }|t        v }|st        j                  d|fd|t        f      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dz  }dd	|iz  }t        t        j                  |            d }y )
Nr#   r"   )in)z%(py0)s in %(py2)sr9   r   r)   r*   r   )
r   r   r   r+   r   r   r   r   r   r   )r   r9   r,   r-   r   s        r   $test_handoff_marketing_design_existsz;TestCompositeConstants.test_handoff_marketing_design_exists3   s}    h/0-----s-------s---s------------------r    c                    t         D ]  }|j                  }d} ||      }| }|st        j                  d|       dz   dt	        j
                         v st        j                  |      rt        j                  |      ndt        j                  |      t        j                  |      t        j                  |      dz  }t        t        j                  |            dx}x}x}} y)uB   COMPOSITE_ALLOWED_TEAMS에 dev팀이 포함되지 않음을 검증devz+dev team found in COMPOSITE_ALLOWED_TEAMS: zR
>assert not %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.startswith
}(%(py4)s)
}team)r   r   r   rD   N)
r   
startswithr   r:   r   r   r   r   r   r   )r   rS   r,   r   rG   @py_assert7@py_format8s          r   test_allowed_teams_no_dev_teamsz6TestCompositeConstants.test_allowed_teams_no_dev_teams7   s    + 	dDcucu-c--c-cc1\]a\b/ccccccctccctccccccuccc-cccccc	dr    c                    ddl m} t        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  }t        j                  d| d	      d
z   d|iz  }t        t        j                  |            d} y)u=   TEAM_BOT에 composite 팀이 없음을 검증 (오염 방지)r   )TEAM_BOT)not in)z%(py0)s not in %(py2)srS   rY   r)   zcomposite team z found in TEAM_BOTz
>assert %(py4)sr   N)dispatchrY   r   r   r+   r   r   r   r   r:   r   r   )r   rY   rS   r,   r-   r   s         r   test_team_bot_not_contaminatedz5TestCompositeConstants.test_team_bot_not_contaminated<   s    %+ 	TDx'SSS4xSSSSSS4SSS4SSSSSSxSSSxSSSS?4&@R)SSSSSSS	Tr    N)__name__
__module____qualname____doc__r   r.   r6   r;   rK   rM   rP   rW   r\    r    r   r
   r
      s5    :>3(M?
/.d
Tr    r
   )r`   builtinsr   _pytest.assertion.rewrite	assertionrewriter   ossyspathlibr   pytestenvironget
_WORKSPACEstrpathinsertutils.composite_constantsr   r   r   r   r
   ra   r    r   <module>rq      ss     	 
  "**..!13HIJ
z?#(("HHOOAs:' 'T 'Tr    