
    Pi                     8   d Z ddlZddlZddlZddlZddlZddlZddlmZm	Z	 ddl
mZmZmZ ddZd Zd Zd	 Zd
 Zej                            dej                                        v d          d             Zej                            dddg          d             Zd Zd Zej                             ej                     p ej        d           d          d             Zd Zd Z ej                            dg d          d             Z!d Z"dS )z"Test of the command line interface    N)EspeakMbrolaBackendEspeakBackend)mainbackendlogger c                 .   t          j                    5 }t          j        |          dz  }t          j        |          dz  }t	          |d          5 }|                    |                     d                     d d d            n# 1 swxY w Y   d| d| gt          _        |r't          xj        t          j
        |          z  c_        t          j                     t	          |d          5 }|                                                                }d d d            n# 1 swxY w Y   |                    dd	                              t           j                  |                    dd	          k    sJ 	 d d d            d S # 1 swxY w Y   d S )
Nz	input.txtz
output.txtwbutf8unusedz-orbr   )tempfileTemporaryDirectorypathlibPathopenwriteencodesysargvshlexsplitr   readdecodereplacestriposlinesep)	textexpected_outputargstmpdir
input_fileoutput_filefinputfoutputoutputs	            b/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/test/test_main.py_testr*      s(   		$	&	& 1&\&))K7
l6**\9*d## 	.vLLV,,---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. ot5EF 	*HHD)))HH	+t$$ 	-\\^^**,,F	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- ~~dB''--bj99&&tR001 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s[   ?F
)B<F
B	F
B	A!F
1'D$F
$D(	(F
+D(	,AF

FFc                      ddgt           _        t          j        t                    5  t          j                     d d d            d S # 1 swxY w Y   d S )Nfooz-h)r   r   pytestraises
SystemExitr        r)   	test_helpr2   3   s    t}CH	z	"	"  	                 s   A		AAc                  H    ddgt           _        t          j                     d S )Nr,   z	--versionr   r   r   r0   r1   r)   test_versionr5   9   s    {#CHIKKKKKr1   c                  H    ddgt           _        t          j                     d S )Nr,   z--list-languagesr4   r0   r1   r)   test_list_languagesr7   >   s    )*CHIKKKKKr1   c                      t          ddd           t          ddd           t          ddd           t          ddd           t          d	d
d           t          d	dd           d S )Nhello world   həloʊ wɜːld z	--verbosez--quietu   hello world | həloʊ wɜːld z--prepend-textzhhaxlow werldz-b festival --stripzbonjour le mondeu   bɔ̃ʒuʁ lə mɔ̃d z-l fr-fru2   b ɔ̃ ʒ u ʁ ;eword l ə ;eword m ɔ̃ d ;eword z-l fr-fr -p " " -w ";eword "r*   r0   r1   r)   test_readmer<   C   s    	-+[999	-+Y777	-9;KLLL	-*?@@@	
6
CCC	
R
(* * * * *r1   z2.1zRfestival-2.1 gives different results than further versions for syllable boundaries)reasonc                  (    t          ddd           d S )Nr9   z7hh ax ;esyll l ow ;esyll ;eword w er l d ;esyll ;eword z5-p ' ' -s ';esyll ' -w ';eword ' -b festival -l en-usr;   r0   r1   r)   test_readme_festival_syllr?   M   s-    
 
-
C
AC C C C Cr1   njobs      c                     t          t          j                            d          t          j                            d          d|  d           d S )N)r9   goodbyez
third linezyet another)u   h-ə-l-oʊ w-ɜː-l-du   ɡ-ʊ-d-b-aɪu   θ-ɜː-d l-aɪ-nu   j-ɛ-t ɐ-n-ʌ-ð-ɚz--strip -j z( -l en-us -b espeak -p "-" -s "|" -w " ")r*   r   r   join)r@   s    r)   
test_njobsrF   W   sf    	

  	 	
 	
 $ 	% 	%
 	FeEEEG G G G Gr1   c                  (    t          ddd           d S )Nu	   untuʼuleu   untṵːle z-l yucatec -b segmentsr;   r0   r1   r)   test_unicoderH   g   s    	+}&>?????r1   c                      t          j        t                    5  t          j        d           d d d            d S # 1 swxY w Y   d S )NrA   )	verbosity)r-   r.   RuntimeErrorr   
