python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_multibytecodec.cpython-311.opt-1.pyc

e,?ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZgdZGddej
ZGdd	ej
ZGd
dej
ZGdd
ej
ZGddej
ZGddej
ZGddej
ZGddeZedkrejdSdS)N)support)	os_helper)TESTFN)gb2312gbkgb18030hz	big5hkscscp932	shift_jiseuc_jpeuc_jisx0213shift_jisx0213euc_jis_2004shift_jis_2004cp949euc_krjohabbig5cp950
iso2022_jpiso2022_jp_1iso2022_jp_2iso2022_jp_2004iso2022_jp_3iso2022_jp_ext
iso2022_krc8eZdZdZdZdZdZdZdZdZ	dS)	Test_MultibyteCodecctD]x}|d|d|td|d|d|dydS)N)ALL_CJKENCODINGSassertEqualdecodestrencodeselfencs  L/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_multibytecodec.pytest_nullcodingz#Test_MultibyteCodec.test_nullcoding#s|#	2	2CSZZ__b111Sc]]B///RYYs^^S1111	2	2r!cltD]+}|d|d,dS)Nabcdabcd)r#r$r'r(s  r+test_str_decodez#Test_MultibyteCodec.test_str_decode)s@#	:	:CV]]3//9999	:	:r!ctjd}d}tjd||t|dddS)Nzeuc-krc$dtjdzfS)Nr")sysmaxsize)excs r+<lambda>zBTest_MultibyteCodec.test_errorcallback_longindex.<locals>.<lambda>/s"ck!m!4r!ztest.cjktestsapplehamspam)codecs
getdecoderregister_errorassertRaises
IndexError)r)dec	myreplaces   r+test_errorcallback_longindexz0Test_MultibyteCodec.test_errorcallback_longindex-s]))44	ni888*c1>	C	C	C	C	Cr!cd}tjdtjtD],}|||dd-dS)Nu,ztest.ignorer!)r8r:
ignore_errorsr#r$r')r)datar*s   r+ test_errorcallback_custom_ignorez4Test_MultibyteCodec.test_errorcallback_custom_ignore4samV-ABBB#	C	CCT[[m<<cBBBB	C	Cr!c	tD]&}d|}t|'	tjt
dS#tjt
wxYw)Nz
# coding: {}
)r#formatexecrunlinkr)r)r*codes   r+test_codingspecz#Test_MultibyteCodec.test_codingspec;sk	%'

'..s33T





V$$$$$IV$$$$s.AA'c|ttjd|ttjddSN)r;AttributeError_multibytecodecMultibyteStreamReaderMultibyteStreamWriterr)s r+test_init_segfaultz&Test_MultibyteCodec.test_init_segfaultCsX.)?	G	G	G.)?	G	G	G	G	Gr!cvtD]0}|ttj|d1dSNr")r#r;	TypeErrorr8r9r(s  r+test_decode_unicodez'Test_MultibyteCodec.test_decode_unicodeJsE#	E	ECi):3)?)?DDDD	E	Er!N)
__name__
__module____qualname__r,r0r?rCrIrQrUr!r+rr!s222:::CCCCCC%%%GGGEEEEEr!rcdeZdZdZdZdZdZdZdZdZ	dZ
d	Zej
d
ZdS)Test_IncrementalEncoderc|tjd}||dd||d||ddd||d||ddd||dd	d||ddS)
Nru파이썬 마을s̽ u	☆∼☆Ts١r"r!Fr8getincrementalencoderr$r'resetr)encoders  r+test_statelessz&Test_IncrementalEncoder.test_statelessQs7&.w7799(IJJE	G	G	G$///(<dCC4	6	6	6$///D113777E22C888$/////r!c$tjd}||dd||dd||dd||ddd||d||dd	||dd||d
dd||d
dddS)Njisx0213æ̀ær!̀Tr"r]r`s  r+
test_statefulz%Test_IncrementalEncoder.test_stateful^sV;&.z::<<77EEE11377711;???$77EEE$///11;???113777D11;???D11377777r!ctjd}||dd|t
|jd||dd|t
|jd||d||dd||dd|t
|jd||d	d
ddS)Nrdrgr!uģùærfrhrjr"Tri)r8r^r$r'r;UnicodeEncodeErrorr_r`s  r+test_stateful_keep_bufferz1Test_IncrementalEncoder.test_stateful_keep_bufferqs;:&.z::<<113777,gnhGGG77EEE,gnhGGG$///11;???113777,gnhGGGD11;?????r!c|tjd}|}||dd||||dd||dd|}||dd||||dddS)Nrrerfrgr!rh)r8r^getstater$r'setstate)r)ra
initial_state
partial_states    r+$test_state_methods_with_buffer_statez<Test_IncrementalEncoder.test_state_methods_with_buffer_state}s>&.~>>@@((**
77EEE'''77EEE113777((**
11;???'''11;?????r!c|tjd}||dd|}||dd|}||dd||||dd||||dddS)Nrzzあs$B$"s(Bzs$")r8r^r$r'rprq)r)raen_statejp_states    r+(test_state_methods_with_non_buffer_statez@Test_IncrementalEncoder.test_state_methods_with_non_buffer_states<&.|<<>>,,d333##%%113JKKK##%%,,.>???"""11;???""",,d33333r!ctjd}||d|d||t
dd|d||dtjd}||t
dd|d	||t
d
ddS)Nrrrgsælittlerhrs	BBrxs	B)r8r^r$rpr'int
from_bytes)r)buffer_state_encodernon_buffer_state_encoders   r+$test_getstate_returns_expected_valuez<Test_IncrementalEncoder.test_getstate_returns_expected_values Lv;NKKMM-6688!<<<##H----6688A&	''	(	(	(	##H----6688!<<<$N6#?#M#M#O#O 1::<<A%''	(	(	(
	!''1111::<<A%''	(	(	(	(	(r!ctjd}tdd}|t
|j|dS)Nr
s	r})r8r^r~rr;UnicodeErrorrq)r)rapending_size_nines   r+"test_setstate_validates_input_sizez:Test_IncrementalEncoder.test_setstate_validates_input_sizes\8&.x88::NN
0
	
	
,(8:KLLLLLr!ctjd}tdd}|t
|j|dS)Nr
s
r})r8r^r~rr;UnicodeDecodeErrorrq)r)rainvalid_utf8s   r+#test_setstate_validates_input_bytesz;Test_IncrementalEncoder.test_setstate_validates_input_bytess[8&.x88::~~
0
	
	
,g.>MMMMMr!ctjdd}||dd||dddS)Nz	shift-jisbackslashreplaceÿs\xff

)r8r^r$r'r`s  r+test_issue5640z&Test_IncrementalEncoder.test_issue5640sg;&.{;;<NOO//:::--u55555r!cddl}d}d}tjd||fz}||}||ddS)NrruEPython の開発は、1990 年ごろから開始されています。a5
            import codecs
            encoding = %r
            text = %r
            encoder = codecs.getincrementalencoder(encoding)()
            text2 = encoder.encode(text).decode(encoding)
            if text2 != text:
                raise ValueError(f"encoding issue: {text2!a} != {text!a}")
        )	_testcapitextwrapdedentrun_in_subinterpr$)r)rencodingtextrHress      r+test_subinterpz&Test_IncrementalEncoder.test_subinterpsp	V 

