ó {G_Tc@sáddlmZmZmZddlZddlZddlZddlZddlZddl Z de fd„ƒYZ d„Z d„Z d„Zd„Zd dd „ƒYZd efd „ƒYZd efd„ƒYZdS(iÿÿÿÿ(tfindfiletTESTFNtunlinkNt UnseekableIOcBseZd„Zd„ZRS(cCs tj‚dS(N(tiotUnsupportedOperation(tself((s+/usr/local/lib/python2.7/test/audiotests.pyttell scOs tj‚dS(N(RR(Rtargstkwargs((s+/usr/local/lib/python2.7/test/audiotests.pytseek s(t__name__t __module__RR (((s+/usr/local/lib/python2.7/test/audiotests.pyR s cCstj|jddƒƒS(Nt t(tbase64t b16decodetreplace(ts((s+/usr/local/lib/python2.7/test/audiotests.pytfromhexscCs0tjdƒ}|j|ƒ|jƒ|jƒS(Nth(tarrayt fromstringtbyteswapttostring(tdatata((s+/usr/local/lib/python2.7/test/audiotests.pyt byteswap2s  cCsVt|ƒ}|ddd…|ddd…<|ddd…|ddd…|jjƒnttƒdS(N(R$R#tcloseR%RR(R((s+/usr/local/lib/python2.7/test/audiotests.pyttearDown,s c CsÞ|j|jƒ|ƒ|j|jƒ|ƒ|j|jƒ|ƒ|j|jƒ|ƒ|j|jƒ|ƒ|j|jƒ|ƒ|jƒ}|j|||||||fƒtj |ƒ} |jtj | ƒ|ƒdS(N( t assertEqualt getnchannelst getsampwidtht getframeratet getnframest getcomptypet getcompnamet getparamstpickletdumpstloads( RR$t nchannelst sampwidtht frameratetnframestcomptypetcompnametparamstdump((s+/usr/local/lib/python2.7/test/audiotests.pyt check_params3s  (R R tFalsetclose_fdR&R(R<(((s+/usr/local/lib/python2.7/test/audiotests.pyR"&s  tAudioWriteTestscBskeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( cCsf|jj|dƒ}|_|j|jƒ|j|jƒ|j|jƒ|j |j |j ƒ|S(Ntwb( tmoduletopenR%t setnchannelsR4t setsampwidthR5t setframerateR6t setcomptypeR8R9(RttestfileR$((s+/usr/local/lib/python2.7/test/audiotests.pyt create_fileFs cCs¥|jj|dƒ}z~|j|jƒ|jƒ|j|jƒ|jƒ|j|jƒ|jƒ|j|j ƒ|ƒ|j|j |ƒ|ƒWd|j ƒXdS(Ntrb( RARBR)R*R4R+R5R,R6R-t readframesR'(RRGR7tframesR$((s+/usr/local/lib/python2.7/test/audiotests.pyt check_fileNscCsn|jtƒ}|j|jƒ|j|jƒ|j||j|j|j |j|j |j ƒ|j ƒdS(N( RHRt setnframesR7t writeframesRKR<R4R5R6R8R9R'(RR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_write_paramsYs cCsV|jtƒ}|j|jƒ|j|jƒ|jƒ|jt|j|jƒdS(N(RHRRMR7RNRKR'RL(RR$((s+/usr/local/lib/python2.7/test/audiotests.pyt test_writeas  c Cs°ttdƒQ}|jdƒ|j|ƒ}|j|jdƒ|j|jƒ|jƒWdQXttdƒ9}|j |j dƒdƒ|j ||j|jƒWdQXdS(NR@t ababagalamagaiRIi ( RBRtwriteRHRMR7RNRKR'R)treadRL(RRGR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_incompleted_writeis c CsÖttdƒw}|jdƒ|j|ƒ}|j|jƒ|j|j}|j|j | ƒ|j|j | ƒ|j ƒWdQXttdƒ9}|j |j dƒdƒ|j ||j|j ƒWdQXdS(NR@RQRIi (RBRRRRHRMR7R4R5RNRKR'R)RSRL(RRGR$t framesize((s+/usr/local/lib/python2.7/test/audiotests.pyttest_multiple_writesus c Cs°ttdƒQ}|jdƒ|j|ƒ}|j|jdƒ|j|jƒ|jƒWdQXttdƒ9}|j |j dƒdƒ|j ||j|jƒWdQXdS(NR@RQiRIi ( RBRRRRHRMR7RNRKR'R)RSRL(RRGR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_overflowed_writeƒs cCsn|jtƒ}|j|jƒ|j|jƒ|jƒttdƒ }|j||j|jƒWdQXdS(NRI( RHRRMR7RNRKR'RRL(RR$RG((s+/usr/local/lib/python2.7/test/audiotests.pyttest_unseekable_reads  cCswttdƒI}|j|ƒ}|j|jƒ|j|jƒ|jƒd|_ WdQX|j t|j|jƒdS(NR@( RRRHRMR7RNRKR'R#R%RL(RRGR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_unseekable_write˜s c Csättdƒ}|jdƒ|j|ƒ}|j|jdƒy|j|jƒWntk rinXy|j ƒWntk r‹nXWdQXt tdƒ=}|j |j dƒdƒ|j ||jd|jƒWdQXdS(NR@RQiRIi (RRRRRHRMR7RNRKtIOErrorR'RBR)RSRL(RRGR$((s+/usr/local/lib/python2.7/test/audiotests.pyt!test_unseekable_incompleted_write¢s    c Csùttdƒ}|jdƒ|j|ƒ}|j|jdƒy|j|jƒWntk rinXy|j ƒWntk r‹nXWdQXt tdƒR}|j |j dƒdƒ|j |j}|j||jd|j| ƒWdQXdS(NR@RQiRIi (RRRRRHRMR7RNRKRZR'RBR)RSR4R5RL(RRGR$RU((s+/usr/local/lib/python2.7/test/audiotests.pyt test_unseekable_overflowed_write´s     ( R R RHRLRORPRTRVRWRXRYR[R\(((s+/usr/local/lib/python2.7/test/audiotests.pyR?Ds     tAudioTestsWithSourceFilecBsDeZed„ƒZd„Zd„Zd„Zd„Zd„ZRS(cCst|jddƒ|_dS(Ntsubdirt audiodata(Rt sndfilenamet sndfilepath(tcls((s+/usr/local/lib/python2.7/test/audiotests.pyt setUpClassÊscCsQ|jj|jƒ}|_|j||j|j|j|j|j |j ƒdS(N( RARBRaR$R<R4R5R6tsndfilenframesR8R9(RR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_read_paramsÎsc Csòt|jdƒP}|jj|ƒ}|_|j|jƒ|jƒ|j|j|jƒWdQXtt dƒy}|jj|dƒ}|_ |j|jƒ|j |jj ƒ|jƒWdQX|j|j|jƒ|jƒWdQXdS(NRIR@( RBRaRAR$t assertFalsetclosedR'R)R>RR%t assertRaisestError(RRGR$R%((s+/usr/local/lib/python2.7/test/audiotests.pyt test_closeÔs cCs½|j|j}|jd| }|jd|d|!}|jj|jƒ}|_|j|jdƒdƒ|j|j ƒdƒ|j|jdƒ|ƒ|j ƒ|j ƒ}|j|dƒ|j|jdƒ|ƒ|j ƒ}|j|dƒ|j|jdƒ|ƒ|j |ƒ|j|jdƒ|ƒ|j |ƒ|j|jdƒ|ƒ|j |jj ƒ|j dƒWdQX|j |jj ƒ|j |jƒdƒWdQXdS(NiiiRiÿÿÿÿi(R4R5RKRARBRaR$R)RJRtrewindtsetposRhRiR-(RRUtchunk1tchunk2R$tpos0tpos2((s+/usr/local/lib/python2.7/test/audiotests.pyt test_readâs,     cCs|jj|jƒ}|_|jjtdƒ}|_|j|jƒƒd}|jƒ}x:|dkr™|d7}|j |j |ƒƒ||8}q`W|j ƒ|jjtdƒ}|_|j ƒ|j |jƒ|jƒƒ|j |j |jƒƒ|j |jƒƒƒdS(NR@iiRI(RARBRaR$RR%t setparamsR0R-RNRJR'RkR)(RR$R%R tn((s+/usr/local/lib/python2.7/test/audiotests.pyt test_copyús    c Cs2ttdƒB}|jdƒt|jdƒ}|j|jƒƒWdQXWdQXttdƒÊ}|j|jdƒdƒ|jj|dƒ}z‡|j|jƒ|jƒ|j|j ƒ|j ƒ|j|j ƒ|j ƒ|j|j ƒ|jƒ|j|j|jƒ|jƒWd|jƒXWdQXdS(NR@RQRIi (RBRRRRaRSR)RAR*R4R+R5R,R6R-RdRJR7RKR'(RRGR$((s+/usr/local/lib/python2.7/test/audiotests.pyttest_read_not_from_start s #( R R t classmethodRcReRjRqRtRu(((s+/usr/local/lib/python2.7/test/audiotests.pyR]Ès     ((ttest.test_supportRRRtunittestRRR1tsysRtfileRRRRR!R"R?R](((s+/usr/local/lib/python2.7/test/audiotests.pyts          „