Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_codeccallbacks.cpython-38.opt-2.pyc
U

>��gޣ�@s�ddlZddlZddlZddlZddlZGdd�d�ZGdd�de�ZGdd�de�Z	Gdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZGdd�de
�ZGdd�dej�Zedkr�e��dS)�Nc@seZdZdd�Zdd�ZdS)�	PosReturncCs
d|_dS)Nr)�pos��self�r�7/opt/cppython/lib/python3.8/test/test_codeccallbacks.py�__init__szPosReturn.__init__cCs>|j}|}|dkr t|j�|}||jkr6t|j�|_d|fS)Nr�<?>)r�len�object�start)r�excZoldposZrealposrrr�handles
zPosReturn.handleN)�__name__�
__module__�__qualname__rrrrrrrsrc@seZdZdd�ZdS)�BadStartUnicodeEncodeErrorcCst�|ddddd�g|_dS�N�ascii�r��bad)�UnicodeEncodeErrorrrrrrrrsz#BadStartUnicodeEncodeError.__init__N�rrrrrrrrrsrc@seZdZdd�ZdS)�BadObjectUnicodeEncodeErrorcCst�|ddddd�g|_dSr)rrrrrrrr!sz$BadObjectUnicodeEncodeError.__init__Nrrrrrr src@seZdZdd�ZdS)�NoEndUnicodeDecodeErrorcCs t�|dtd�ddd�|`dS�Nr�rrr)�UnicodeDecodeErrorr�	bytearray�endrrrrr'sz NoEndUnicodeDecodeError.__init__Nrrrrrr&src@seZdZdd�ZdS)�BadObjectUnicodeDecodeErrorcCs"t�|dtd�ddd�g|_dSr)rrrrrrrrr-sz$BadObjectUnicodeDecodeError.__init__Nrrrrrr!,sr!c@seZdZdd�ZdS)�NoStartUnicodeTranslateErrorcCst�|dddd�|`dS�Nrrrr)�UnicodeTranslateErrorrrrrrrr3sz%NoStartUnicodeTranslateError.__init__Nrrrrrr"2sr"c@seZdZdd�ZdS)�NoEndUnicodeTranslateErrorcCst�|dddd�|`dSr#)r$rr rrrrr9sz#NoEndUnicodeTranslateError.__init__Nrrrrrr%8sr%c@seZdZdd�ZdS)�NoObjectUnicodeTranslateErrorcCst�|dddd�|`dSr#)r$rrrrrrr?sz&NoObjectUnicodeTranslateError.__init__Nrrrrrr&>sr&c@s$eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGS)H�CodecCallbackTestcCs0d}|�|�dd�d�|�|�dd�d�dS)Nuスパモ änd eggsr�xmlcharrefreplaces&&#12473;&#12497;&#12514; &#228;nd eggs�latin-1s!&#12473;&#12497;&#12514; �nd eggs��assertEqual�encode)r�srrr�test_xmlcharrefreplaceEs
�
�z(CodecCallbackTest.test_xmlcharrefreplacecCsddd�}t�d|�d}d}|�|�dd�|�d}|�|�dd�|�d	}|�|�d
d�|�dS)Nc	Ss�t|t�std|��g}|j|j|j�D]J}z|�dtjj	t
|��Wq,tk
rt|�dt
|��Yq,Xq,d�|�|jfS)N�don't know how to handle %rz&%s;�&#%d;r)
�
isinstancer�	TypeErrorrrr �append�htmlZentitiesZcodepoint2name�ord�KeyError�join�r
�l�crrr�xmlcharnamereplaceWs
zECodecCallbackTest.test_xmlcharnamereplace.<locals>.xmlcharnamereplaceztest.xmlcharnamereplaceu«ℜ» = 〈ሴ€〉s0&laquo;&real;&raquo; = &lang;&#4660;&euro;&rang;rs$�&real;� = &lang;&#4660;&euro;&rang;r)s�&real;� = &lang;&#4660;�&rang;�iso-8859-15��codecs�register_errorr+r,)rr;�sin�soutrrr�test_xmlcharnamereplaceSs�z)CodecCallbackTest.test_xmlcharnamereplacecCsddd�}t�d|�d}d}|�|�dd�|�d}|�|�dd�|�d	}|�|�d
d�|�dS)Nc	Ss`t|t�std|��g}|j|j|j�D]}|�t�|dt	|���q,dd�
|�|jfS)Nr/z0x%xz
%sz, )r1rr2rrr r3�unicodedata�namer5r7r8rrr�uninamereplacevs
z=CodecCallbackTest.test_uninamereplace.<locals>.uninamereplaceztest.uninamereplaceu¬ሴ€耀sNNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000rsE�ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000r)sA�ETHIOPIC SYLLABLE SEE�CJK UNIFIED IDEOGRAPH-8000r<r=)rrEr@rArrr�test_uninamereplacems	�z%CodecCallbackTest.test_uninamereplacecCsPd}d}|�|�dd�|�d}|�|�dd�|�d}|�|�dd�|�dS)	N�a¬ሴ€耀􏿿s!a\xac\u1234\u20ac\u8000\U0010ffffr�backslashreplacesa�\u1234\u20ac\u8000\U0010ffffr)sa�\u1234�\u8000\U0010ffffr<r*�rr@rArrr�test_backslashescape�sz&CodecCallbackTest.test_backslashescapecCsPd}d}|�|�dd�|�d}|�|�dd�|�d}|�|�dd�|�dS)	NrGs[a\N{NOT SIGN}\N{ETHIOPIC SYLLABLE SEE}\N{EURO SIGN}\N{CJK UNIFIED IDEOGRAPH-8000}\U0010ffffr�namereplacesPa�\N{ETHIOPIC SYLLABLE SEE}\N{EURO SIGN}\N{CJK UNIFIED IDEOGRAPH-8000}\U0010ffffr)sDa�\N{ETHIOPIC SYLLABLE SEE}�\N{CJK UNIFIED IDEOGRAPH-8000}\U0010ffffr<r*rIrrr�test_nameescape�sz!CodecCallbackTest.test_nameescapecCsJdd�}t�d|�d}d}|�|�dd�|�d}|�t|jdd�dS)NcSsFt|t�std|��|j|j|jd�dkr>d|jdfS|�dS)Nr/�s���)r1rr2rr�r
rrr�relaxedutf8�s

z>CodecCallbackTest.test_decoding_callbacks.<locals>.relaxedutf8ztest.relaxedutf8sab��cü����u	abcü�utf-8s����)r>r?r+�decode�assertRaisesr)rrPr@rArrr�test_decoding_callbacks�s
�z)CodecCallbackTest.test_decoding_callbackscCs�tdd�dD��}d}d}|�t�|d|�d|�d}|�ttj|d|�d	|td
�<d}d}|�t�|d
|�d|�d|td
�<|�ttj|d
|�dS)Ncss(|] }t|�td|��d�fVqdS)rMrN)r5�bytes�upper��.0r:rrr�	<genexpr>�sz7CodecCallbackTest.test_charmapencode.<locals>.<genexpr>Zabcdefgh�abcsAABBCC�strictrZabcAsXYZ�?ZabcDEFsAABBCCXYZXYZXYZ�replaceZXYZ)�dictr+r>�charmap_encoderS�UnicodeErrorr5r2)r�charmapr@rArrr�test_charmapencode�sz$CodecCallbackTest.test_charmapencodecCs�dd�}t�d|�dd�}t�d|�d}|�|�dd�d	�|�|�dd�d
�|�d�dd�d
�|�d�dd�d�|�t�ddtd�di�dd�|�d�dd�d�|�d�dd�d�dS)Ncsjt�j�j�}t�t�r,�fdd�|D�}n*t�t�rJ�fdd�|D�}ntd���dd�|��jfS)Ncsg|]}dt�j|��qS�z<%d>)r5r�rXrrOrr�
<listcomp>�szFCodecCallbackTest.test_callbacks.<locals>.handler1.<locals>.<listcomp>csg|]}d�j|�qSrc�rrdrOrrre�sr/�[%s]r)�rangerr r1rrr2r7)r
�rr9rrOr�handler1�s

z2CodecCallbackTest.test_callbacks.<locals>.handler1z
test.handler1csJt�t�std����fdd�t�j�j�D�}dd�|��jdfS)Nr/csg|]}d�j|�qSrcrfrdrOrrre�szFCodecCallbackTest.test_callbacks.<locals>.handler2.<locals>.<listcomp>rgrr)r1rr2rhrr r7)r
r9rrOr�handler2�s
z2CodecCallbackTest.test_callbacks.<locals>.handler2z
test.handler2s���rz[<129>][<128>][<255>]z[<129>][<128>]s\u3042\u3xxx�unicode-escapeuあ[<92><117><51>]xxxs\u3042\u3xxuあ[<92><117><51>]xxsabc�a�zrz
z[<98>][<99>]ugüßrksg[<252><223>]rkugüßs
g[<252><223>])r>r?r+rR�charmap_decoder5r,)rrjrkr-rrr�test_callbacks�sB

�
�
�
��
�
�z CodecCallbackTest.test_callbackscs�ddddddg}|D]}t�d|t�|��qd�|d	d
�|D�7}�fdd
�dD�D]>}d
D]4}|D]*}z|�||�Wqhtk
r�YqhXqhq`qXdS)Nr[�ignorer]r(rHrK�test.��cSsg|]}d|�qS)rrr)rX�errrrrresz6CodecCallbackTest.test_longstrings.<locals>.<listcomp>csg|]}|��qSrr)rXr-�r9rrres)�x�あuaä)rr)�
iso-8859-1r<rQ�utf-7�utf-16�utf-32)r>r?�lookup_errorr,r`)r�errorsrtZuni�encrrur�test_longstringss�z"CodecCallbackTest.test_longstringsc
Cs�|jt|f|dd���|jt|f|dg��ddddddg}tt|��D]n}|D]d}t|�t||�krpqVg}tt|��D]&}||kr�|�|�q�|�||�q�|jt|f|��qVqN||�}	|�t|	�|�dS)N���ztoo muchZspamseggssspam�*g�?)rSr2rhr
�typer3r+�str)
r�exctype�args�msgZ	wrongargs�iZwrongargZcallargs�jr
rrr�check_exceptionobjectargs"sz+CodecCallbackTest.check_exceptionobjectargscCs�|�tdddddgd�|�tdddddgd�|�tdd	d
ddgd�|�tddd
ddgd
�|�tddd
ddgd�|�tddd
ddgd�dS)Nr�gürkrrM�ouchz?'ascii' codec can't encode character '\xfc' in position 1: ouch�z;'ascii' codec can't encode characters in position 1-3: ouchuüxrz?'ascii' codec can't encode character '\xfc' in position 0: ouchuĀxzA'ascii' codec can't encode character '\u0100' in position 0: ouchu￿xzA'ascii' codec can't encode character '\uffff' in position 0: ouchu𐀀xzE'ascii' codec can't encode character '\U00010000' in position 0: ouch)r�rrrrr�test_unicodeencodeerror;s<������z)CodecCallbackTest.test_unicodeencodeerrorcCs<|�tdtd�dddgd�|�tdtd�dddgd�dS)	Nrsg�rkrrMr�z8'ascii' codec can't decode byte 0xfc in position 1: ouch�z6'ascii' codec can't decode bytes in position 1-2: ouch)r�rrrrrr�test_unicodedecodeerror[s��z)CodecCallbackTest.test_unicodedecodeerrorcCsr|�tddddgd�|�tddddgd�|�tddddgd	�|�td
dddgd�|�tddddgd
�dS)Nr�rrMr�z4can't translate character '\xfc' in position 1: ouchugĀrkz6can't translate character '\u0100' in position 1: ouchug￿rkz6can't translate character '\uffff' in position 1: ouchug𐀀rkz:can't translate character '\U00010000' in position 1: ouchr�z0can't translate characters in position 1-2: ouch)r�r$rrrr�test_unicodetranslateerrorgs2
�
�
�
�
�z,CodecCallbackTest.test_unicodetranslateerrorc
Cs~|�ttjd�|�ttjtd��|�ttjtddddd��|�ttjtdtd�ddd��|�ttjtdddd��dS)Nr�r�rrwrr��)	rSr2r>�
strict_errors�	Exceptionrrrr$rrrr�test_badandgoodstrictexceptions�s2�����z1CodecCallbackTest.test_badandgoodstrictexceptionsc
Cs�|�ttjd�|�ttjtd��|�t�tddddd��d�|�t�tdtd�ddd��d�|�t�t	dddd��d�dS)	Nr�r�r�aあbrrM)rrM�a�b)
rSr2r>�
ignore_errorsr`r+rrrr$rrrr�test_badandgoodignoreexceptions�s8��������z1CodecCallbackTest.test_badandgoodignoreexceptionsc
Cs�|�ttjd�|�ttjtd��|�ttjt��|�ttjt��|�t�tddddd��d�|�t�t	dt
d�ddd��d	�|�t�tdddd��d	�dS)
Nr�r�rr�rrM)r\rMr�)��rM)rSr2r>�replace_errorsr`rr!r+rrrr$rrrr� test_badandgoodreplaceexceptions�sL����������z2CodecCallbackTest.test_badandgoodreplaceexceptionscCs�|�ttjd�|�ttjtd��|�ttjtdtd�ddd��|�ttjtdddd��d}|d	7}d
�dd�|D��}|�	t�t
dd
|dddt|�d��d
�dd�|D��dt|�f�dS)Nr�r�rr�rrrw)rr�	�
�c�di�rsi'�'i��順i?B�@B)i�i��rcss|]}t|�VqdS�N��chrrWrrrrYszOCodecCallbackTest.test_badandgoodxmlcharrefreplaceexceptions.<locals>.<genexpr>rm�bcss|]}d|VqdS)r0NrrWrrrrY	s)rSr2r>�xmlcharrefreplace_errorsr`rrr$r7r+rr
)r�csr-rrr�*test_badandgoodxmlcharrefreplaceexceptions�sB����
���z<CodecCallbackTest.test_badandgoodxmlcharrefreplaceexceptionsc
Cs<|�ttjd�|�ttjtd��ddddddd	d
ddd
dg}|D]�\}}|j|d��x|�t�tdd|dddt|�d��|dt|�f�|�t�t	d|dddt|�d��|dt|�f�W5QRXqDddddg}|D]N\}}|j|d��4|�t�t
dtd|d�ddd��|df�W5QRXq�dS)Nr�r�)rwz\u3042)�
�\x0a)rm�\x61�rN�\x00)�ÿ�\xff)uĀz\u0100)u￿z\uffff)u𐀀z
\U00010000�u􏿿z
\U0010ffff���z\ud800���z\udfff����z\ud800\udfff�r�rrmr�r)�ar�)�
r�)�r�)r�r�)rUr��brM)rSr2r>�backslashreplace_errorsr`�subTestr+rr
r$rr)r�testsr-rir�rrr�)test_badandgoodbackslashreplaceexceptionss|���
���
�������z;CodecCallbackTest.test_badandgoodbackslashreplaceexceptionsc
Cs�|�ttjd�|�ttjtd��|�ttjtdtd�ddd��|�ttjtdddd��dd	d
ddd
ddg}|D]Z\}}|j|d��@|�	t�t
dd|dddt|�d��|dt|�f�W5QRXqvdS)Nr�r�rr�rrrw)rwz\N{HIRAGANA LETTER A}r�)uﯹzW\N{ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM})u󠁿z\N{CANCEL TAG}r�r�r�r�r�rmr�)rSr2r>�namereplace_errorsr`rrr$r�r+rr
)rr�r-rirrr�$test_badandgoodnamereplaceexceptionsFsR�����
���z6CodecCallbackTest.test_badandgoodnamereplaceexceptionscCs�t�d�}|�t|d�|�t|td��|�t|tdddd��dD]6}|j|d�� |�t|td	|ddd��W5QRXqF|�|td	d
ddd��d�|�t	|t	d	t
d
�ddd��|�|t	d	t
d�ddd��d�dS)N�surrogateescaper�r���rr)rmu�u�r�rua�brM)��rMr�sa�b)r�rM)r>r|rSr2r`r$r�rr+rr)rZsurrogateescape_errorsr-rrr�(test_badandgoodsurrogateescapeexceptionstsP
���������z:CodecCallbackTest.test_badandgoodsurrogateescapeexceptionscCs�t�d�}|�t|d�|�t|td��|�t|tdddd��dD]V}|j|d��@|�t|t|d	ddd��|�t|t|d	�	|�ddd��W5QRXqFd
D]:}|j|d��$|�t|td|dt
|�d��W5QRXq�d
ddddddddddddddg}|D]�\}}}}|j|||d���|�|t|d	|dddt
|�d��|dt
|�f�|�|t|td|d|�d�dd|d��|dd�d|f�W5QRX�qdS) N�
surrogatepassr�r�r�rr)rQ�utf-16le�utf-16be�utf-32le�utf-32be)�encodingrm)r�r�r�r�r)rQr�s�r�)r�r�s�rM)r�r�s�rM)r�r�s�r�)r�r�s�r�)rQr�s�r�)r�r�s��rM)r�r�s�rM)r�r�s��r�)r�r�s�r�)rQr�s��r�)r�r�s��rM)r�r�s��rM)r�r�s���r�)r�r�s��r�)r�r�rUr�r�r�)
r>r|rSr2r`r$r�rrr,r
r+r)rZsurrogatepass_errorsr~r-r�r��nrrr�&test_badandgoodsurrogatepassexceptions�s�
�������
������z8CodecCallbackTest.test_badandgoodsurrogatepassexceptionscsfd}d}|D]T�t�d�fdd��|D]}|�tdj|d�q(dD]\}}|�t|j|d�qDqdS)N)	r��foo)rrMr��r�rr��r�N�r�r�r�r�)rr)rxr<ztest.badhandlercs�Sr�r)rv��resrr�<lambda>�rz:CodecCallbackTest.test_badhandlerresults.<locals>.<lambda>rw)�rr��rQr�)rys+x-)r>r?rSr2r,rR)r�resultsZencsr~rUrr�r�test_badhandlerresults�s$��z(CodecCallbackTest.test_badhandlerresultscCs||�tjt�d��|�tjt�d��|�tjt�d��|�tjt�d��|�tjt�d��|�tjt�d��dS)Nr[rqr(rHrK)r+r>r�r|r�r�r�r�rrrr�test_lookups���zCodecCallbackTest.test_lookupcCs4dd�}t�d|�dD]}|�tdj|d�qdS)NcSs$t|t�rd|jfStd|��dS)N�䉂r/)r1rr r2rOrrr�	unencrepls

