python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_pulldom.cpython-312.opt-1.pyc

ΑeT1fddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZeddZd	Z
Gd
dejZGdd
ejZGddeZGddeZGdde	j(ZGddejZedk(rej0yy)N)AttributesImpl)feature_external_ges)pulldom)findfileztest.xmlxmltestdata)subdira
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xdc="http://www.xml.com/books">
<!-- A comment -->
<title>Introduction to XSL</title>
<hr/>
<p><xdc:author xdc:attrib="prefixed attribute" attrib="other attrib">A. Namespace</xdc:author></p>
</html>cleZdZdZdZdZejdZejdZ	dZ
y)PullDOMTestCasectjt}|j|jj
t
|ttd5}t
tj|dddy#1swYyxYw)z&Minimal test of DOMEventStream.parse()rbN)rparsetstfile
addCleanupstreamcloselistopen)selfhandlerfins   E/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_pulldom.py
test_parsezPullDOMTestCase.test_parsesc--(,,-W
'4
 	%Cs#$	%	%	%sBBcz	tjt}t|\}}|j	t|d|j
tj|t|\}}|j
tj||j
d|j|j
dt|j|j
|jjdjdt|\}}|j
tj|t|\}}|j
tj|t|\}}|j
d|j|}t|\}}|j
tj||j
d|jt|\}}|j
tj ||j
d|j|j	||ut|\}}|j
tj|t|\}}|j
tj||j
d|jt|\}}|j
tj ||j
d|jt|\}}|j
tj|t|\}}|j
tj||j
d	|jt|\}}|j
tj||j
d
|jt|\}}|j
tj|t|\}}|j
tj ||j
d
|jt|\}}|j
tj |t|\}}|j
tj|t|\}}|j
tj |y)z&Test DOMEventStream parsing semantics.
createElementhtmlz	xmlns:xdczhttp://www.xml.com/bookstitlezIntroduction to XSLhrpz
xdc:authorN)rparseStringSMALL_SAMPLEnext
assertTruehasattrassertEqualSTART_DOCUMENT
START_ELEMENTtagNamelen
attributesgetNamedItemvalue
CHARACTERSdataEND_ELEMENT)ritemsevtnode
title_nodes     rtest_parse_semanticsz$PullDOMTestCase.test_parse_semantics+s##L1K	To67//5K	T..4.C0155kBHH(	*K	T++S1K	T	
++S1K	T$,,/
K	T++S1.		:K	T,,c2$,,/
d*+K	T++S1K	T..4t||,K	T,,c2t||,K	T++S1K	T..4dll+K	T..4t||4K	T++S1K	T,,c2t||4K	T,,c2K	T++S1K	T,,c2ctjt}|D]`\}}|tjk(s|jdk(s*|j||j
dt|jn|jd|D]\}}|tjk(sn|j
djd|j||j
t|dtjt|\}}|j
|jd|j|t|t|\}}|j
|jd|jt5t|d	d	d	|j|j|j |j|j"y	#1swYPxYw)
z$Ensure expandItem works as expected.rz,No "title" element detected in SMALL_SAMPLE!rz=expandNode did not leave DOMEventStream in the correct state.rrrN)rr r!r'r(
expandNoder%r)
childNodesfailr"r-assertRaises
StopIterationclearassertIsNoneparserr)rr0r1itemr2s     rtest_expandItemzPullDOMTestCase.test_expandItemis##L1	HICg+++0G  &  C$89		H
IIFG	ICg+++		
t||K	M	eQ););<K	Ts+
UK	Tv.


}
-	K	

%,,'%,,'			sG))G2ctjt}|D]\}}|tjk(sy|j	dy)z*PullDOM does not receive "comment" events.zNo comment was encounteredN)rr r!COMMENTr:)rr0r1_s    rtest_commentzPullDOMTestCase.test_commentsE##L1	4FCgoo%	4
II23r5c2tjt}|D]*\}}|tjk(s|jdk(s*n	t|\}}|j
tj|y#t$r|jdYywxYw)z/PullDOM does not receive "end-document" events.rz8Ran out of events, but should have received END_DOCUMENTN)
rr r!r/r(r"r%END_DOCUMENTr<r:)rr0r1r2s    rtest_end_documentz!PullDOMTestCase.test_end_documents##L1	ICg)))dllf.D		LUICW1137	LIIJ
L	Ls
.A99BBctjt}|j}|j	t
}|j
|dy)NF)rr r!r?
getFeaturerr%)rr?	saxparsergess    rtest_external_ges_defaultz)PullDOMTestCase.test_external_ges_defaults<$$\2MM	""#78e$r5N)__name__
__module____qualname__rr4rAunittestexpectedFailurerErHrMr5rr
r
sN% 93|(@44
L
L%r5r
cHeZdZdZdZejdZdZddZ	y)ThoroughTestCasez(Test the hard-to-reach parts of pulldom.c`|jtjdty)z0Test some of the hard-to-reach parts of PullDOM.N)r?)_test_thoroughrr
SAXExerciserrs rtest_thorough_parsez$ThoroughTestCase.test_thorough_parsesGMM$|~FGr5cPtdtd}|j|y)z2SAX2DOM can"t handle a PI before the root element.N)SAX2DOMTestHelperrXrWrpds  rtest_sax2dom_failz"ThoroughTestCase.test_sax2dom_fails"t\^R
8Br5cRtdtd}|j|dy)z0Test some of the hard-to-reach parts of SAX2DOM.Nr\F)r]SAX2DOMExerciserrWr^s  rtest_thorough_sax2domz&ThoroughTestCase.test_thorough_sax2doms$
t%5%7
<B&r5ct|\}}|jtj||j	t|d|rt|\}}|jtj||jd|jt|\}}|jtj||jd|j|jd|jt|\}}|jtj||jd|jt|\}}|jtj||jd|jt|\}}|jtj||jd|j|jd|jt|\}}|jtj||jd|jt|\}}|jtj||jd|jt|\}}|jtj||jd|jt|\}}|jtj||jd|jt|\}}|jtj|y)	zPTest some of the hard-to-reach parts of the parser, using a mock
        parser.r	a commenttargetr.rrtextN)r"r%rr&r#r$rCr.PROCESSING_INSTRUCTIONrfr'r(r-r/rG)rr_before_rootr1r2s     rrWzThoroughTestCase._test_thoroughssH	T//5o67RICW__c2[$))4RICW;;SAXt{{3VTYY/H	T..4.H	T#.dii0H	T77=4;;/+H	T..4dll+H	T++S1+H	T,,c2dll+H	T,,c2.H	T--s3r5N)T)
