ó {G_Tc@sÏddlZddlZddlZddlZddlmZge_ee_ej ƒdej fd„ƒYZ ej ej jdƒdƒdej fd„ƒYƒZd „Zed krËeƒndS( iÿÿÿÿN(t test_supporttMimeTypesTestCasecBs>eZd„Zd„Zd„Zd„Zd„Zd„ZRS(cCstjƒ|_dS(N(t mimetypest MimeTypestdb(tself((s//usr/local/lib/python2.7/test/test_mimetypes.pytsetUpscCs£|j}||jjdƒd ƒ||jjdƒdƒ||jjdƒdƒ||jjdƒdƒ||jjd ƒdƒ||jjd ƒdƒdS(Nsfoo.htmls text/htmlsfoo.tgzsapplication/x-tartgzips foo.tar.gzs foo.tar.Ztcompresss foo.tar.bz2tbzip2s foo.tar.xztxz(s text/htmlN(sapplication/x-tarR(sapplication/x-tarR(sapplication/x-tarR(sapplication/x-tarR (sapplication/x-tarR (t assertEqualRt guess_typetNone(Rteq((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_default_datas cCsR|j}|jj}||dƒdƒ||dƒdƒ||dƒdƒdS( Nsdata:,thisIsTextPlains text/plainsdata:;base64,thisIsTextPlainsdata:text/x-foo,thisIsTextXFoos text/x-foo(s text/plainN(s text/plainN(s text/x-fooN(R RR R (RRR ((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_data_urlss   cCs^|j}tjdƒ}|jj|ƒ||jjdƒdƒ||jjdƒdƒdS(Ns x-application/x-unittest pyunit s foo.pyunitsx-application/x-unittests.pyunit(sx-application/x-unittestN(R tStringIORtreadfpR R tguess_extension(RRtsio((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_file_parsing$s  cCs‰|j}||jjddtƒdƒ||jjddtƒdƒ||jjddtƒdƒ||jjddtƒdƒdS(Nsfoo.xultstricts image/jpgstext/xuls.jpg(NN(stext/xulN(R RR tTrueR RtFalse(RR((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_non_standard_types,s  c Cs³|j}|j}t|jjddtƒƒ}||tddddddgƒkƒ|jjd dtƒ}|jƒ||d gƒ|jjd dtƒ}||gƒdS( Ns text/plainRs.bats.cs.hs.kshs.pls.txts image/jpgs.jpg(R t assertTruetsetRtguess_all_extensionsRRtsort(RRtunlesstall((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_guess_all_types5s  ( (t__name__t __module__RRRRRR (((s//usr/local/lib/python2.7/test/test_mimetypes.pyRs     twins Windows onlytWin32MimeTypesTestCasecBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs#tjjƒ|_tjjƒdS(N(Rt types_maptcopytoriginal_types_maptclear(R((s//usr/local/lib/python2.7/test/test_mimetypes.pyRHscCs$tjjƒtjj|jƒdS(N(RR%R(tupdateR'(R((s//usr/local/lib/python2.7/test/test_mimetypes.pyttearDownMs cCse|j}tjƒtjƒ}||jdƒdƒ||jdƒdƒ||jdƒd ƒdS( Nsfoo.txts text/plains image.jpgs image/jpegs image.pngs image/png(s text/plainN(s image/jpegN(s image/pngN(R RtinitRR R (RRR((s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_registry_parsingRs    csSddl‰dtf‡fd†ƒY}|ƒt_ztjƒWdˆt_XdS(Niÿÿÿÿt MockWinregcseZ‡fd†ZRS(csX|dkr‡fd†S|dkr2‡fd†S|dkrK‡fd†Stˆ|ƒS(NtEnumKeycsˆj||ƒdS(Ns£(R.(tkeyti(t_winreg(s//usr/local/lib/python2.7/test/test_mimetypes.pytcstOpenKeycsˆj||jdƒƒS(Ns£(R3trstrip(R/tname(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR2est QueryValueExcs dˆjfS(NuтекÑÑ‚/проÑтой(tREG_SZ(tsubkeytlabel(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR2gs(tgetattr(RR5(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyt __getattr__as      (R!R"R;((R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR-`s(R1tobjectRR+(RR-((R1s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_non_latin_extension]s   csSddl‰dtf‡fd†ƒY}|ƒt_ztjƒWdˆt_XdS(NiÿÿÿÿR-cseZ‡fd†ZRS(cs&|dkr‡fd†Stˆ|ƒS(NR6cs dˆjfS(NuтекÑÑ‚/проÑтой(R7(R8R9(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR2xs(R:(RR5(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR;vs  (R!R"R;((R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR-us(R1R<RR+(RR-((R1s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_non_latin_typers   csvddl‰dtf‡fd†ƒY}|ƒt_z1tjƒ|jttjjƒdtƒƒWdˆt_XdS(NiÿÿÿÿR-cseZ‡fd†ZRS(cs&|dkr‡fd†Stˆ|ƒS(NR6cs dˆjfS(Nu text/plain(R7(R8R9(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR2‰s(R:(RR5(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR;‡s  (R!R"R;((R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR-†si( R1R<RR+Rt isinstanceR%tvalueststr(RR-((R1s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_type_map_valuesƒs   'csSddl‰dtf‡fd†ƒY}|ƒt_ztjƒWdˆt_XdS(NiÿÿÿÿR-cs&eZ‡fd†Z‡fd†ZRS(cs1|ˆjkr!tddƒ‚nˆj||ƒS(NisAccess is denied(tHKEY_CLASSES_ROOTt WindowsErrorR3(RR/R5(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR3—scs tˆ|ƒS(N(R:(RR5(R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR;›s(R!R"R3R;((R1(s//usr/local/lib/python2.7/test/test_mimetypes.pyR-–s(R1R<RR+(RR-((R1s//usr/local/lib/python2.7/test/test_mimetypes.pyttest_registry_read_error“s   ( R!R"RR*R,R=R>RBRE(((s//usr/local/lib/python2.7/test/test_mimetypes.pyR$Fs     cCstjttƒdS(N(Rt run_unittestRR$(((s//usr/local/lib/python2.7/test/test_mimetypes.pyt test_main¤s t__main__(RRtunittesttsysttestRt knownfilesRtinitedt_default_mime_typestTestCaseRt skipUnlesstplatformt startswithR$RGR!(((s//usr/local/lib/python2.7/test/test_mimetypes.pyts       6]