z@CodecCallbackTest.test_unencodablereplacement.<locals>.unencreplztest.unencreplhandler)rrxr<r�)r>r?rSrr,)rr�r~rrr�test_unencodablereplacements�z-CodecCallbackTest.test_unencodablereplacementcCs&|�ttjd�|�ttjdd�dS)Nr�z
test.dummy)rSr2r>r?rrrr�test_badregistercall!sz&CodecCallbackTest.test_badregistercallcCs|�ttj�dSr�)rSr2r>r|rrrr�test_badlookupcall(sz$CodecCallbackTest.test_badlookupcallcCs|�ttjd�dS)N�test.unknown)rS�LookupErrorr>r|rrrr�test_unknownhandler-sz%CodecCallbackTest.test_unknownhandlercCsJd}d�dd�|D��}t�dtj�dD]}dD]}|�||�q2q*dS)N)
r�r��2r�i�rsi�r�iP�r�i �r�rcSsg|]}t|��qSrr�)rXrvrrrre8sz;CodecCallbackTest.test_xmlcharrefvalues.<locals>.<listcomp>�test.xmlcharrefreplace)rr<)r(r�)r7r>r?r�r,)r�vr-r~rtrrr�test_xmlcharrefvalues2sz'CodecCallbackTest.test_xmlcharrefvaluesc	Cs�|�tdjdd�dd�}t�d|�|�tdjdd�|�tdjdd�|�td	jdd�|�td
jdd�|�tdjdd�|�tdjd
d�dd�}t�d|�|�tdjdd�t�}t�d|j�d|_|�	d�dd�d�d|_|�	d�dd�d�d|_|�t
djdd�d|_|�	d�dd�d�d|_|�	d�dd�d�d|_|�t
djdd�d|_|�	d�d
d�d�Gdd�dt�}|�ttj
dd d!di�|�ttj
dd |��|�ttj
dd d!tjdi�dS)"Nr�rr�cSsdS�Nr�rrOrrr�baddecodereturn1Dsz=CodecCallbackTest.test_decodehelper.<locals>.baddecodereturn1ztest.baddecodereturn1�\rls\x0s\x0ys
\Uffffeeees\uyyyy�raw-unicode-escapecSsdS�N)r\NrrOrrr�baddecodereturn2Nsz=CodecCallbackTest.test_decodehelper.<locals>.baddecodereturn2ztest.baddecodereturn2�test.posreturnr�s�0z<?>0���z<?><?>���rrMr	r��s\uyyyy0c@seZdZdd�ZdS)z.CodecCallbackTest.test_decodehelper.<locals>.DcSst�dSr���
ValueError�r�keyrrr�__getitem__ssz:CodecCallbackTest.test_decodehelper.<locals>.D.__getitem__N�rrrr�rrrr�Drsr�r[�)rSr�rRr>r?r2rrrr+�
IndexErrorr^r`ror��sys�
maxunicode)rr�r��handlerr�rrr�test_decodehelper>s@z#CodecCallbackTest.test_decodehelperc	Csv|�tdjdd�dd�}t�d|�|�tdjdd�dd�}t�d	|�|�tdjdd	�t�}t�d
|j�d|_|�	d�dd
�d
�d|_|�	d�dd
�d�d|_|�t
djdd
�d|_|�	d�dd
�d
�d|_|�	d�dd
�d�d|_|�t
djdd
�d|_Gdd�dt�}dD]L}|�ttj
d|ddi�|�ttj
d||��|�ttj
d|ddi��q$dS)Nr�rr�cSsdSr�rrOrrr�badencodereturn1sz=CodecCallbackTest.test_encodehelper.<locals>.badencodereturn1ztest.badencodereturn1cSsdSr�rrOrrr�badencodereturn2�sz=CodecCallbackTest.test_encodehelper.<locals>.badencodereturn2ztest.badencodereturn2r�r�uÿ0s<?>0r�s<?><?>r�rrMs<?>r�rc@seZdZdd�ZdS)z.CodecCallbackTest.test_encodehelper.<locals>.DcSst�dSr�r�r�rrrr��sz:CodecCallbackTest.test_encodehelper.<locals>.D.__getitem__Nr�rrrrr��sr�)r[r]r(rHrKr�r�i,)rSr�r,r>r?r2rrrr+r�r^r`r_r�)rr�rr�r�rtrrr�test_encodehelperys6z#CodecCallbackTest.test_encodehelpercCsBGdd�dt�}|�tdjdtjdi�|�tdjddi�dS)Nc@seZdZdd�ZdS)z1CodecCallbackTest.test_translatehelper.<locals>.DcSst�dSr�r�r�rrrr��sz=CodecCallbackTest.test_translatehelper.<locals>.D.__getitem__Nr�rrrrr��sr�r�r�rr)r^rSr��	translater�r�r2)rr�rrr�test_translatehelper�sz&CodecCallbackTest.test_translatehelpercCsDtd�dtd�dtd�dtd�di}d	D]}d
|}|�|�q(dS)N�&z&amp;�<z&lt;�>z&gt;�"z&quot;)rr�r�rszabc<def>ghi)r5r)rrar��textrrr�test_bug828737�s�z CodecCallbackTest.test_bug828737c
Cs�dddddddg}dd	�}t�d
|�|D]*\}}|�t��|�|d
�W5QRXq*dd�}t�d
|�|D]\}}|�|�|d
�d�qndS)Nr�)rys++r�)rzr�)r{r�)rl�\u123g)r�r
cSs$t|t�rd|_dStd|��dS)Nr��r�rr/�r1rrr2rOrrr�	replacing�s
z?CodecCallbackTest.test_mutatingdecodehandler.<locals>.replacingztest.replacingcSs$t|t�rd|_dStd|��dS)Nrrr/rrOrrr�mutating�s
z>CodecCallbackTest.test_mutatingdecodehandler.<locals>.mutatingz
test.mutatingr�)r>r?rSr2rRr+)rZbaddatar
r��datarrrr�test_mutatingdecodehandler�s"�
z,CodecCallbackTest.test_mutatingdecodehandlercCs�dd�}t�d|�|�d�dd�d�|�d�dd�d�|�d	�d
d�d�|�d�d
d�d�dd�}t�d|�|�d�dd�d�|�d�dd�d�dS)NcSs(t|t�rd|jdfStd|��dS)Nr�rr/)r1rrr2rOrrr�forward_shorter_than_end�s
zPCodecCallbackTest.test_crashing_decode_handler.<locals>.forward_shorter_than_endztest.forward_shorter_than_ends�����z	utf-16-leu����Øs�����z	utf-16-besz	utf-32-leu
���ᄑsz	utf-32-becSs*t|t�rd|_d|jfStd|��dS)Nsr�r/)r1rrrr2rOrrr�replace_with_long
s

