
    h                          S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  \
R                  \R                  S5      S    S-   rS rS rS rS	 rS
 rSS jrg)    )print_functionN)PY3   z/datac                 B   [        U [        5      (       d  U /n / nU  H~  n[        U[        5      (       d  [        U5      n[	        U5       HL  nX#   n[        U[
        R                  5      (       d  M(  [        US5      (       d  M;  UR                  U5        MN     M     U$ )Nunittest)	
isinstancelistdictvarssortedtypesFunctionTypehasattrappend)collections	functions
collectionkeyvalues        `/home/james-whalen/.local/lib/python3.13/site-packages/srsly/tests/ruamel_yaml/test_appliance.pyfind_test_functionsr      s    k4(("mI!
*d++j)J*%COE%!3!344
9S9S  ' & "     c                    0 n[         R                  " U 5       H  n[         R                  R                  [         R                  R	                  X5      5      (       d  MF  [         R                  R                  U5      u  p4UR                  [        (       a  SOS5      (       a  M  UR                  U/ 5      R                  U5        M     [        UR                  5       5      nU$ )Nz-py2z-py3)oslistdirpathisfilejoinsplitextendswithr   
setdefaultr   r   items)	directory	filenamesfilenamebaseexts        r   find_test_filenamesr(       s    IJJy)77>>"'',,y;<<((2ID}}ssV77  r*11#6 * y()Ir   c                    [         R                  " SS9nUR                  SSSS[        R                  ;   SS9  UR                  S	SS
S9  UR                  SSSS9  UR                  SSSS9  UR                  U 5      n U R                  nU R                  (       a  U R                  /O/ nU R                  nS[        R                  ;   a0  UR                  [        R                  S   R                  5       5        S[        R                  ;   a0  UR                  [        R                  S   R                  5       5        X4X 4$ ) a   run the yaml tests. By default
    all functions on all appropriate test_files are run. Functions have
    unittest attributes that determine the required extensions to filenames
    that need to be available in order to run that test. E.g.


    python test_yaml.py test_constructor_types

    python test_yaml.py --verbose test_tokens spec-02-05


    The presence of an extension in the .skip attribute of a function
    disables the test for that function.)usagez	--verbosez-v
store_trueYAML_TEST_VERBOSEzset verbosity output)actiondefaulthelpz--list-functionszHlist all functions with required file extensions for test files
        )r.   r0   function?zrestrict function to run)nargsr0   r$   *zbasename of filename set, extensions (.code, .data) have to
        be a superset of those in the unittest attribute of the selected
        functionYAML_TEST_FUNCTIONSYAML_TEST_FILENAMES)argparseArgumentParseradd_argumentr   environ
parse_argsverboser1   r$   extendsplit)argsparserr<   include_functionsinclude_filenamess        r   parse_argumentsrC   ,   s<   $$,	F #rzz1#      
#4RS
   T"DllG+/==b 

*  ,A!B!H!H!JK 

*  ,A!B!H!H!JK>>r   c                 R   [         (       a  U R                  nO*[        U S5      (       a  U R                  nOU R                  nU(       aU  [
        R                  R                  S5        [
        R                  R                  U< SSR                  U5      < S35         U " USU06  SnS nU(       d  [
        R                  R                  S5        [
        R                  R                  5         X1XE4$ ! [         a  n[
        R                  " 5       n[        U[        5      (       a  S	nOS
nU(       a(  [        R                  " S[
        R                  S9   S nAN[
        R                  R                  US   5        [
        R                  R                  5          S nANS nAff = f)Nunittest_nameL===========================================================================
(, z)...
r<   SUCCESS.FAILUREERROR   )limitfiler   )r   __name__r   rE   	func_namesysstdoutwriter   	Exceptionexc_infor   AssertionError	traceback	print_excflush)r1   r$   r<   namekindinfoexcs          r   executer_   j   s,   
s  8_--))D%%D

)

$		)0DEF"9-- JJS!JJT((#  
||~c>**DDacjj9JJT!W%JJ
s     C4 4
F&>AF!A F!!F&c           	         U (       a&  U(       d  [         R                  R                  S5        [        U 5      nSnSnU  GHf  u  pVpxUS:X  a  M  US:X  a  US-  nUS:X  a  US-  n[         R                  R                  S5        [         R                  R                  U< SS	R	                  U5      < S
U< S35        US:X  a%  [
        R                  " US[         R                  06  O[         R                  R                  S5        [
        R                  " US   [         R                  S9  [         R                  R                  SUS   R                  -  5        [         R                  R                  S5        US   R                   H&  n	[        R                  " U	[         R                  S9  M(     U H  n
[         R                  R                  S5        [         R                  R                  SU
-  5        [        (       a%  [        U
SSS9 nUR                  5       nS S S 5        O%[        U
S5       nUR                  5       nS S S 5        [         R                  R                  W5        U(       d  M  US   S:w  d  M  [         R                  R                  S5        M     GMi     [         R                  R                  S5        [         R                  R                  SU-  5        SnU(       a$  [         R                  R                  SU-  5        SnU(       a$  [         R                  R                  SU-  5        SnU$ ! , (       d  f       GN= f! , (       d  f       GN= f)N
r   rI   rK   rM   rL   rF   rG   rH   z): rO   z#Traceback (most recent call last):
r   )rO   z%s: see below
zL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)streamzL---------------------------------------------------------------------------
z%s:
rreplace)errorsrbz
TESTS: %s
zFAILURES: %s
zERRORS: %s
)rR   rS   rT   lenr   rX   print_exceptionprint_tbrP   r?   pprintr   openread)resultsr<   totalfailuresre   r[   r$   r\   r]   argr%   fpdataret_vals                 r   displayru      sm   w

LEHF'.#99MH7?aKF

)

491EtLM7?%%=3::=JJCDtAwSZZ8JJ.a1A1AABJJ_-Aw||c#**5 $!HJJ_-JJWx/0s(C	:b779D ;: (D)R779D *JJT"tRD(

  & "% (/< JJ_%JJ]U*+G

)H45

&01N# ;: *)s   M6M
M
M&c           
         [        U 5      n[        [        5      n[        U5      u  pEpgUR                  (       aD  [        S5        U H2  n[        SR                  UR                  UR                  5      5        M4     g / n	U H  n
U(       a  U
R                  U;  a  M  U
R                  (       a  U H  u  pU(       a  X;  a  M  / nU
R                   H@  nX;  a    M,  UR                  [        R                  R                  [        X-   5      5        MB     [        U
S/ 5      nU H  nUU;   d  M    M     [        XU5      nU	R                  U5        M     M  [        U
/ U5      nU	R                  U5        M     [        XS9$ )Nztest functions:z  {:30s} {}skip)r<   )r   r(   DATArC   list_functionsprintformatrP   r   r   r   r   r   getattrr_   ru   )r   r?   test_functionstest_filenamesrA   rB   r<   afrn   r1   r&   extsr$   r'   	skip_extsskip_extresults                     r   runr      sI   (5N(.N7Ft7L4' A-&&qzz1::>?  G"!2!2:K!K,
$)F	#,,C$$RWW\\$
%CD -
 !(&" =I$-#t+! %. ")g!Fv. -" Xr73FNN6"- #. 7,,r   )N)
__future__r   rR   r   r   rX   rk   r7   srsly.ruamel_yaml.compatr   __file__rsplitseprx   r   r(   rC   r_   ru   r    r   r   <module>r      s^    % 
 	     ( rvvq!!$w.	;?|)B-`!-r   