python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_pulldom.cpython-311.pyc

eT1jddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZeddZd	Z
Gd
dejZGdd
ejZGddeZGddeZGdde	jZGddejZedkrejdSdS)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>cfeZdZdZdZdZejdZejdZ	dZ
dS)PullDOMTestCasec2tjt}||jjt
|ttd5}t
tj|ddddS#1swxYwYdS)z&Minimal test of DOMEventStream.parse()rbN)rparsetstfile
addCleanupstreamcloselistopen)selfhandlerfins   E/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_pulldom.py
test_parsezPullDOMTestCase.test_parses-((,---W


'4
 
 	%Cs##$$$	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%s"BBBc
tjt}t|\}}|t|d|tj|t|\}}|tj||d|j	|dt|j||jdj
dt|\}}|tj|t|\}}|tj|t|\}}|d|j	|}t|\}}|tj||d|jt|\}}|tj||d|j	|||ut|\}}|tj|t|\}}|tj||d|j	t|\}}|tj||d|j	t|\}}|tj|t|\}}|tj||d	|j	t|\}}|tj||d
|j	t|\}}|tj|t|\}}|tj||d
|j	t|\}}|tj|t|\}}|tj|t|\}}|tj|dS)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+s4#L11KK	To66777/555KK	T.444...C0011155kBBH(	*	*	*KK	T+S111KK	T	
+S111KK	T$,///
KK	T+S111.	:::KK	T,c222$,///
d*+++KK	T+S111KK	T.444t|,,,KK	T,c222t|,,,KK	T+S111KK	T.444dl+++KK	T.444t|444KK	T+S111KK	T,c222t|444KK	T,c222KK	T+S111KK	T,c22222c0tjt}|D]_\}}|tjkrJ|jdkr?|||dt|jn`|	d|D]\}}|tjkrn|d|jd|||t|dtjt|\}}||jd||t|t|\}}||jd|t5t|d	d	d	n#1swxYwY|||j||jd	S)
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_expandItemis6#L11	H	HICg+++0G0G  &&&  C$8$8999IIFGGG		ICg+++,t|K	M	M	M	eQ);<<<KK	Ts+++
UKK	Tv...


}
-
-		KKK															



%,'''%,'''''s'GG
Gctjt}|D]\}}|tjkrdS|ddS)z*PullDOM does not receive "comment" events.zNo comment was encounteredN)rr r!COMMENTr:)rr0r1_s    rtest_commentzPullDOMTestCase.test_comments[#L11	4	4FCgo%%&
II233333r5c4tjt}|D]"\}}|tjkr
|jdkrn#	t|\}}|tj|dS#t$r|	dYdSwxYw)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#L11		ICg)))dlf.D.D	LUICW1377777	L	L	LIIJ
L
L
L
L
L
L	Ls2A44BBctjt}|j}|t
}||ddS)NF)rr r!r?
getFeaturerr%)rr?	saxparsergess    rtest_external_ges_defaultz)PullDOMTestCase.test_external_ges_defaultsI$\22M	""#788e$$$$$r5N)__name__
__module____qualname__rr4rAunittestexpectedFailurerErHrMr5rr
r
s%%% 939393|(((@444
L
L
L%%%%%r5r
cFeZdZdZdZejdZdZddZ	dS)	ThoroughTestCasez(Test the hard-to-reach parts of pulldom.cp|tjdtdS)z0Test some of the hard-to-reach parts of PullDOM.N)r?)_test_thoroughrr
SAXExerciserrs rtest_thorough_parsez$ThoroughTestCase.test_thorough_parses/GM$|~~FFFGGGGGr5cjtdtd}||dS)z2SAX2DOM can"t handle a PI before the root element.N)SAX2DOMTestHelperrXrWrpds  rtest_sax2dom_failz"ThoroughTestCase.test_sax2dom_fails3t\^^R
8
8Br5cltdtd}||ddS)z0Test some of the hard-to-reach parts of SAX2DOM.Nr\F)r]SAX2DOMExerciserrWr^s  rtest_thorough_sax2domz&ThoroughTestCase.test_thorough_sax2doms6
t%5%7%7
<
<B&&&&&r5Tct|\}}|tj||t|d|rt|\}}|tj||d|jt|\}}|tj||d|j	|d|jt|\}}|tj
||d|jt|\}}|tj||d|jt|\}}|tj||d|j	|d|jt|\}}|tj
||d|jt|\}}|tj||d|jt|\}}|tj
||d|jt|\}}|tj
||d|jt|\}}|tj|dS)	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_thoroughsHH	T/555o66777	0RICW_c222[$)444RICW;SAAAXt{333VTY///HH	T.444...HH	T#...di000HH	T7===4;///+++HH	T.444dl+++HH	T+S111+++HH	T,c222dl+++HH	T,c222...HH	T-s33333r5N)T)
rNrOrP__doc__rZrQrRr`rcrWrSr5rrUrUsn22HHH   
'''
,4,4,4,4,4,4r5rUc,eZdZdZdZdZdZeZeZdS)rXznA fake sax parser that calls some of the harder-to-reach sax methods to
    ensure it emits the correct eventsc||_dSN)_handler)rrs  rsetContentHandlerzSAXExerciser.setContentHandlers



r5c|j}||d|dd|dti|d|dd|dtddi|d|d|d|dS)	Nrerfr.rrclass	paraclassrg)	rn
startDocumentcommentprocessingInstructionstartElementr
characters
endElementendDocumentrrDhs   rr
zSAXExerciser.parsesM		
		+	&111	v~b11222			+	&111	sNG[+ABBCCC	V	S	V	

r5cdS)zStub method. Does nothing.NrS)rargskwargss   rstubzSAXExerciser.stubsr5N)	rNrOrPrjror
rsetProperty
setFeaturerSr5rrXrXsQ**   (


KJJJr5rXceZdZdZdZdS)rbzThe same as SAXExerciser, but without the processing instruction and
    comment before the root element, because S2D can"t handle itc|j}||dti|d|dd|dtddi|d|d|d|dS)	Nrrerfr.rrqrrrg)	rnrsrvrrtrurwrxryrzs   rr
zSAX2DOMExerciser.parsesM		v~b11222			+	&111	sNG[+ABBCCC	V	S	V	

r5N)rNrOrPrjr
rSr5rrbrb
s/DD




r5rbceZdZdZdZdS)r]z1Allows us to drive SAX2DOM from a DOMEventStream.ctj|_|jtjjjd|j|jdS)Nr7)	rSAX2DOMr?rxmlsaxrfeature_namespacesrorYs rresetzSAX2DOMTestHelper.reset!sN((swA1EEE%%dl33333r5N)rNrOrPrjrrSr5rr]r]s);;44444r5r]c"eZdZddZdZdZdS)SAX2DOMTestCaseTestc2|||dSrm)r#)rtesttestnames   rconfirmzSAX2DOMTestCase.confirm*sh'''''r5ctjt5}t|tjtt}|D]"\}}|tj	kr
|j
dkrn#|t|jdddddS#1swxYwYdS)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(;(;(=(=#&|#4#466B

	T'///DLF4J4JE
