ó {G_Tc @sÎddlZddlZddlZddlZddlmZmZmZmZdd d!d"d#d$d%d&d'd(d)f Z dej fd„ƒYZ dej fd„ƒYZ d„ZedkrÊeƒndS(*iÿÿÿÿN(tfindfiletTESTFNtunlinkt run_unittests python.pngtpngs python.giftgifs python.bmptbmps python.ppmtppms python.pgmtpgms python.pbmtpbms python.jpgtjpegs python.rastrasts python.sgitrgbs python.tiffttiffs python.xbmtxbmt UnseekableIOcBseZd„Zd„ZRS(cCs tj‚dS(N(tiotUnsupportedOperation(tself((s,/usr/local/lib/python2.7/test/test_imghdr.pyttellscOs tj‚dS(N(RR(Rtargstkwargs((s,/usr/local/lib/python2.7/test/test_imghdr.pytseeks(t__name__t __module__RR(((s,/usr/local/lib/python2.7/test/test_imghdr.pyRs t TestImghdrcBsqeZed„ƒZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z RS( cCsCtdddƒ|_t|jdƒ}|jƒ|_WdQXdS(Ns python.pngtsubdirt imghdrdatatrb(Rttestfiletopentreadttestdata(tclststream((s,/usr/local/lib/python2.7/test/test_imghdr.pyt setUpClassscCsttƒdS(N(RR(R((s,/usr/local/lib/python2.7/test/test_imghdr.pyttearDown#scCsåxÞtD]Ö\}}t|ddƒ}|jtj|ƒ|ƒ|jtjƒƒ}|jtj|ƒ|ƒt|dƒ }|jtj|ƒ|ƒWdQXt|dƒ}|j ƒ}WdQX|jtjd|ƒ|ƒqWdS(NRRR( t TEST_FILESRt assertEqualtimghdrtwhattdecodetsystgetfilesystemencodingRRtNone(Rtfilenametexpectedt ufilenameR"tdata((s,/usr/local/lib/python2.7/test/test_imghdr.pyt test_data&scCsLd„}tjj|ƒ|jtjjƒ|jtjddƒdƒdS(NcSs|jdƒrdSdS(Nteggstham(t startswith(thtfile((s,/usr/local/lib/python2.7/test/test_imghdr.pyt test_jumbo3sR2R3(R'tteststappendt addCleanuptpopR&R(R,(RR7((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_register_test2s cCs™ttdƒ0}|jdƒ|jƒ}|j|jƒWdQXttdƒC}|j|ƒ|jtj|ƒdƒ|j|jƒ|ƒWdQXdS(Ntwbt ababagalamagaRR( RRtwriteRR RR&R'R((RR"tpos((s,/usr/local/lib/python2.7/test/test_imghdr.pyt test_file_pos:s   c Cs´|jtƒtjƒWdQX|jtƒtjdƒWdQX|jtƒtj|jdƒWdQXt|jdƒ0}|jtƒtj|jƒƒWdQXWdQXdS(NiR( t assertRaisest TypeErrorR'R(tAttributeErrorR,RRtfileno(Rtf((s,/usr/local/lib/python2.7/test/test_imghdr.pyt test_bad_argsDscCs.x'dD]}|jtjd|ƒƒqWdS(Ns‰PN sÙsY¦tcutecatt 000000JFItGIF80(s‰PN sÙsY¦RHRIRJ(t assertIsNoneR'R(R,(Rtheader((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_invalid_headersOs cCs'|jtƒtjdƒWdQXdS(Ntmissing(RBtIOErrorR'R((R((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_missing_fileXscCs†t|jdƒ}|jƒ|jtƒ}tj|ƒWdQXtj|j ƒ}|jƒ|jtƒ}tj|ƒWdQXdS(NR( RRtcloseRBt ValueErrorR'R(RtBytesIOR (RR"tcm((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_closed_file\s  c Csjttdƒ}|j|jƒWdQXttdƒ-}|jtjƒtj |ƒWdQXWdQXdS(NR=R( RRR?R RRBRRR'R((RR"((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_unseekablefs c Cs^ttdƒI}|j|jƒ|jdƒ|jtƒ}tj|ƒWdQXWdQXdS(NR=i( RRR?R RRBROR'R((RR"RT((s,/usr/local/lib/python2.7/test/test_imghdr.pyttest_output_streamms  (RRt classmethodR#R$R1R<RARGRMRPRURVRW(((s,/usr/local/lib/python2.7/test/test_imghdr.pyRs    cCsttƒdS(N(RR(((s,/usr/local/lib/python2.7/test/test_imghdr.pyt test_maintst__main__(s python.pngspng(s python.gifR(s python.bmpR(s python.ppmR(s python.pgmR(s python.pbmR (s python.jpgR (s python.rasR (s python.sgiR (s python.tiffR (s python.xbmR(R'RR*tunittestttest.test_supportRRRRR%tFileIORtTestCaseRRYR(((s,/usr/local/lib/python2.7/test/test_imghdr.pyts(    " X