!&sbSSKrSSKrSSKrSSKJr SSKJr SSKJ r SSK J r \ "SSS9r S r "S S \R5r"S S \R5r"SS\5r"SS\5r"SS\ R(5r"SS\R5r\S:Xa\R0"5 gg)N)AttributesImpl)feature_external_gespulldom)findfileztest.xml xmltestdata)subdira  Introduction to XSL

A. Namespace

ct\rSrSrSrSrSr\RS5r \RS5r Sr Sr g ) PullDOMTestCasec*[R"[5nURURR 5 [ U5 [[S5n[ [R"U55 SSS5 g!,(df  g=f)z&Minimal test of DOMEventStream.parse()rbN)rparsetstfile addCleanupstreamcloselistopen)selfhandlerfins 8/opt/alt/python313/lib64/python3.13/test/test_pulldom.py test_parsePullDOMTestCase.test_parsesZ--( ,,- W '4 C s# $! s  B BcV [R"[5n[U5up#UR [ US55 UR [RU5 [U5up#UR [RU5 UR SUR5 UR S[UR55 UR URRS5RS5 [U5up#UR [RU5 [U5up#UR [RU5 [U5up#UR SUR5 Un[U5up#UR [RU5 UR SUR5 [U5up#UR [R U5 UR SUR5 UR XCL5 [U5up#UR [RU5 [U5up#UR [RU5 UR SUR5 [U5up#UR [R U5 UR SUR5 [U5up#UR [RU5 [U5up#UR [RU5 UR S UR5 [U5up#UR [RU5 UR S UR5 [U5up#UR [RU5 [U5up#UR [R U5 UR S UR5 [U5up#UR [R U5 [U5up#UR [RU5 [U5up#UR [R U5 g ) z&Test DOMEventStream parsing semantics. createElementhtmlz xmlns:xdczhttp://www.xml.com/bookstitlezIntroduction to XSLhrpz xdc:authorN)r parseString SMALL_SAMPLEnext assertTruehasattr assertEqualSTART_DOCUMENT START_ELEMENTtagNamelen attributes getNamedItemvalue CHARACTERSdata END_ELEMENT)ritemsevtnode title_nodes rtest_parse_semantics$PullDOMTestCase.test_parse_semantics+so##L1K  o67 //5K  ..4 . C01 55kBHH( *K  ++S1K  ++S1K  $,,/ K  ++S1 . :K  ,,c2 $,,/  *+K  ++S1K  ..4 t||,K  ,,c2 t||,K  ++S1K  ..4 dll+K  ..4 t||4K  ++S1K  ,,c2 t||4K  ,,c2K  ++S1K  ,,c2c[R"[5nUHcup#U[R:XdMURS:XdM-UR U5 UR S[UR55 O URS5 UHup$U[R:XdM O UR SWRS5 UR U5 UR [U5S[R5 [U5up$UR URS5 UR U5 [U5 [U5up$UR URS5 UR[5 [U5 S S S 5 UR5 URUR 5 URUR"5 g !,(df  NU=f) 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.rr"rN)rr#r$r*r+ expandNoder(r, childNodesfailr%r0 assertRaises StopIterationclear assertIsNoneparserr)rr3r4itemr5s rtest_expandItemPullDOMTestCase.test_expandItemisz##L1ICg+++ 0G  &  C$89  IIF GICg+++ t|| K M  eQ););<K  s+  U K  v.   } - K.  %,,' %,,' . -s  G.. G<c[R"[5nUHup#U[R:XdM g UR S5 g)z*PullDOM does not receive "comment" events.zNo comment was encounteredN)rr#r$COMMENTr>)rr3r4_s r test_commentPullDOMTestCase.test_comments>##L1FCgoo% II2 3r9c<[R"[5nUH-up#U[R:XdMURS:XdM- O [ U5up#UR [RU5 g![a URS5 gf=f)z/PullDOM does not receive "end-document" events.rz8Ran out of events, but should have received END_DOCUMENTN) rr#r$r2r+r%r( END_DOCUMENTr@r>)rr3r4r5s rtest_end_document!PullDOMTestCase.test_end_documents##L1ICg)))dllf.D LU IC   W113 7 L IIJ L Ls-A==BBc[R"[5nURnUR [ 5nUR US5 g)NF)rr#r$rC getFeaturerr()rrC saxparsergess rtest_external_ges_default)PullDOMTestCase.test_external_ges_defaults<$$\2MM ""#78 e$r9N) __name__ __module__ __qualname____firstlineno__rr7rEunittestexpectedFailurerJrNrT__static_attributes__rVr9rr r sN% 93|(@44 L L%r9r cR\rSrSrSrSr\RS5rSr S Sjr Sr g) ThoroughTestCasez(Test the hard-to-reach parts of pulldom.c\UR[R"S[5S95 g)z0Test some of the hard-to-reach parts of PullDOM.N)rC)_test_thoroughrr SAXExerciserrs rtest_thorough_parse$ThoroughTestCase.test_thorough_parses GMM$|~FGr9cP[S[5S5nURU5 g)z2SAX2DOM can"t handle a PI before the root element.N )SAX2DOMTestHelperrcrbrpds rtest_sax2dom_fail"ThoroughTestCase.test_sax2dom_fails"t\^R 8 Br9cR[S[5S5nURUS5 g)z0Test some of the hard-to-reach parts of SAX2DOM.NrhF)riSAX2DOMExerciserrbrjs rtest_thorough_sax2dom&ThoroughTestCase.test_thorough_sax2doms$ t%5%7 < B&r9c[U5up4UR[RU5 UR [ US55 U(a[U5up4UR[R U5 URSUR5 [U5up4UR[RU5 URSUR5 URSUR5 [U5up4UR[RU5 URSUR5 [U5up4UR[R U5 URSUR5 [U5up4UR[RU5 URSUR5 URSUR5 [U5up4UR[RU5 URSUR5 [U5up4UR[RU5 URSUR5 [U5up4UR[RU5 URSUR5 [U5up4UR[RU5 URSUR5 [U5up4UR[RU5 g) zHTest some of the hard-to-reach parts of the parser, using a mock parser.r a commenttargetr1rr"textN)r%r(rr)r&r'rHr1PROCESSING_INSTRUCTIONrtr*r+r0r2rM)rrk before_rootr4r5s rrbThoroughTestCase._test_thoroughs]H  //5 o67 RIC   W__c 2   [$)) 4RIC   W;;S A   Xt{{ 3   VTYY /H  ..4 .H  #. dii0H  77= 4;;/ +H  ..4 dll+H  ++S1 +H  ,,c2 dll+H  ,,c2 .H  --s3r9rVN)T) rWrXrYrZ__doc__rer[r\rlrprbr]rVr9rr_r_s/2H  ' ,4r9r_c2\rSrSrSrSrSrSr\r\r Sr g)rczjA fake sax parser that calls some of the harder-to-reach sax methods to ensure it emits the correct eventscXlgN_handler)rrs rsetContentHandlerSAXExerciser.setContentHandlers r9cURnUR5 URS5 URSS5 UR S[ 055 URS5 URSS5 UR S[ SS055 UR S5 URS5 URS5 UR5 g) Nrsrtr1rr"class paraclassru) r startDocumentcommentprocessingInstruction startElementr characters endElement endDocumentrrIhs rrSAXExerciser.parses MM  + &1 v~b12 + &1 sNG[+ABC V S V r9cg)zStub method. Does nothing.NrV)rargskwargss rstubSAXExerciser.stubs r9r~N) rWrXrYrZryrrr setProperty setFeaturer]rVr9rrcrcs"* ( KJr9rcc\rSrSrSrSrSrg)roi zThe same as SAXExerciser, but without the processing instruction and comment before the root element, because S2D can"t handle itcxURnUR5 URS[055 UR S5 UR SS5 URS[SS055 UR S5 URS5 URS5 UR5 g) Nrrsrtr1r"rrru) rrrrrrrrrrs rrSAX2DOMExerciser.parses MM  v~b12 + &1 sNG[+ABC V S V r9rVN)rWrXrYrZryrr]rVr9rroro s D r9roc\rSrSrSrSrSrg)riiz1Allows us to drive SAX2DOM from a DOMEventStream.c[R"5UlURR[R R RS5 URRUR5 g)Nr;) rSAX2DOMrCrxmlsaxrfeature_namespacesrrds rresetSAX2DOMTestHelper.reset!sH(  swwAA1E %%dll3r9rN)rWrXrYrZryrr]rVr9rriris ;4r9ric*\rSrSrSSjrSrSrSrg)SAX2DOMTestCasei(c&URX5 gr})r&)rtesttestnames rconfirmSAX2DOMTestCase.confirm*s 'r9c[R"[5n[U[R R 5[[55nUH-up4U[R:XdMURS:XdM- O UR[WR5S5 SSS5 g!,(df  g=f)z'Ensure SAX2DOM can parse from a stream.rrN) ioStringIOr$rirr make_parserr,rr*r+ assertGreaterr=)rrsdr4r5s r test_basicSAX2DOMTestCase.test_basic-s [[ &#"3(;(;(=#&|#46B '///DLLF4J   s4??3Q 7' & &sAB3/B3)B33 Cc[R"5nUR5 URS05 UR S5 URS05 UR S5 UR S5 UR S5 UR S5 UR 5 URnURnURupEnURSnURUR5 URURU5 URURU5 URURU5 URURU5 URUR5 URUR5 URUR5 URURU5 URURU5 URURU5 URURU5 URURU5 UR5 g)z)Ensure SAX2DOM expands nodes as expected.docrusubelmrN)rrrrrrrdocumentdocumentElementr=rBpreviousSiblingassertIs nextSibling parentNodeunlink)rsax2domrroottext1elm1text2text3s r testSAX2DOMSAX2DOMTestCase.testSAX2DOM9s//#UB'6"Xr*6"8$6"5!""#e" %//0 e''. d**E2 d&&. e++T2 %++, %//0 %++, doos+ e&&- doot, e&&- e&&- r9rVN)Test)rWrXrYrZrrrr]rVr9rrr(s( 8 r9r__main__)rr[xml.saxrxml.sax.xmlreaderrxml.sax.handlerrxml.domr test.supportrrr$TestCaser r_objectrcroDOMEventStreamrirrWmainrVr9rrs ,0! :m 4 N%h''N%b>4x((>4B6D|"4..41h''1h z MMOr9