rNrOrP__doc__rZrQrRr`rcrWrSr5rrUrUs/2H  
'
,4r5rUc*eZdZdZdZdZdZeZeZy)rXznA fake sax parser that calls some of the harder-to-reach sax methods to
    ensure it emits the correct eventsc||_yN)_handler)rrs  rsetContentHandlerzSAXExerciser.setContentHandlers	
r5c|j}|j|jd|jdd|j	dti|jd|jdd|j	dtddi|j
d|jd|jd|jy)	Nrerfr.rrclass	paraclassrg)	rn
startDocumentcommentprocessingInstructionstartElementr
characters
endElementendDocumentrrDhs   rr
zSAXExerciser.parsesMM		
		+	&1	v~b12			+	&1	sNG[+ABC	V	S	V	

r5cy)zStub method. Does nothing.NrS)rargskwargss   rstubzSAXExerciser.stubsr5N)	rNrOrPrjror
rsetProperty
setFeaturerSr5rrXrXs"* (
KJr5rXceZdZdZdZy)rbzThe same as SAXExerciser, but without the processing instruction and
    comment before the root element, because S2D can"t handle itcx|j}|j|jdti|j	d|jdd|jdtddi|j
d|jd|jd|jy)	Nrrerfr.rrqrrrg)	rnrsrvrrtrurwrxryrzs   rr
zSAX2DOMExerciser.parsesMM		v~b12			+	&1	sNG[+ABC	V	S	V	

r5N)rNrOrPrjr
rSr5rrbrb
s
D
r5rbceZdZdZdZy)r]z1Allows us to drive SAX2DOM from a DOMEventStream.ctj|_|jjtj
jjd|jj|jy)Nr7)	rSAX2DOMr?rxmlsaxrfeature_namespacesrorYs rresetzSAX2DOMTestHelper.reset!sH(swwAA1E%%dll3r5N)rNrOrPrjrrSr5rr]r]s
;4r5r]c eZdZddZdZdZy)SAX2DOMTestCasec(|j||yrm)r#)rtesttestnames   rconfirmzSAX2DOMTestCase.confirm*sh'r5cttjt5}t|tj
j
tt}|D]*\}}|tjk(s|jdk(s*n|jtjddddy#1swYyxYw)z'Ensure SAX2DOM can parse from a stream.rrN)
ioStringIOr!r]rrmake_parserr)rr'r(
assertGreaterr9)rrsdr1r2s     r
test_basiczSAX2DOMTestCase.test_basic-s
[[
&	8#"3(;(;(=#&|#46B
	T'///DLLF4J


s4??3Q7	8	8	8sAB.-B.=(B..B7ctj}|j|jdi|j	d|jdi|j	d|jd|j	d|jd|j
|j}|j}|j\}}}|jd}|j|j|j|j||j|j||j|j||j|j||j|j|j|j|j|j|j|j||j|j||j|j||j|j||j|j||jy)z)Ensure SAX2DOM expands nodes as expected.docrgsubelmrN)rrrsrvrwrxrydocumentdocumentElementr9r>previousSiblingassertIsnextSibling
parentNodeunlink)rsax2domrroottext1elm1text2text3s        rtestSAX2DOMzSAX2DOMTestCase.testSAX2DOM9s//#UB'6"Xr*6"8$6"5!""#e"%//0

e''.

d**E2

d&&.

e++T2%++,%//0%++,

doos+

e&&-

doot,

e&&-

e&&-

r5N)Test)rNrOrPrrrrSr5rrr(s(
8 r5r__main__)rrQxml.saxrxml.sax.xmlreaderrxml.sax.handlerrxml.domrtest.supportrrr!TestCaser
rUobjectrXrbDOMEventStreamr]rrNmainrSr5r<module>rs	,0!:m
4N%h''N%b>4x((>4B6D|"4..41h''1hzHMMOr5