Mini Shell
3
��]�( � @ sJ d Z ddlZddlZddlZddlT ddlT ddlT G dd� dej�ZdS )zL
enchant.checker.tests: Unittests for enchant SpellChecker class
� N)�*c @ sh e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dd� ZdS )�TestCheckerz7TestCases for checking behaviour of SpellChecker class.c C s� d}t d|d�}�x�t|�D �]t\}}|dkrf| j|jd� | j|jd� | jd|j� k� |jd� |dkr|| j|jd � |d
kr�| j|jd� | j|jd�d
� | j|j d�d� |jt
d�� |dkr�| j|jd� |jd� |dk�r| j|jd� |jd t
|j� � |dk�r2| j|jd� |jd� |dk�r^| j|jd� |jd� |jd� |dk�r�| j|jd� |jd� |dkr| jd� qW d}| j|j� |� dS )!z+Test a basic run of the SpellChecker class.z�This is sme text with a few speling erors in it. Its gret
for checking wheather things are working proprly with the SpellChecker
class. Not gret for much elss though.�en_US)�textr �sme� Zsome� Zspeling� �erors� zling z in i�errors� ZgretZgreat� ZwheatherZwhether� ZproprlyZproperly�SpellChecker� Zelss�elsez%Extraneous spelling errors were foundz�This is some text with a few speling errors in it. Its great
for checking whether things are working properly with the SpellChecker
class. Not great for much else though.N���)r � enumerate�assertEqual�word�wordposZ
assertTrueZsuggest�replaceZleading_contextZtrailing_context�raw_unicode�replace_always�
set_offset�len�
ignore_always�fail�get_text)�selfr �chkr�n�errZtext2� r$ �/usr/lib/python3.6/tests.py�
test_basic0 sF
zTestChecker.test_basicc C sD d}t d|tjjgd�}x|D ]}| jd� qW | j|j� |� dS )z.Test SpellChecker with the 'filters' argument.z8I contain WikiWords that ShouldBe skipped by the filtersr )r �filtersz%Extraneous spelling errors were foundN)r �enchant�tokenizeZWikiWordFilterr r r )r r r! r# r$ r$ r% �test_filtersd s
zTestChecker.test_filtersc C sD d}t d|tjjgd�}x|D ]}| jd� qW | j|j� |� dS )z/Test SpellChecker with the 'chunkers' argument.z9I contain <html a=xjvf>tags</html> that should be skippedr )r �chunkersz%Extraneous spelling errors were foundN)r r( r) �HTMLChunkerr r r )r r r! r# r$ r$ r% �
test_chunkersn s
zTestChecker.test_chunkersc C s� d}t d|tjjgtjjgd�}x|D ]}| jd� q&W | j|j� |� t d|tjjgd�}x|D ]}| j|jd� P qbW | j|j� |� t d|tjjgd�}x|D ]}| j|jd� P q�W | j|j� |� d S )
z>Test SpellChecker with the 'chunkers' and 'filters' arguments.z�I contain <html a=xjvf>tags</html> that should be skipped
along with a <a href='http://example.com/">link to
http://example.com/</a> that should also be skippedr )r r'