+
    BiH1                     n   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ]! RRR7      tR	t ! R
 R]P                  4      t ! R R]P                  4      t ! R R]4      t ! R R]4      t ! R R]	P(                  4      t ! R R]P                  4      t]R8X  d   ]P0                  ! 4        R# R# )    N)AttributesImpl)feature_external_gespulldom)findfileztest.xmlxmltestdata)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>c                      a  ] tR t^t o R tR tR t]P                  R 4       t	]P                  R 4       t
R tRtV tR# )	PullDOMTestCasec                B   \         P                  ! \        4      pV P                  VP                  P
                  4       \        V4       \        \        R4      ;_uu_ 4       p\        \         P                  ! V4      4       RRR4       R#   + '       g   i     R# ; i)z&Minimal test of DOMEventStream.parse()rbN)r   parsetstfile
addCleanupstreamcloselistopen)selfhandlerfins   &  (/usr/lib/python3.14/test/test_pulldom.py
test_parsePullDOMTestCase.test_parse   s`     --(,,-W '4  Cs#$ !   s   # BB	c                F	   \         P                  ! \        4      p\        V4      w  r#V P	                  VR4       V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       V P                  ^\        VP                  4      4       V P                  VP                  P                  R4      P                  R4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  RVP                  4       Tp\        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       \        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       V P!                  WCJ 4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       \        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       V P                  RVP                  4       \        V4      w  r#V P                  \         P                  V4       V P                  R	VP                  4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       V P                  R	VP                  4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       \        V4      w  r#V P                  \         P                  V4       R
# )z&Test DOMEventStream parsing semantics.createElementhtmlz	xmlns:xdczhttp://www.xml.com/bookstitlezIntroduction to XSLhrpz
xdc:authorN)r   parseStringSMALL_SAMPLEnextassertHasAttrassertEqualSTART_DOCUMENTSTART_ELEMENTtagNamelen
attributesgetNamedItemvalue
CHARACTERSdataEND_ELEMENT
assertTrue)r   itemsevtnode
title_nodes   &    r   test_parse_semantics$PullDOMTestCase.test_parse_semantics+   sl    ##L1K	41//5K	..4.C0155kBHH(	*K	++S1K	 	++S1K	$,,/
K	++S1.		:K	,,c2$,,/
*+K	++S1K	..4t||,K	,,c2t||,K	++S1K	..4dll+K	..4t||4K	++S1K	,,c2t||4K	,,c2K	++S1K	,,c2    c                "   \         P                  ! \        4      pV Fe  w  r#V\         P                  8X  g   K  VP                  R8X  g   K/  VP                  V4       V P                  ^\        VP                  4      4        M	  V P                  R4       V F  w  r$V\         P                  8X  g   K   M	  V P                  RXP                  R4       VP                  V4       V P                  \        V4      ^ ,          \         P                  4       \        V4      w  r$V P                  VP                  R4       VP                  V4       \        V4       \        V4      w  r$V P                  VP                  R4       V P                  \        4      ;_uu_ 4        \        V4       RRR4       VP                  4        V P                  VP                   4       V P                  VP"                  4       R#   + '       g   i     LX; i)z$Ensure expandItem works as expected.r   z,No "title" element detected in SMALL_SAMPLE!r   z=expandNode did not leave DOMEventStream in the correct state.r    r   N)r   r!   r"   r'   r(   
expandNoder%   r)   
childNodesfailr#   r-   assertRaisesStopIterationclearassertIsNoneparserr   )r   r1   r2   itemr3   s   &    r   test_expandItemPullDOMTestCase.test_expandItemi   s}   ##L1ICg+++0G  &  C$89	  IIFGICg+++  	t||K	M 	eQ););<K	s+UK	v.}--K .%,,'%,,'	 .-s   "G>>H	c                    \         P                  ! \        4      pV F  w  r#V\         P                  8X  g   K   R# 	  V P	                  R4       R# )z*PullDOM does not receive "comment" events.zNo comment was encounteredN)r   r!   r"   COMMENTr;   )r   r1   r2   _s   &   r   test_commentPullDOMTestCase.test_comment   s>     ##L1FCgoo%  II23r7   c                F   \         P                  ! \        4      pV F/  w  r#V\         P                  8X  g   K  VP                  R8X  g   K/   M	   \        V4      w  r#V P                  \         P                  V4       R#   \         d    T P                  R4        R# i ; i)z/PullDOM does not receive "end-document" events.r   z8Ran out of events, but should have received END_DOCUMENTN)
r   r!   r"   r/   r(   r#   r%   END_DOCUMENTr=   r;   )r   r1   r2   r3   s   &   r   test_end_document!PullDOMTestCase.test_end_document   s     ##L1ICg)))dllf.D 	LUICW1137 	LIIJL	Ls   -B   B B c                    \         P                  ! \        4      pVP                  pVP	                  \
        4      pV P                  VR 4       R# )FN)r   r!   r"   r@   
getFeaturer   r%   )r   r@   	saxparsergess   &   r   test_external_ges_default)PullDOMTestCase.test_external_ges_default   s<    $$\2MM	""#78e$r7    N)__name__
__module____qualname____firstlineno__r   r5   rB   unittestexpectedFailurerG   rK   rQ   __static_attributes____classdictcell____classdict__s   @r   r   r      sV     % 93|(@ 4 4 L L% %r7   r   c                   ^   a  ] tR t^t o RtR t]P                  R 4       tR t	RR lt
RtV tR# )	ThoroughTestCasez(Test the hard-to-reach parts of pulldom.c                d    V P                  \        P                  ! R\        4       R7      4       R# )z0Test some of the hard-to-reach parts of PullDOM.N)r@   )_test_thoroughr   r   SAXExerciserr   s   &r   test_thorough_parse$ThoroughTestCase.test_thorough_parse   s    GMM$|~FGr7   c                R    \        R\        4       ^4      pV P                  V4       R# )z2SAX2DOM can"t handle a PI before the root element.N)SAX2DOMTestHelperrb   ra   r   pds   & r   test_sax2dom_fail"ThoroughTestCase.test_sax2dom_fail   s"     t\^R8Br7   c                T    \        R\        4       ^4      pV P                  VR4       R# )z0Test some of the hard-to-reach parts of SAX2DOM.NF)rg   SAX2DOMExerciserra   rh   s   & r   test_thorough_sax2dom&ThoroughTestCase.test_thorough_sax2dom   s$    t%5%7<B&r7   c                   \        V4      w  r4V P                  \        P                  V4       V P	                  VR4       V'       d   \        V4      w  r4V P                  \        P
                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P
                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       V P                  RVP                  4       \        V4      w  r4V P                  \        P                  V4       R# )	zHTest some of the hard-to-reach parts of the parser, using a mock
parser.r   	a commenttargetr.   r   r    textN)r#   r%   r   r&   r$   rE   r.   PROCESSING_INSTRUCTIONrr   r'   r(   r-   r/   rJ   )r   ri   before_rootr2   r3   s   &&&  r   ra   ThoroughTestCase._test_thorough   sZ    H	//541RICW__c2[$))4RICW;;SAXt{{3VTYY/H	..4.H	#.dii0H	77=4;;/+H	..4dll+H	++S1+H	,,c2dll+H	,,c2.H	--s3r7   rS   N)T)rT   rU   rV   rW   __doc__rd   rX   rY   rj   rn   ra   rZ   r[   r\   s   @r   r_   r_      s7     2H    
'
,4 ,4r7   r_   c                   >   a  ] tR t^t o RtR tR tR t]t]t	Rt
V tR# )rb   zjA fake sax parser that calls some of the harder-to-reach sax methods to
ensure it emits the correct eventsc                    Wn         R # N_handler)r   r   s   &&r   setContentHandlerSAXExerciser.setContentHandler   s    r7   c                   V P                   pVP                  4        VP                  R 4       VP                  RR4       VP	                  R\        / 4      4       VP                  R 4       VP                  RR4       VP	                  R\        RR/4      4       VP                  R4       VP                  R4       VP                  R4       VP                  4        R# )	rq   rr   r.   r   r    class	paraclassrs   N)	r|   startDocumentcommentprocessingInstructionstartElementr   
characters
endElementendDocumentr   rF   hs   && r   r   SAXExerciser.parse   s    MM	 	
		+	&1	v~b12			+	&1	sNG[+ABC	V	S	V	r7   c                    R# )zStub method. Does nothing.NrS   )r   argskwargss   &*,r   stubSAXExerciser.stub  s    r7   r{   N)rT   rU   rV   rW   rw   r}   r   r   setProperty
setFeaturerZ   r[   r\   s   @r   rb   rb      s%     * ( KJr7   rb   c                   *   a  ] tR tRt o RtR tRtV tR# )rm   i  zThe same as SAXExerciser, but without the processing instruction and
comment before the root element, because S2D can"t handle itc                z   V P                   pVP                  4        VP                  R \        / 4      4       VP	                  R4       VP                  RR4       VP                  R\        RR/4      4       VP                  R4       VP                  R4       VP                  R 4       VP                  4        R# )	r   rq   rr   r.   r    r   r   rs   N)	r|   r   r   r   r   r   r   r   r   r   s   && r   r   SAX2DOMExerciser.parse  s    MM		v~b12			+	&1	sNG[+ABC	V	S	V	r7   rS   N)rT   rU   rV   rW   rw   r   rZ   r[   r\   s   @r   rm   rm     s     D
 
r7   rm   c                   *   a  ] tR tRt o RtR tRtV tR# )rg   i  z1Allows us to drive SAX2DOM from a DOMEventStream.c                    \         P                  ! 4       V n         V P                  P                  \        P
                  P                  P                  ^4       V P                  P                  V P                   4       R# )   N)	r   SAX2DOMr@   r   xmlsaxr   feature_namespacesr}   rc   s   &r   resetSAX2DOMTestHelper.reset!  sH    (swwAA1E%%dll3r7   r   N)rT   rU   rV   rW   rw   r   rZ   r[   r\   s   @r   rg   rg     s     ;4 4r7   rg   c                   6   a  ] tR tRt o RR ltR tR tRtV tR# )SAX2DOMTestCasei(  c                (    V P                  W4       R # rz   )r0   )r   testtestnames   &&&r   confirmSAX2DOMTestCase.confirm*  s    'r7   c           	        \         P                  ! \        4      ;_uu_ 4       p\        V\        P
                  P                  4       \        \        4      4      pV F/  w  r4V\        P                  8X  g   K  VP                  R8X  g   K/   M	  V P                  \        XP                  4      ^ 4       RRR4       R#   + '       g   i     R# ; i)z'Ensure SAX2DOM can parse from a stream.r   N)ioStringIOr"   rg   r   r   make_parserr)   r   r'   r(   assertGreaterr:   )r   r   sdr2   r3   s   &    r   
test_basicSAX2DOMTestCase.test_basic-  s    [[&&#"3(;(;(=#&|#46B	'///DLLF4J  
 s4??3Q7 '&&&s   AB>8B>)B>>C	c                   \         P                  ! 4       pVP                  4        VP                  R/ 4       VP	                  R4       VP                  R/ 4       VP	                  R4       VP                  R4       VP	                  R4       VP                  R4       VP                  4        VP                  pVP                  pVP                  w  rEpVP                  ^ ,          pV P                  VP                  4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  4       V P                  VP                  4       V P                  VP                  4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       VP                  4        R# )z)Ensure SAX2DOM expands nodes as expected.docrs   subelmN)r   r   r   r   r   r   r   documentdocumentElementr:   r?   previousSiblingassertIsnextSibling
parentNodeunlink)r   sax2domr   roottext1elm1text2text3s   &       r   testSAX2DOMSAX2DOMTestCase.testSAX2DOM9  s   //#UB'6"Xr*6"8$6"5!""#e"%//0e''.d**E2d&&.e++T2%++,%//0%++,doos+e&&-doot,e&&-e&&-

r7   rS   N)Test)	rT   rU   rV   rW   r   r   r   rZ   r[   r\   s   @r   r   r   (  s     (
8   r7   r   __main__)r   rX   xml.saxr   xml.sax.xmlreaderr   xml.sax.handlerr   xml.domr   test.supportr   r   r"   TestCaser   r_   objectrb   rm   DOMEventStreamrg   r   rT   mainrS   r7   r   <module>r      s    	   , 0  ! :m
4N%h'' N%b>4x(( >4B6 D| "4.. 41h'' 1h zMMO r7   