
    <i                         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	  S r " S S\R                  5      rg! \
 a     S SKJ	r	   N(! \
 a    S SKrS r	  N8f = ff = f)    )with_statementN)strip_python_stderrc                     [         R                  " SR                  5       SR                  5       U 5      R                  5       $ )Nz\[\d+ refs\]\r?\n?$ )resubencodestrip)stderrs    T/home/james-whalen/.local/lib/python3.13/site-packages/simplejson/tests/test_tool.pyr   r      s4    66&--/		      c                      [         R                  S:  a#  [        R                  " SS9n U R                  nX4$ [        R
                  " 5       u  p![        R                  " US5      n X4$ )N)      F)deletezw+b)sysversion_infotempfileNamedTemporaryFilenamemkstemposfdopen)filefilenamefds      r   open_temp_filer      s]    
6!**%899 >  '')yyU#>r   c                   X    \ rS rSrSr\R                  " S5      rS
S jrS r	S r
S rS	rg)TestTool!   z

        [["blorpie"],[ "whoops" ] , [
                                 ],	"d-shtaeou","d-nthiouh",
        "i-vhbjkhnth", {"nifty":87}, {"morefield" :	false,"field"
            :"yes"}  ]
           a.      [
        [
            "blorpie"
        ],
        [
            "whoops"
        ],
        [],
        "d-shtaeou",
        "d-nthiouh",
        "i-vhbjkhnth",
        {
            "nifty": 87
        },
        {
            "field": "yes",
            "morefield": false
        }
    ]
    Nc                    [         R                  SS/nU(       a  UR                  U5        [        R                  " U[        R
                  [        R
                  [        R
                  S9nUR                  U5      u  pVU R                  [        U5      SR                  5       5        U R                  UR                  S5        UR                  S5      R                  5       $ )Nz-mzsimplejson.tool)stdinr   stdoutr   r   utf8)r   
executableextend
subprocessPopenPIPEcommunicateassertEqualr   r	   
returncodedecode
splitlines)selfargsdataargvprocouterrs          r   runToolTestTool.runTool@   s    &78KK&0oo'1'18 ##D),S1299;?!,zz&!,,..r   c                     U R                  U R                  U R                  R                  5       S9U R                  R                  5       5        g )N)r1   )r+   r6   r1   r	   expectr.   )r/   s    r   test_stdin_stdoutTestTool.test_stdin_stdoutM   s;    LLdii..0L1KK""$	&r   c                 b   [        5       u  p UR                  U R                  R                  5       5        UR	                  5         U R                  U R                  U/S9U R                  R                  5       5        [        R                  " U5        g ! [        R                  " U5        f = f)Nr0   )r   writer1   r	   closer+   r6   r9   r.   r   unlink)r/   infileinfile_names      r   test_infile_stdoutTestTool.test_infile_stdoutR   s}    ,.	#LL))+,LLN;-0&&(* IIk"BIIk"s   A1B B.c                    [        5       u  p UR                  U R                  R                  5       5        UR	                  5         [        5       u  p4 UR	                  5         U R                  U R                  X$/S9/ 5        [        US5       nU R                  UR                  5       R                  S5      R                  5       U R                  R                  5       5        S S S 5        [        R                  " U5         [        R                  " U5        g ! , (       d  f       N<= f! [        R                  " U5        f = f! [        R                  " U5        f = f)Nr=   rbr$   )r   r>   r1   r	   r?   r+   r6   openreadr-   r.   r9   r   r@   )r/   rA   rB   outfileoutfile_namefs         r   test_infile_outfileTestTool.test_infile_outfile]   s    ,.	#LL))+,LLN %3$4!G(  LL{&ALB ,-$$/::<..0 . 		,'IIk" .- 		,'IIk"s=   AE <D- AD&D- .E 
D*&D- -EE E  )NN)__name__
__module____qualname____firstlineno__r1   textwrapdedentr9   r6   r:   rC   rL   __static_attributes__rN   r   r   r   r   !   s2    D __  	F,/&
	##r   r   )
__future__r   r   r   rS   unittestr'   r   test.supportr   ImportErrortest.test_supportr   r   TestCaser   rN   r   r   <module>r\      sk    % 	 
     0Q#x   Q#-   	 9  	  	 s'   ? A#AAA#AA#