s4?33Q777	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8	8sB
B44B8;B8ctj}||di|d|di|d|d|d|d||j}|j}|j	\}}}|j	d}|
|j||j
|||j|||j
|||j||
|j
|
|j|
|j
||j|||j|||j|||j|||j||dS)z)Ensure SAX2DOM expands nodes as expected.docrgsubelmrN)rrrsrvrwrxrydocumentdocumentElementr9r>previousSiblingassertIsnextSibling
parentNodeunlink)rsax2domrroottext1elm1text2text3s        rtestSAX2DOMzSAX2DOMTestCase.testSAX2DOM9s'/##UB'''6"""Xr***6"""8$$$6"""5!!!"#e"%/000

e'...

d*E222

d&...

e+T222%+,,,%/000%+,,,

dos+++

e&---

dot,,,

e&---

e&---

r5N)r)rNrOrPrrrrSr5rrr(sF((((
8
8
8     r5r__main__)rrQxml.saxrxml.sax.xmlreaderrxml.sax.handlerrxml.domrtest.supportrrr!TestCaser
rUobjectrXrbDOMEventStreamr]rrNmainrSr5r<module>rs				,,,,,,000000!!!!!!(:m
4
4
4N%N%N%N%N%h'N%N%N%b>4>4>4>4>4x(>4>4>4B6D|"44444.44411111h'111hzHMOOOOOr5