
    <es                     |   d dl Z d dlZd dlZd dlmZ d dlmZ  ej        d            ej        d          Z	d Z
 e
e	j                  Z e
e	j                  Z e
e	j                  Z G d dej                  Z G d	 d
ej                  Z G d dej                  Zedk    r ej                     dS dS )    N)support)import_helperaudiowinsoundc                 F     t          j                    fd            }|S )Nc                      	  | i |}t           j        rt          j        d           |S # t          $ r3}t           j        rt          j        d|           Y d }~d S Y d }~d S d }~ww xY w)Nreturnedzfailed:)r   verboseprint__name__RuntimeError)argskwargsretefuncs       )/usr/lib/python3.11/test/test_winsound.pywrapperzsound_func.<locals>.wrapper   s    	$'''C
  1dmZ000J  	3 	3 	3 3dmY2222222223 3 3 3 3 3	3s   . 
A+"A&&A+)	functoolswraps)r   r   s   ` r   
sound_funcr      s8    _T	 	 	 	 	 N    c                   &    e Zd Zd Zd Zd Zd ZdS )BeepTestc                     |                      t          t          j                   |                      t          t          j        dd           |                      t          t          j        dd           d S )N$   K   i   )assertRaises	TypeErrorr   Beep
ValueErrorselfs    r   test_errorszBeepTest.test_errors)   sX    )X]333*hmR<<<*hmUB?????r   c                 F    t          dd           t          dd           d S )N%   r   i  	safe_Beepr"   s    r   test_extremeszBeepTest.test_extremes.   s(    "b%r   c                 N    t          ddd          D ]}t          |d           d S )Nd     r   )ranger(   )r#   is     r   test_increasingfrequencyz!BeepTest.test_increasingfrequency2   s:    sD#&& 	 	Aa	 	r   c                 (    t          dd           d S )Nr   r,   )duration	frequencyr'   r"   s    r   test_keyword_argszBeepTest.test_keyword_args6   s    2......r   N)r   
__module____qualname__r$   r)   r/   r3    r   r   r   r   '   sS        @ @ @
    / / / / /r   r   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
MessageBeepTestc                 .    t          j        d           d S )N      ?)timesleepr"   s    r   tearDownzMessageBeepTest.tearDown<   s    
3r   c                     |                      t          t          j        d           |                      t          t          j        dd           t	                       d S )Nbad*   )r   r   r   MessageBeepsafe_MessageBeepr"   s    r   test_defaultzMessageBeepTest.test_default?   sL    )X%95AAA)X%92rBBBr   c                 8    t          t          j                   d S NrB   r   MB_OKr"   s    r   test_okzMessageBeepTest.test_okD   s    (((((r   c                 8    t          t          j                   d S rE   )rB   r   MB_ICONASTERISKr"   s    r   test_asteriskzMessageBeepTest.test_asteriskG       122222r   c                 8    t          t          j                   d S rE   )rB   r   MB_ICONEXCLAMATIONr"   s    r   test_exclamationz MessageBeepTest.test_exclamationJ   s    455555r   c                 8    t          t          j                   d S rE   )rB   r   MB_ICONHANDr"   s    r   	test_handzMessageBeepTest.test_handM   s    -.....r   c                 8    t          t          j                   d S rE   )rB   r   MB_ICONQUESTIONr"   s    r   test_questionzMessageBeepTest.test_questionP   rL   r   c                 :    t          t          j                   d S )N)typerF   r"   s    r   r3   z!MessageBeepTest.test_keyword_argsS   s    hn------r   N)r   r4   r5   r=   rC   rH   rK   rO   rR   rU   r3   r6   r   r   r8   r8   :   s            
) ) )3 3 36 6 6/ / /3 3 3. . . . .r   r8   c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
PlaySoundTestc                 f   |                      t          t          j                   |                      t          t          j        dd           |                      t          t          j        dt          j        t          j        z             |                      t          t          j        dd           |                      t          t          j        dt          j                   |                      t          t          j        dd           |                      t          t          j        dd           d S )Nr?   nones   badr      zbad )r   r   r   	PlaySoundr   	SND_ASYNC
SND_MEMORYr!   r"   s    r   r$   zPlaySoundTest.test_errorsY   s    )X%7888)X%7FFFH&)<<	
 	
 	

 	)X%7CCC)X%7"-	/ 	/ 	/)X%7A>>>*h&8'1EEEEEr   c                 <    t          t          j        d           d S )N
SystemExit)flagssoundsafe_PlaySoundr   	SND_ALIASr"   s    r   r3   zPlaySoundTest.test_keyword_argsh   s    X/|DDDDDDr   c                 ,   t          t          j        dd          d          5 }|                                }d d d            n# 1 swxY w Y   t	          |t
          j                   t          |          }t	          |t
          j                   d S )Npluck-pcm8.wav	audiodatasubdirrb)openr   findfilereadre   r   r_   	bytearray)r#   f
audio_datas      r   test_snd_memoryzPlaySoundTest.test_snd_memoryk   s    '"#3*57 7 78<> > 	"ABJ	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	z8#6777z**
z8#677777s   AA
A
c                     t          j        dd          }t          |t          j        t          j        z             d S )Nrh   ri   rj   )r   rn   re   r   SND_FILENAMESND_NODEFAULT)r#   fns     r   test_snd_filenamezPlaySoundTest.test_snd_filenames   s9    .{CCCr8083IIJJJJJr   c                     g d}|D ]J}|                      |          5  t          |t          j                   d d d            n# 1 swxY w Y   Kd S )N)SystemAsteriskSystemExclamationra   
SystemHandSystemQuestion)alias)subTestre   r   rf   )r#   aliasesr~   s      r   test_aliaseszPlaySoundTest.test_aliasesw   s    
 
 
  	: 	:EE** : :uh&8999: : : : : : : : : : : : : : :	: 	:s   AA
	A
	c                 :    t          dt          j                   d S Nz
!"$%&/(#+*rd   r"   s    r   test_alias_fallbackz!PlaySoundTest.test_alias_fallback   s    |X%788888r   c                 T    t          dt          j        t          j        z             d S r   )re   r   rf   rv   r"   s    r   test_alias_nofallbackz#PlaySoundTest.test_alias_nofallback   s#    |X%7(:P%PQQQQQr   c                 .   t          dt          j        t          j        z  t          j        z             t          j        d           t          dt          j        t          j        z             t                              d t          j	                   d S )Nr}   r:   )
re   r   rf   r^   SND_LOOPr;   r<   
SND_NOSTOPr]   	SND_PURGEr"   s    r   test_stopasynczPlaySoundTest.test_stopasync   sy    !33h6GG	
 	
 	
 	
3');h>Q)QRRR 	4!344444r   N)r   r4   r5   r$   r3   rs   rx   r   r   r   r   r6   r   r   rY   rY   W   s        F F FE E E8 8 8K K K
: 
: 
:9 9 9R R R	5 	5 	5 	5 	5r   rY   __main__)r   r;   unittesttestr   test.supportr   requiresimport_moduler   r   r    r(   rA   rB   r]   re   TestCaser   r8   rY   r   mainr6   r   r   <module>r      se               & & & & & &     &=&z22   Jx}%%	:h233 H./// / / / /x  / / /&. . . . .h' . . .:;5 ;5 ;5 ;5 ;5H% ;5 ;5 ;5| zHMOOOOO r   