o
    GXîh  ã                   @   sJ   d Z ddlZddlZdd„ ZdZG dd„ dejƒZedkr#e ¡  dS 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   )Útestr   ÚtupleÚgetregentry)Úencodingr   © r   ú@/opt/python-3.10.19/usr/lib/python3.10/test/test_charmapcodec.pyÚcodec_search_function   s   r	   r   c                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚCharmapCodecTestc                 C   s   t  t¡ |  t jt¡ d S )N)ÚcodecsÚregisterr	   Z
addCleanupÚ
unregister©Úselfr   r   r   ÚsetUp   s   
zCharmapCodecTest.setUpc                 C   s^   |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ |   tdtƒd¡ |   td	tƒd
¡ d S )Nó   abcÚabcs   xdefZabcdefs   defxZdefabcs   dxfZdabcfs   dxfxZdabcfabc©ÚassertEqualÚstrÚ	codecnamer   r   r   r   Útest_constructorx    ó
   z"CharmapCodecTest.test_constructorxc                 C   s^   |   d t¡d¡ |   d t¡d¡ |   d t¡d¡ |   d t¡d¡ |   d	 t¡d
¡ d S )Nr   r   Zxdefs   abcdefZdefxs   defabcZdxfs   dabcfZdxfxs   dabcfabc)r   Úencoder   r   r   r   r   Útest_encodex'   r   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   dyfÚdfs   dyfyr   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_maptoundefined4   s   z$CharmapCodecTest.test_maptoundefinedN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r
      s    r
   Ú__main__)	Ú__doc__Zunittestr   r	   r   ZTestCaser
   r    Úmainr   r   r   r   Ú<module>   s    ÿ