Mini Shell

Direktori : /proc/self/root/lib64/python3.6/site-packages/speechd/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.6/site-packages/speechd/__pycache__/_test.cpython-36.pyc

3

��Y�@srddlZddlZddlmZmZmZmZmZGdd�dej�Z	Gdd�de	�Z
Gdd	�d	e	�Zed
krnej
�dS)�N�)�PunctuationMode�CallbackType�
SSIPClient�Scope�Speakerc@seZdZdd�Zdd�ZdS)�_SSIPClientTestcCs&td�|_|jjd�|jjd�dS)NZtestZen�)r�_clientZset_language�set_rate)�self�r
�/usr/lib64/python3.6/_test.py�setUps
z_SSIPClientTest.setUpcCs|jj�dS)N)r
�close)rr
r
r�tearDown sz_SSIPClientTest.tearDownN)�__name__�
__module__�__qualname__rrr
r
r
rrsrc@seZdZdZdd�ZdS)�
AutomaticTestz�A set of tests which may be evaluated automatically.

    Please put all tests which require a user to listen to their output to the
    VoiceTest below.

    cs�|jjd�tjgtjgtjgi�|jjd�fdd�d�|jjd�fdd�d�tjd�|jj	�|jjd	�fd
d�d�tjd��fdd
�tjtjtjfD�\}}}|ddgkr�|dgkr�d|kr�d|kr�d|ks�t
�df��dS)NZflitez]This message should get interrupted.  It is hopefully long enough to last more than 1 second.cs�|jd�S)N�msg1)�append)�type)�calledr
r�<lambda>9sz.AutomaticTest.test_callbacks.<locals>.<lambda>)�callbackz0This second message should not be spoken at all.cs�|jd�S)N�msg2)r)r)rr
rr;srzHi.cs�|jd�S)N�msg3)r)r)rr
rr?s�csg|]}�|�qSr
r
)�.0�t)rr
r�
<listcomp>Bsz0AutomaticTest.test_callbacks.<locals>.<listcomp>rrrz�This failure only indicates a possible error.  The test depends on proper timing and results may warry depending on the used output module and other conditions.  See the code of this test method if you want to investigate further.)r
�set_output_modulerZBEGINZCANCELZEND�speak�timeZsleepZcancel�AssertionError)rZstartedZcanceledZendedr
)rr�test_callbacks*s*	




zAutomaticTest.test_callbacksN)rrr�__doc__r&r
r
r
rr#src@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�	VoiceTestz�This set of tests requires a user to listen to it.

    The success or failure of the tests defined here can not be detected
    automatically.

    cCs>|j}|jd�|jtj�|jd�|jd�|jd�dS)NzTesting data escapes:�.zMarker at the end.
.
z.
Marker at the beginning.)r
r#Zset_punctuationrZALL)r�cr
r
r�test_escapesYs


zVoiceTest.test_escapescCs�|j}|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd�|jd
�|jd�|jd�|jd�|jd�|jd
�|jd�|jd�dS)NzTesting voice properties:�dzI am fat BillyzI am slim WillyrzI am quick Dick.�PzI am slow Joe.�2zI am quiet Mariette.zI am noisy Daisy.i����i����i���)r
r#Z	set_pitchrZ
set_volume)rr*r
r
r�test_voice_propertiesas"














zVoiceTest.test_voice_propertiescCs2|j}|jd�|jd�|jd�|jd�dS)NzTesting other commands:�aZshift_b�empty)r
r#�char�keyZ
sound_icon)rr*r
r
r�test_other_commandsts



zVoiceTest.test_other_commandscCs�|j}xv|j�D]j}|j|�td|�|j|d�xB|j�D]6\}}}td||||�|j|�|j|d|�q@WqWdS)Nz**zusing default voicez -z
 using voice )r
Zlist_output_modulesr"�printr#Zlist_synthesis_voicesZset_synthesis_voice)rr*�module�nameZlangZdialectr
r
r�
test_lists{s


zVoiceTest.test_listsN)rrrr'r+r/r4r8r
r
r
rr(Qs
r(�__main__)Zunittestr$ZclientrrrrrZTestCaserrr(r�mainr
r
r
r�<module>s
.6