mò Cã¸Ec@s+dZdkZdkZdkZdkZdkZdklZdkZdk Zdk Zdk l Z l Z y eZWn ej oeidZnXeiieƒZeiieiieƒdƒZde fd„ƒYZdeifd „ƒYZd „Zed joeid d ƒndS(s5Tests of ZConfig.loader classes and helper functions.N(sStringIO(s CONFIG_BASEsTestBaseitlibrarytLoaderTestCasecBstZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z d „Zd„Zd„ZRS(NcCsYtiiƒ}tiitdƒ}|i|ƒ}|i|ƒ}|i ||jƒdS(Ns simple.xml( tZConfigtloadert SchemaLoaderturlturljoint CONFIG_BASEtloadURLtschema1tschema2tselftassert_(R RRR R ((t8/data/zmath/zope/lib/python/ZConfig/tests/test_loader.pyttest_schema_caching*s cCstiiƒ}tiitdƒ}|i|ƒ}t dƒ}tiitdƒ}|i ||ƒ}|i|idƒ|idƒjƒdS(Ns library.xmlsW
tstringiostype-a(RRRRRRturl1RR tStringIOtsioturl2tloadFileR R R tgettype(R RRRRR R ((R ttest_simple_import_with_cache1s cCs|idƒdS(Ns (R tload_schema_text(R ((R ttest_simple_import_using_prefix=scCsì|itititdƒƒ|itititdƒƒ|itititdƒƒtdƒ}yti|ƒWn^tij oO}|i |i dƒ|i |i dƒ|i |i djƒt|ƒnX|idƒdS(NssI sH s@ s component.xmlsZConfig.tests.test_loadersexpected SchemaResourceError(R t assertRaisesRt SchemaErrortloadSchemaFileRRtSchemaResourceErrortet assertEqualtfilenametpackageR tpathtNonetstrtfail(R RR((R ttest_import_errorsDs    cCsJtiiƒ}tdƒ}|i|ƒ}|i|i dƒdj ƒdS(NsC swidget-a( RRRRRRtschemaR R RR"(R RRR&((R ttest_import_from_packagebs cCsJtiiƒ}tdƒ}|i|ƒ}|i|i dƒdj ƒdS(Ns^ s extra-type( RRRRRRR&R R RR"(R RRR&((R t"test_import_from_package_with_filejs cCsJtiiƒ}tdƒ}|i|ƒ}|i|i dƒdj ƒdS(Ns^ s extra-thing( RRRRRRR&R R RR"(R RRR&((R t(test_import_from_package_extra_directoryss cCs˜tiiƒ}tdƒ}y|i|ƒWnXtij oI}|i |i dƒ|i |i dƒ|i |i ƒt|ƒnX|idƒdS(Nsa s notthere.xmlsZConfig.tests.library.widgetsexpected SchemaResourceError(RRRRRRRRR RRR R R!R#R$(R RRR((R t*test_import_from_package_with_missing_file|s cCs8tiiƒ}tdƒ}|iti|i|ƒdS(Nsh ( RRRRRR RRR(R RR((R t,test_import_from_package_with_directory_files cCsHtiiƒ}tdƒ}|i|ƒ}|idƒ|idƒdS(Ns‘ swidget-as extra-type(RRRRRRR&R(R RRR&((R t&test_import_two_components_one_package•s   cCs;tiiƒ}tdƒ}|i|ƒ}|idƒdS(Nsw swidget-a(RRRRRRR&R(R RRR&((R ttest_import_component_twice_1 s cCsYtiiƒ}tdƒ}|i|ƒ}tii|ƒ}tdƒ}|i|ƒdS(NsD s$%import ZConfig.tests.library.widget(RRRRRRR&t ConfigLoader(R RRR&((R ttest_import_component_twice_2­s   c Csžx—dddfdddfdddfd ddfdddfgD]S\}}}tii|ƒ}|i||ƒtii|ƒ}|i||ƒqCWdS(Nshttp://www.python.orgthttpswww.python.orgtshttp://www.python.org#abctabcshttp://www.python.org/#abct/shttp://a/b/c/d;p?q#ftas/b/c/dtptqtfs/b/c/d;psfile:///tmp/junk.txttfiles /tmp/junk.txt(R0swww.python.orgR1R1R1R1(R0swww.python.orgR1R1R1(R0swww.python.orgR1R1R1sabc(R0swww.python.orgR1R1sabc(R0swww.python.orgR3R1R1sabc(R0swww.python.orgR3R1sabc(R0R4s/b/c/dR5R6R7(R0R4s/b/c/d;pR6R7(sfileR1s /tmp/junk.txtR1R1R1(sfileR1s /tmp/junk.txtR1R1( RtparsedtsplitRturlsplittresultR Rt urlunsplittresult2(R RR>R<R9R:((R ttest_urlsplit_urlunsplit¹s CcCsw|itiidƒdƒ|itiid ƒdƒ|itiiddƒdƒ|itiidƒd ƒdS( Ns file:/abc/defsfile:///abc/defR8R1s/abc/defs file:/abc/tdefsfile:/abc/def#fragtfrag(sfileR1s/abc/defR1R1(sfile:///abc/defRA(R RRRt urlnormalizeR=Rt urldefrag(R ((R ttest_file_url_normalizationÑscCsÓ|i}tiiƒi}||dƒƒ||dƒƒ||dƒƒ||dƒƒ||dƒƒ||dƒƒ||dƒƒ||dƒ ƒ||d ƒ ƒ||d ƒ ƒ||d ƒ ƒdS( NR2sabc/defs/abcs/abc/defs\abcs\abc\defs c:\abc\defshttp://www.example.com/s"http://www.example.com/sample.confsfile:///etc/zope/zope.confsfile:///c|/foo/bar.conf(R R RRt BaseLoadertisPath(R RFR ((R t test_isPathßs (t__name__t __module__RRRR%R'R(R)R*R+R,R-R/R?RDRG(((R R(s        tTestNonExistentResourcescBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsti|_|it_dS(N(turllib2turlopenR turllib2_urlopent fake_urlopen(R ((R tsetUpûs cCs|it_dS(N(R RMRKRL(R ((R ttearDownÿscCs|iƒ‚dS(N(R terror(R R((R RNscCst|_|iƒdS(N(tIOErrorR RQtcheck_nonexistent_file(R ((R ttest_nonexistent_file_ioerrors cCst|_|iƒdS(N(tOSErrorR RQRS(R ((R ttest_nonexistent_file_oserror s cCsµtiƒ}titdƒƒ}|iti ti |ƒ|iti ti ||ƒ|iti ti |td|ƒƒ|iti ti dƒ|iti ti |dƒdS(Ns s %include s%http://www.zope.org/no-such-document/( ttempfiletmktemptfnRRRR&R RtConfigurationErrort loadSchemat loadConfigtloadConfigFile(R RYR&((R RS s         (RHRIRORPRNRTRVRS(((R RJïs      cCs)titƒ}|ititƒƒ|S(N(tunittestt makeSuiteRtsuitetaddTestRJ(R`((R t test_suitest__main__t defaultTestRb(t__doc__tos.pathtostsysRWR^RKRRtZConfig.loadert ZConfig.urltZConfig.tests.supportRtTestBaset__file__tmyfilet NameErrortargvR!tabspathtjointdirnamet LIBRARY_DIRRtTestCaseRJRbRHtmain(RRlRRWR^RJRKRRhRnRbRtRRg((R t?s*          !Ç0