$ ((..a     r!N)rVrWrXrbrkrnrtr{rrrrrcpython_onlyrrYr!r+r[r[Os000888&
@
@
@
@
@
@444"(((@MMMNNN666

!!!!!r!r[c2eZdZdZdZdZdZdZdZdS)Test_IncrementalDecoderc4tjd}||dd||dd||dddS)Nrs̽u파이s u
썬 마을r!r")r8getincrementaldecoderr$r%r)decoders  r+	test_dbcsz!Test_IncrementalDecoder.test_dbcss7&.w7799(?@@'	)	)	)(@AA.	0	0	0,,b11111r!ctjd}||dd|t
|jdd||dd||dd|t
|jdd||dddS)	Nrsu파r!Tu이s̽)r8rr$r%r;rrs  r+test_dbcs_keep_bufferz-Test_IncrementalDecoder.test_dbcs_keep_buffers7&.w779988(CCC,gnc4HHH00(;;;88(CCC,gn%t	-	-	-00(;;;;;r!ctjd}d}|||dzd||ddd|||dzd||dd	||d
d	||ddd	||d||dd|||dzd|t|jd
d||dd	dS)Nz
iso2022-jp(r"BT$sB@$u世s@$@s@$z@$r!)r8rr$r%r_r;r)r)rESCs   r+test_iso2022z$Test_IncrementalDecoder.test_iso2022s<&.|<<>>d
33R888d33R888d
33R888//::://:::d33X>>>$///..555d
33R888,gnc4HHH//:::::r!ctD]?}tj|}|t|jd@dSrS)r#r8rr;rTr%)r)r*rs   r+rUz+Test_IncrementalDecoder.test_decode_unicodesP#	=	=C7f237799Gi<<<<	=	=r!ctjd}||dd|\}}||d||dd|\}}||d||dd|\}}||d|||f||dd|\}}||d|d||ddS)	Nr
suうr!r")sabci[)r8rr$r%rprq)r)rpending1_pending2flags2pending3pending4s        r+test_state_methodsz*Test_IncrementalDecoder.test_state_methodss8&.x88::	
44h???&&((!3'''	
00"555"++--&7+++	
00(;;;&&((!3'''	(F+,,,00(;;;&&((!3'''	,---))++-@AAAAAr!cFtjd}|t|jd|t|jd|t|jd|t
|jddS)Nr
{)invalidr)s1234r)s	123456789r)r8rr;rTrqrrs  r+test_setstate_validates_inputz5Test_IncrementalDecoder.test_setstate_validates_input-s8&.x88::)W%5s;;;)W%5~FFF)W%57KLLL,(8:KLLLLLr!N)	rVrWrXrrrrUrrrYr!r+rrsv222	<	<	<
;
;
;===BBB8MMMMMr!rceZdZdZdS)Test_StreamReaderc	ttd}	|d|n#|wxYwt	jtd}	|t|jd|n#|wxYw	tj	tdS#tj	twxYw)Nwbr)r)
openrwritecloser8r;rreadrrG)r)fs  r+test_bug1728403z!Test_StreamReader.test_bug17284035s	%VT""A
   								FW555A
!!"4afa@@@									V$$$$$IV$$$$s9C"AC"AC"7!B-C"-CC""C=N)rVrWrXrrYr!r+rr4s#
%
%
%
%
%r!rc eZdZdZdZdZdS)Test_StreamWriterctj}tjd|}|d||d|d||d|d||ddS)Nr123123𒍅s12379가¬s123797501ioBytesIOr8	getwriterrr$getvaluer)scs   r+test_gb18030zTest_StreamWriter.test_gb18030Es
:<<'FY''**	v...	'7888	4	6	6	6	6	6r!ctj}tjd|}|d||d|d||d|d||ddS)Nzutf-8rrrs123𒍅rs123𒍅가¬rrs   r+
test_utf_8zTest_StreamWriter.test_utf_8Ps
:<<%FW%%a((	v...	'=>>>	
$	%	%	%	%	%r!ctj}tjd|}|d||ddS)Nrr.r/r)r)rwrs   r+test_streamwriter_strwritez,Test_StreamWriter.test_streamwriter_strwrite\s]JLL
(V
i
(
(
+
+
w/////r!N)rVrWrXrrrrYr!r+rrDsA	6	6	6
%
%
%00000r!rcLeZdZdZdZejddZdS)Test_ISO2022c`d}d}||d|dS)Ns(B:hu4:unit.ANi de familleu:hu4:unité de familleziso2022-jp-2)r$r%)r)
iso2022jp2unis   r+test_g2zTest_ISO2022.test_g2cs6>
(**>::C@@@@@r!c|ddddD]C}d|}|td|DDdS)N­z
iso-2022-jp-2)ziso-2022-jp-2004z
iso-2022-jp-3u㐆c3"K|]
}|dkVdS)NrY).0xs  r+	<genexpr>z2Test_ISO2022.test_iso2022_jp_g0.<locals>.<genexpr>ls& 5 5aT 5 5 5 5 5 5r!)assertNotInr'assertFalseany)r)res   r+test_iso2022_jp_g0zTest_ISO2022.test_iso2022_jp_g0hs"3":":?"K"KLLL=	7	7H))AS 5 51 5 5 5556666	7	7r!cpucrtddD]%}t|dd&dS)Niiiso_2022_jpignore)rangechrr')r)rs  r+test_bug1572832zTest_ISO2022.test_bug1572832nsBw))	3	3AFFMM-2222	3	3r!N)rVrWrXrrrrequires_resourcerrYr!r+rrbs^AAA
777Wu%%33&%333r!rc:eZdZdZdZdZdZeezZdZdZ	dZ
dS)	TestStatefulu世世ziso-2022-jps$B@$@$s(Bcv||j|j|jdSrK)r$rr'rexpected_resetrPs r+test_encodezTestStateful.test_encode{s3))$-88$:MNNNNNr!ctj|jdfd|jD}|||j|dd|j|ddddS)Nr!c3BK|]}|VdSrKr')rcharras  r+rz7TestStateful.test_incrementalencoder.<locals>.<genexpr>sC##
NN4  ######r!r"Tfinal)	r8r^rjoinrr$expectedr'r_)r)outputras  @r+test_incrementalencoderz$TestStateful.test_incrementalencoder~s=&.t}==??####	#####	
///$77DDD$77=====r!cntj|jt|jdz
dfdt
|jD}|||j|	ddddS)Nr3r!c3RK|]!\}}||kV"dSrKr)rindexrra
last_indexs   r+rz=TestStateful.test_incrementalencoder_final.<locals>.<genexpr>sN55t
NN4*!455555555r!r"Tr)
r8r^rlenrr	enumerater$rr')r)rrar	s  @@r+test_incrementalencoder_finalz*TestStateful.test_incrementalencoder_finals=&.t}==??^^a'
55555(3355555	
!4555$77=====r!N)rVrWrXrrrr_rrrrrYr!r+rrtsbDHHE%NOOO>>>>>>>>r!rc(eZdZdZdZdZdZeezZdS)TestHZStatefulu聊聊r	s~{ADADs~}N)rVrWrXrrrr_rrYr!r+rrs,DHHE%NNNr!r__main__)rMr8rr4runittesttestrtest.supportrtest.support.os_helperrr#TestCaserr[rrrrrrrVmainrYr!r+<module>rs6



				



""""""))))))",E,E,E,E,E(+,E,E,E\U!U!U!U!U!h/U!U!U!nLMLMLMLMLMh/LMLMLM\%%%%%)%%% 00000)000<333338$333$>>>>>8$>>>8&&&&&\&&&zHMOOOOOr!