]_!)ddlmZddlmZmZddlZddlZddlZGddejZ GddZ Gdd e Z Gd d e Z dS) )findfile)TESTFNunlinkNceZdZdZdZdS) UnseekableIOctjNioUnsupportedOperationselfs 6/opt/alt/python311/lib64/python3.11/test/audiotests.pytellzUnseekableIO.tell %%ctjr r )rargskwargss rseekzUnseekableIO.seek rrN)__name__ __module__ __qualname__rrrrrrs2&&&&&&&&rrc$eZdZdZdZdZdZdS) AudioTestsFc"dx|_|_dSr )ffoutr s rsetUpzAudioTests.setUps!!rc|j|j|j|jttdSr )rcloserrrr s rtearDownzAudioTests.tearDownsB 6  FLLNNN 9 IOO   vrc B|||||||||||||||||||}||||||||f||j|||j |||j |||j |||j |||j |ttjdzD]?} tj|| } |tj| |@dS)N) assertEqual getnchannels getsampwidth getframerate getnframes getcomptype getcompname getparams nchannels sampwidth frameratenframescomptypecompnamerangepickleHIGHEST_PROTOCOLdumpsloads) rrr.r/r0r1r2r3paramsprotodumps r check_paramszAudioTests.check_paramss ))9555 ))9555 ))9555 111 (333 (333 Iy'8XN P P P )9555 )9555 )9555 111 (333 (33362Q677 9 9E<..D   V\$// 8 8 8 8 9 9rN)rrrclose_fdr r#r<rrrrrsFH"""99999rrcteZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdS)AudioWriteTestsc&|j|dx}|_||j||j||j| |j |j |SNwb) moduleopenr setnchannelsr. setsampwidthr/ setframerater0 setcomptyper2r3rtestfilers r create_filezAudioWriteTests.create_file7sy ((4888DI t~&&& t~&&& t~&&& dmT]333rc|j|d5}|||j|||j|||j|| ||| ||ddddS#1swxYwYdSNrb) rCrDr&r'r.r(r/r)r0r* readframes)rrJr1framesrs r check_filezAudioWriteTests.check_file?s! [  h - - <   Q^^--t~ > > >   Q^^--t~ > > >   Q^^--t~ > > >   Q\\^^W 5 5 5   Q\\'22F ; ; ;  < < < < < < < < < < < < < < < < < &C&C C&C C&C C& C>&C* *C>-C* .C>>DDc|ttd5}|j|5}||j||j||j| |j |j dddn #1swxYwY| |j |jdddn #1swxYwYttd5}|j|5}||j |}| |j|j| |j|j| |j|jdddn #1swxYwY|js'||| |j |jddddS#1swxYwYdS)NrBrN)rDrrCrEr.rFr/rGr0rHr2r3r&closedr= assertFalsegetfpr- assertIsNone)rrJrr9s r#test_context_manager_with_open_filez3AudioWriteTests.test_context_manager_with_open_fileZs &$   =8!!(++ BBB  !14>BBB  !14>BBB  C C C C C C C C C C C C C C C = -!!!'')),,,   X_dm < < < = = = = = = = = = = = = = = = = = =smC#A/B, C#,B0 0C#3B0 4#C##C'*C'H1B!G ? H1 G H1G AH11H58H5c`|jtd5}||j||j||j| |j |j dddn #1swxYwY|jt5}| | j|}||j|j||j|j||j|jdddn #1swxYwY|js)|| dSdSrA)rCrDrrEr.rFr/rGr0rHr2r3r]r^r\r-r&r=r_)rrr9s r"test_context_manager_with_filenamez2AudioWriteTests.test_context_manager_with_filenamems[  fd + + 8q NN4> * * * NN4> * * * NN4> * * * MM$- 7 7 7  8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 [  f % % ?   QWWYY- . . .[[]]F   V-t~ > > >   V-t~ > > >   V-t~ > > >  ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } )   aggii ( ( ( ( ( ) )s%A/BB #B B!E33E7:E7c|t}||j||j||t|j|jdSr )rKrrSr1rTrPr"rQrUs r test_writezAudioWriteTests.test_write~sj   V $ $ T\""" dk"""    dk:::::rc0|t}||j|t |j||t|j|jdSr ) rKrrSr1rT bytearrayrPr"rQrUs rtest_write_bytearrayz$AudioWriteTests.test_write_bytearraysr   V $ $ T\""" i ,,---    dk:::::rc<|t}||j|t jd|j||t|j|jdS)Nh) rKrrSr1rTarrayrPr"rQrUs rtest_write_arrayz AudioWriteTests.test_write_arraysv   V $ $ T\""" ek#t{33444    dk:::::rc0|t}||j|t |j||t|j|jdSr ) rKrrSr1rT memoryviewrPr"rQrUs rtest_write_memoryviewz%AudioWriteTests.test_write_memoryviewsr   V $ $ T\""" j--...    dk:::::rc:ttd5}|d||}||jdz||j|dddn #1swxYwYttd5}| | dd| ||j|jddddS#1swxYwYdSNrB ababagalamagar%rN rDrwriterKrSr1rTrPr"r&readrQrIs rtest_incompleted_writez&AudioWriteTests.test_incompleted_write &$   8 NN+ , , ,  **A LL) * * * MM$+ & & & GGIII                &$   A8   X]]2..0@ A A A OOHdlDK @ @ @ A A A A A A A A A A A A A A A A A A%A6BBB8A DDDcttd5}|d||}||j|j|jz}||j d| ||j | d| dddn #1swxYwYttd5}| | dd| ||j|j ddddS#1swxYwYdSNrBrqrNrr)rDrrtrKrSr1r.r/rTrPr"r&rurQrrJr framesizes rtest_multiple_writesz$AudioWriteTests.test_multiple_writess &$   8 NN+ , , ,  **A LL & & &7I MM$+k zk2 3 3 3 MM$+yjkk2 3 3 3 GGIII               &$   A8   X]]2..0@ A A A OOHdlDK @ @ @ A A A A A A A A A A A A A A A A A As%B.CCC0A EE E c:ttd5}|d||}||jdz ||j|dddn #1swxYwYttd5}| | dd| ||j|jddddS#1swxYwYdSrprsrIs rtest_overflowed_writez%AudioWriteTests.test_overflowed_writerwrxcp|t5}||j||jdddn #1swxYwYt td5}|||j|jddddS#1swxYwYdSrM)rKrrSr1rTrPrrQ)rrrJs rtest_unseekable_readz$AudioWriteTests.test_unseekable_reads0   f % % ' LL & & & MM$+ & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' '&$ ' ' A8 OOHdlDK @ @ @ A A A A A A A A A A A A A A A A A As#5AA #A <"B++B/2B/cnttd5}||5}||j||jdddn #1swxYwYdddn #1swxYwY|t|j|jdSrA)rrrKrSr1rTrPrQrIs rtest_unseekable_writez%AudioWriteTests.test_unseekable_writes &$ ' ' +8!!(++ +q T\*** dk*** + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  dk:::::s4B5A-! B-A1 1B4A1 5BB Bcttd5}|d||}||jdz ||jn#t$rYnwxYw | n#t$rYnwxYwdddn #1swxYwYttd5}| | dd| ||jdz|jddddS#1swxYwYdSrp)rrrtrKrSr1rTrPOSErrorr"rDr&rurQrIs r!test_unseekable_incompleted_writez1AudioWriteTests.test_unseekable_incompleted_writes &$ ' ' 8 NN+ , , ,  **A LL) * * *  dk****                         &$   E8   X]]2..0@ A A A OOHdlQ&6 D D D E E E E E E E E E E E E E E E E E EsmAB<A:9B<: BB<BB< B B< B-*B<,B--B<<CCAD77D;>D;cttd5}|d||}||jdz  ||jn#t$rYnwxYw | n#t$rYnwxYwdddn #1swxYwYttd5}| | dd|j |jz}|||jdz |jd| ddddS#1swxYwYdSrp)rrrtrKrSr1rTrPrr"rDr&rur.r/rQr{s r test_unseekable_overflowed_writez0AudioWriteTests.test_unseekable_overflowed_writes &$ ' ' 8 NN+ , , ,  **A LL) * * *  dk****                         &$   R8   X]]2..0@ A A A7I OOHdlQ&6 KiZK8P Q Q Q R R R R R R R R R R R R R R R R R RsmAB<A:9B<: BB<BB< B B< B-*B<,B--B<<CCA&EEEN)rrrrKrQrVrZr`rbrdrgrkrnrvr}rrrrrrrrr?r?5s'<<<   ===&)))";;;;;;;;;;;; A A A A A A A A AAAA;;;EEE$RRRRRrr?cBeZdZedZdZdZdZdZdZ dS)AudioTestsWithSourceFilec<t|jd|_dS)N audiodata)subdir)r sndfilename sndfilepath)clss r setUpClassz#AudioTestsWithSourceFile.setUpClasss"3?;GGGrc |j|jx}|_|||j|j|j|j|j |j dSr ) rCrDrrr<r.r/r0sndfilenframesr2r3rUs rtest_read_paramsz)AudioTestsWithSourceFile.test_read_paramssd[%%d&6777DF !T^T^T^-t}dm M M M M Mrct|jd5}|j|x}|_||j|||j|jdddn #1swxYwYttd5}|j|dx}|_ ||j| |jj 5|dddn #1swxYwY||j|j|ddddS#1swxYwYdS)NrNrB) rDrrCrr]r\r"r&r=rrrXrY)rrJrrs r test_closez#AudioTestsWithSourceFile.test_closes  $"D ) ) =X))(33 3A   X_ - - - GGIII   X_dm < < <  = = = = = = = = = = = = = = = &$   8#{//$?? ?D49   X_ - - -""4;#455                     X_dm < < < JJLLL                   sIA0BBB2AE;D/# E;/D3 3E;6D3 77E;;E?E?cz|j|jz}|jdd|z}|jd|zd|z}|j|jx}|_||dd|| d||d|| | }||d||d|| }||d||d|| |||d|| |||d|| |jj 5| ddddn #1swxYwY| |jj 5| |dzddddS#1swxYwYdS)Nrrr%)r.r/rPrCrDrrr&rOrrewindsetposrXrYr*)rr|chunk1chunk2rpos0pos2s r test_readz"AudioTestsWithSourceFile.test_readsNT^3 ^a)m^,Q]A M9:[%%d&6777DF a#... 1%%% a&111  vvxx q!!! a&111vvxx q!!! a&111  a&111  a&111   t{0 1 1   HHRLLL                  t{0 1 1 ) ) HHQ\\^^a' ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )s$,III8+J00J47J4ch|j|jx}|_|jtdx}|_||d}|}|dkr8|dz }| | |||z}|dk8| |jtdx}|_| | ||| | || |dS)NrBrr%rN)rCrDrrrr setparamsr-r*rTrOr"rr&)rrrins r test_copyz"AudioTestsWithSourceFile.test_copy,sb[%%d&6777DF;++FD999ty q{{}}%%%  LLNN!ee FA   Q\\!__ - - - FA!ee ;++FD999ty   (8(8999 allnn55):):;; = = = = =rcttd5}|dt|jd5}||dddn #1swxYwYdddn #1swxYwYttd5}||dd|j|d5}|||j|| |j || |j || |j|||j|jdddn #1swxYwYddddS#1swxYwYdSrz)rDrrtrrur&rCr'r.r(r/r)r0r*rrOr1rPrIs rtest_read_not_from_startz1AudioTestsWithSourceFile.test_read_not_from_start=s &$   )8 NN+ , , ,d&-- )qvvxx((( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) &$   J8   X]]2..0@ A A A!!(D11 JQ  !1!14>BBB  !1!14>BBB  !1!14>BBB  1DEEE  dl!;!;T[III  J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J Jsm+B (A5) B 5A9 9B <A9 =B  BB,AG=1C(G% G=%G) )G=,G) -G==HHN) rrr classmethodrrrrrrrrrrrsHH[HMMM   )))0===" J J J J Jrr) test.supportrtest.support.os_helperrrrjr r5FileIOrrr?rrrrrs"!!!!!!11111111 &&&&&29&&&"9"9"9"9"9"9"9"9JBRBRBRBRBRjBRBRBRJPJPJPJPJPJzPJPJPJPJPJr