zICodecCallbackTest.test_crashing_decode_handler.<locals>.replace_with_longztest.replace_with_longr�rzu�r{u�)r>r?r+rR)rrrrrr�test_crashing_decode_handler�sV���������
�
�z.CodecCallbackTest.test_crashing_decode_handlercs�tjtjtjtjtjtjt�d�t�d�g}tt	t
fD]��G�fdd�dt�}|D].}|j|�d��|�
t||��W5QRXqRG�fdd�dt�}|D]B}|j|�d��*|�
t|f��||��W5QRXW5QRXq�q6dS)Nr�r�cseZdZ�ZdS�zACodecCallbackTest.test_fake_error_class.<locals>.FakeUnicodeErrorN�rrr�	__class__r��clsrr�FakeUnicodeError+sr)r�Zerror_classcseZdZ�ZdSrrrrrrr0s)r>r�r�r�r�r�r�r|rrr$r�r�rSr2r�)r�handlersrr�rrr�test_fake_error_classs&�
z'CodecCallbackTest.test_fake_error_classN)&rrrr.rBrFrJrLrTrbrprr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	rrrrrrrr'CsF
9 (%:.,H;6
$3r'�__main__)r>Z
html.entitiesr4r�rCZunittestrrrrrrr!r$r"r%r&ZTestCaser'r�mainrrrr�<module>s,|

F1le Man4ger