
    /hh                         S SK r S SKJr  S SKJr  S SKJrJr  \(       d  \ R                  " S5      e " S S\ R                  5      r
g)    N)	SystemLog)is_apple_mobile)MockcallziOS-specificc                   l    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rSrg)TestAppleSystemLogOutput   Nc           
          U R                  U R                  R                  U Vs/ s H  n[        U R                  U5      PM     sn5        U R                  R                  5         g s  snf N)assertEqual	log_write
mock_callsr   	log_level
reset_mock)selfoutputlines      8/opt/python-3.13.8/usr/lib/python3.13/test/test_apple.pyassert_writes&TestAppleSystemLogOutput.assert_writes   s\    NN%% #"D T^^T*"	
 	!!#s    A'
c                 x    [        5       U l        SU l        [        U R                  U R                  SS9U l        g )N*   replace)errors)r   r   r   r   logr   s    r   setUpTestAppleSystemLogOutput.setUp   s*    T^^T^^IN    c                     U R                  [        U R                  5      S5        U R                  [        U R                  R                  5      S5        g )Nz<SystemLog (level 42)>z<LogStream (level 42)>)r   reprr   bufferr   s    r   	test_repr"TestAppleSystemLogOutput.test_repr   s9    dhh)ABdhhoo.0HIr   c                    U R                  U R                  R                  5       S5        U R                  U R                  R                  5       S5        U R	                  SU R                  R
                  5        U R	                  SU R                  R                  5        U R                  U R                  R                  S5        U R                  U R                  R                  S5        g )NTFzUTF-8r   )	assertIsr   writablereadabler   encodingr   line_bufferingwrite_throughr   s    r   test_log_config(TestAppleSystemLogOutput.test_log_config"   s    dhh'')40dhh'')51$(("3"34DHHOO4dhh--t4dhh,,e4r   c                     U R                   R                  S5        U R                   R                  5         U R                  / 5        g )N r   writeflushr   r   s    r   test_empty_str'TestAppleSystemLogOutput.test_empty_str,   s.    r2r   c                 ^    U R                   R                  S5        U R                  S/5        g )Nzhello world
   hello world
r   r1   r   r   s    r   test_simple_str(TestAppleSystemLogOutput.test_simple_str2   s$    ',-.r   c                 l   U R                   R                  S5        U R                   R                  S5        U R                   R                  S5        U R                   R                  S5        U R                   R                  S5        U R                   R                  5         U R                  SS/5        g )Nhello zworld
zgoodbye.r6   s   goodbye.r0   r   s    r   test_buffered_str*TestAppleSystemLogOutput.test_buffered_str7   st    svsy!z",k:;r   c                 j   U R                   R                  S5        U R                  / 5        U R                   R                  S5        U R                  SS/5        U R                   R                  S5        U R                  S/5        U R                   R                  5         U R                  S/5        g )NHelloz" world
Here for a while...
Goodbyes   Hello world
s   Here for a while...
z world
Hello agains   Goodbye world
s   Hello again)r   r1   r   r2   r   s    r   test_manual_flush*TestAppleSystemLogOutput.test_manual_flushA   s    w2=>,.FGH,-./0N+,r   c                 l   U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        g )	Nu   olé
s   olé
u   中文
s   中文
u   😀
s   😀
u   
s   ??
r7   r   s    r   test_non_ascii'TestAppleSystemLogOutput.test_non_asciiO   s    |$O,- 	'(9:; 	~&123 	'(G9%r   c                 l   U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        U R                   R                  S5        U R                  S/5        g )	Nz 
s   
za 
s   a
z b
s   b
za b
s   ab
r7   r   s    r   test_modified_null+TestAppleSystemLogOutput.test_modified_null`   s    z"M?+{#N+,{#N+,|$O,-r   c                      " S S[         5      nU R                  R                  U" S5      5        U R                  S/5        g )Nc                   &    \ rS rSrS rS rS rSrg)@TestAppleSystemLogOutput.test_nonstandard_str.<locals>.CustomStrn   c                     [        5       er   AssertionError)r   argskwargss      r   
splitlinesKTestAppleSystemLogOutput.test_nonstandard_str.<locals>.CustomStr.splitlineso       $&&r   c                     [        5       er   rO   r   s    r   __len__HTestAppleSystemLogOutput.test_nonstandard_str.<locals>.CustomStr.__len__r   rU   r   c                     [        5       er   rO   r   s    r   __str__HTestAppleSystemLogOutput.test_nonstandard_str.<locals>.CustomStr.__str__u   rU   r    N)__name__
__module____qualname____firstlineno__rS   rW   rZ   __static_attributes__r\   r   r   	CustomStrrL   n   s    '''r   rb   zcustom
s   custom
)strr   r1   r   )r   rb   s     r   test_nonstandard_str-TestAppleSystemLogOutput.test_nonstandard_strk   s5    	' 	' 	y,-K=)r   c           	      ,   S Hk  nU R                  US9   U R                  [        S[        U5      R                   35         U R
                  R                  U5        S S S 5        S S S 5        Mm     g ! , (       d  f       N= f! , (       d  f       M  = f)N)r      helloNr   objz$write\(\) argument must be str, not )subTestassertRaisesRegex	TypeErrortyper]   r   r1   r   ri   s     r   test_non_str%TestAppleSystemLogOutput.test_non_str{   sv    ,C#&++;S	**+-
 HHNN3' '& -  '&s#   -BA3B3
B=B
B	c                    U R                   R                  R                  [        S5      5        U R                   R	                  5         U R                   R                  R                  S5        U R                   R	                  5         U R                   R                  R                  S5        U R                   R	                  5         U R                  SS/5        g )Nrg   r   s   goodbye)r   r"   r1   	bytearrayr2   r   r   s    r   test_byteslike_in_buffer1TestAppleSystemLogOutput.test_byteslike_in_buffer   s    i12c"j)Hj12r   c           	      @   S Hu  nU R                  US9   U R                  [        S[        U5      R                   35         U R
                  R                  R                  U5        S S S 5        S S S 5        Mw     g ! , (       d  f       N= f! , (       d  f       M  = f)N)helloNr   rh   z+write\(\) argument must be bytes-like, not )rj   rk   rl   rm   r]   r   r"   r1   rn   s     r   test_non_byteslike_in_buffer5TestAppleSystemLogOutput.test_non_byteslike_in_buffer   s|    &C#&++BS	**+-
 HHOO))#. '& '  '&s#   -B&A=(B=
BB
B	)r   r   r   )r]   r^   r_   r`   maxDiffr   r   r#   r,   r3   r8   r>   rB   rE   rH   rd   ro   rs   rw   ra   r\   r   r   r   r      sO    G	$O
J5/
<-&"	.* 	(3/r   r   )unittest_apple_supportr   test.supportr   unittest.mockr   r   SkipTestTestCaser   r\   r   r   <module>r      s9     $ ( $


N
++P/x00 P/r   