get_loggerr0   r1   r)   test_loggerrM   k   s    	|	$	$ ' 'A&&&&' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 's   =AAzmb-fr1z$mbrola or mb-fr1 voice not installedc                  (    t          ddd           d S )Nzcoucou toi!zk u k u t w a z7-b espeak-mbrola -l mb-fr1 -p" " --preserve-punctuationr;   r0   r1   r)   test_espeak_mbrolarO   p   s-    
 
-)
CE E E E Er1   c                     t          j        t          j                                                  } t
          j        dk    r7t          |                               dd                              dd          } t          ddd|             d S )	Nwin32\\\ \ r9   r:   z--espeak-library=)
r   r   r   r   libraryr   platformstrr   r*   )espeaks    r)   test_espeak_pathrZ   y   sz    \'/7799::F
|wV$$T622::3FF	-+-I-I-IJJJJJr1   c                     t          j        t          j                                                  } t
          j        dk    r7t          |                               dd                              dd          } t          ddd|  d	           d S )
NrQ   rR   rS   rT   rU   r9   zhhaxlow werld z--festival-executable=z -b festival)
r   r   r   FestivalBackend
executabler   rW   rX   r   r*   )festivals    r)   test_festival_pathr_      s    |G3>>@@AAH
|wx==((v66>>sEJJ	-)
98
9
9
9; ; ; ; ;r1   zargs, expected))r   uP   həloʊ wɜːld θɹiː ziəɹoʊziəɹoʊ ziəɹoʊ ɔːɹ tuː fɪfti həloʊ )z--preserve-punctuationuX   həloʊ, ,wɜːld? θɹiː,ziəɹoʊziəɹoʊ ziəɹoʊ, ɔːɹ tuː.fɪfti. ¿həloʊ? )uh   --preserve-punctuation --punctuation-marks-is-regex --punctuation-marks "[^a-zA-ZÀ-ÖØ-öø-ÿ0-9'\-]"u\   həloʊ, ,wɜːld? ‡ θɹiː,ziəɹoʊziəɹoʊ ziəɹoʊ, ɔːɹ tuː.fɪfti. ¿həloʊ? )ur   --preserve-punctuation --punctuation-marks-is-regex --punctuation-marks "[;:\!?¡¿—…\"«»“”]|[,.](?!\d)"uW   həloʊ, ,wɜːld? θɹiː θaʊzənd, ɔːɹ tuː pɔɪnt faɪv ziəɹoʊ. ¿həloʊ? c                 F    t          |            t          d||            d S )Nu+   hello, ,world? ‡ 3,000, or 2.50. ¿hello?)printr*   )r"   expecteds     r)   test_punctuation_is_regexrc      s(     
$KKK	
74HHHHHr1   c                      t          j        t                    5  t          dd d           d d d            d S # 1 swxY w Y   d S )Nr9   z6--punctuation-marks-is-regex --punctuation-marks "[*,")r-   r.   r/   r*   r0   r1   r)   test_invalid_punctuation_regexre      s    	z	"	" ] ]mT#[\\\] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ] ]s   9= =)r   )#__doc__r   r   r   r   r   r-   phonemizer.backendr   r   
phonemizerr   r   r   r*   r2   r5   r7   r<   markskipifr\   versionr?   parametrizerF   rH   rM   is_availableis_supported_languagerO   rZ   r_   rc   re   r0   r1   r)   <module>ro      sf   ) ( 
			    



  A A A A A A A A , , , , , , , , , ,1 1 1 1(    
  
* * * 	W$,,...   C C	 C 1a&))G G *)G@ @ @' ' '
 ((*** <11(;;;1  3 3E E	3 3E
K K K; ; ;  e e ef fI If fI
] ] ] ] ]r1   