m *Ec @sMdkZdklZdklZdklZdklZdklZdklZdk Z dk Z dk Z dk Z dk lZdklZe iieid Ze iied Zd d d ddddddg ZdZde ifdYZde ifdYZdZdZedjo endS(N(sST(s DocumentClass(sClassicDocumentClass(sStructuredText(s HTMLClass(sHTML(s UnicodeType(sndiffit regressionss index.stxsAcquisition.stxsExtensionClass.stxsMultiMapping.stxs examples.stxs Links.stxs examples1.stxs table.stxsInnerLinks.stxcCsAttii||d}|i}|i di|S(Ntrt( topentostpathtjointdirnametfnametmyfilet readlinestlinestclose(RRR R ((tF/data/zmath/zope/lib/python/StructuredText/tests/testStructuredText.pytreadFile(s  tStructuredTextTestscBsPtZdZdZdZdZdZdZdZdZ RS( NcCstiiidS(N(tzopet deprecationt__show__toff(tself((R tsetUp2scCstiiidS(N(RRRton(R((R ttearDown5scCsfx_tD]W}tt|}ti|ptd|tit|ptd|qWdS(s testing StructuredText sStructuredText failed on %ss#StructuredText failed on Unicode %sN(tfilestfRRtraw_texttStructuredTexttAssertionErrortunicode(RRR((R ttestStructuredText8s cCsfx_tD]W}tt|}ti|ptd|tit|ptd|qWdS(s testing StructuredTextNG sStructuredText failed on %ss#StructuredText failed on Unicode %sN( RRRRRtSTRRR(RRR((R ttestStructuredTextNGBs cCsZxStD]K}ti}tt|}ti|}||pt d|qWdS(s testing DocumentClasssDocumentClass failed on %sN( RRt DocumentClasstDocRRRRRttextR(RRR"R#R((R ttestDocumentClassMs cCsZxStD]K}ti}tt|}ti |}||pt d|qWdS(s testing ClassicDocumentClasss!ClassicDocumentClass failed on %sN( RRtClassicDocumentClassR!R"RRRRRR#R(RRR"R#R((R ttestClassicDocumentClassWs cCslxetD]]}ti}ti}tt|}|t i |}||pt d|qWdS(s" testing HTML ClassicDocumentClasss&HTML ClassicDocumentClass failed on %sN(RRR%R!R"t HTMLClasstHTMLRRRRRR#R(RRRR"R(R#((R ttestClassicHTMLDocumentClassas  c Cs%xtD]} ti}ti}tt| } |t i | }||}| i dd}tt|}|i|ijoti}ti}|t_zFtddi|titiit|dtidWd|t_Xtd| |i fqqWdS(s HTML regression test s.stxs.reft_tmpouttwNs+HTML regression test failed on %s Diff: %s (!RRR!R"R'R(RRRRRR#thtmltreplacet reg_fnametreg_htmltstript cStringIOtStringIOtIOtsyststdoutt oldStdoutRtwritetndifftfcompareRRRtunlinkRtgetvalue( RR#R/R.R6R,R(R"R3RR((R ttestRegressionsTestsms,       ( t__name__t __module__RRRR R$R&R)R<(((R R0s   t BasicTestscBstZdZdZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZRS(NcCstiiidS(N(RRRR(R((R RscCstiiidS(N(RRRR(R((R RscCst|tpUt|dddd}||jo,dG|GHdG|GHdG|GHtd|qent|to |}n t|}t|dddd}||joGdG|i d GHdG|i d GHdG|i d GHtd |ndS( Ntlevelitheaderis Text: s Converted:s Expected: sbasic test failed for '%s'slatin-1s"basic test failed for Unicode '%s'( t isinstancetstxtxtt UnicodeTypeR(trestexpectedRtustxtxtRtencode(RRCRFRGRE((R t_tests        cCs|idddS(Nsxx _this is html_ xxsxx this is html xx(RRI(R((R t testUnderlines cCs|idddS(Nsxx _this is html_sthis is html(RRI(R((R ttestUnderline1s cCs|idddS(Nsxx *this is html* xxsxx this is html xx(RRI(R((R t testEmphasiss cCs|idddS(Nsxx **this is html** xxs#xx this is html xx(RRI(R((R t testStrongs cCs|idddS(Ns#index_html(RRI(R((R ttestUnderlineThroughoutTagss cCs|idddS(Nsdef __init__(self)(RRI(R((R ttestUnderscoresInLiteral1s cCs|idddS(Nsthis is '__a_literal__' ehs__a_literal__(RRI(R((R ttestUnderscoresInLiteral2s cCs|idddS(Ns/Zopes structured_text is sometimes a night_mare(RRI(R((R ttestUnderlinesWithoutWithspacess cCs|idddS(Nsthis is a '*literal*' ehs*literal*(RRI(R((R ttestAsterisksInLiterals cCs|idddS(Nsthis is a '**literal**' ehs**literal**(RRI(R((R ttestDoubleAsterisksInLiterals cCs|idddS(Ns.this is a '"literal":http://www.zope.org/.' ehs,"literal":http://www.zope.org/.(RRI(R((R ttestLinkInLiterals cCsd|idd|idd|idd|idd|id d |id d dS( Ns!"foo":http://www.zope.org/foo/bars4

foo

s&"foo":http://www.zope.org/foo/bar/%20xs9

foo

s/"foo":http://www.zope.org/foo/bar?arg1=1&arg2=2sB

foo

s%"foo bar":http://www.zope.org/foo/bars8

foo bar

s."[link goes here]":http://www.zope.org/foo/barsA

[link goes here]

s)"[Dad's car]":http://www.zope.org/foo/bars<

[Dad's car]

(RRI(R((R ttestLinks      cCst|idd|idd|idd|idd|id d |id d |id ddS(Ns%"foo":img:http://www.zope.org/bar.gifs3foos*"foo":img:http://www.zope.org:8080/bar.gifs8foos0"foo":img:http://www.zope.org:8080/foo/bar?arg=1s>foos3"foo":img:http://www.zope.org:8080/foo/b%20ar?arg=1sAfoos."foo bar":img:http://www.zope.org:8080/foo/bars<foo bars7"[link goes here]":img:http://www.zope.org:8080/foo/barsE[link goes here]s6"[Dad's new car]":img:http://www.zope.org:8080/foo/barsD[Dad's new car](RRI(R((R t testImgLinks       cCsdS(N((R((R tXXXtestUnicodeContents(R=R>RRRIRJRKRLRMRNRORPRQRRRSRTRURVRW(((R R?s"                cCs<ti}|itit|itit|S(N(tunittestt TestSuitetsuitetaddTestt makeSuiteRR?(RZ((R t test_suite s cCstiitdS(N(RXtTextTestRunnertrunR](((R tmainst__main__(tzope.deprecationRRRR!R%R'tStructuredText.StructuredTextR(R4RRXR1ttypesRDtOFSR8Rtsplitt__file__t package_dirRRRRtTestCaseRR?R]R`R=(R1RXR8R%RhRR!RRR(R?RR`RR4R'RRDR]RR((R t?s(       $  ! ^~