B
    u9a¶  ã               @   sP   d Z ddlZddlZdd„ Ze e¡ dZG dd„ dejƒZedkrLe 	¡  dS )	zá Python character mapping codec test

This uses the test codec in testcodec.py and thus also tests the
encodings package lookup scheme.

Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright 2000 Guido van Rossum.

é    Nc             C   s$   | dkr ddl m} t| ¡ ƒS d S )NÚ	testcodecr   )r   )Ztestr   ÚtupleÚgetregentry)Úencodingr   © r   ú'/usr/lib/python3.7/test_charmapcodec.pyÚcodec_search_function   s    r   r   c               @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚCharmapCodecTestc             C   s^   |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ |   td	tƒd
¡ d S )Ns   abcÚabcs   xdefZabcdefs   defxZdefabcs   dxfZdabcfs   dxfxZdabcfabc)ÚassertEqualÚstrÚ	codecname)Úselfr   r   r   Útest_constructorx   s
    z"CharmapCodecTest.test_constructorxc             C   s^   |   d t¡d¡ |   d t¡d¡ |   d t¡d¡ |   d t¡d¡ |   d	 t¡d
¡ d S )Nr
   s   abcZxdefs   abcdefZdefxs   defabcZdxfs   dabcfZdxfxs   dabcfabc)r   Úencoder   )r   r   r   r   Útest_encodex$   s
    zCharmapCodecTest.test_encodexc             C   sL   |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ d S )Ns   ydefÚdefs   defys   dyfZdfs   dyfy)r   r   r   )r   r   r   r   Útest_constructory+   s    z"CharmapCodecTest.test_constructoryc             C   s   |   ttdt¡ d S )Ns   abc)ZassertRaisesÚUnicodeErrorr   r   )r   r   r   r   Útest_maptoundefined1   s    z$CharmapCodecTest.test_maptoundefinedN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r	      s   r	   Ú__main__)
Ú__doc__ZunittestÚcodecsr   Úregisterr   ZTestCaser	   r   Úmainr   r   r   r   Ú<module>
   s   
