a 5êdg…'ã@sZddlZddlZddlZddlZddlZej d¡Zddddddœgd d d d œgd d ddddœgdddœgd dddœddddœgdddœgddd dd d!œgd"d d#d$d%œgd&d'dœgd(d)dœgd*d+dœgd,d-dd.œgd&d/dœgd0œ Z e  e ¡Z e   ¡D]Z e D]Ze d1¡qüqôGd2d3„d3ejƒZGd4d5„d5ejƒZGd6d7„d7ejƒZed8krVe ¡dS)9éNz mailcap.txtz moviemaker %sz""/usr/lib/Zmail/bitmaps/movie.xbm"z"Movie"zmovieplayer %sé)Úcomposez x11-bitmapÚ descriptionÚviewÚlinenoÚz?echo "This is \"%t\" but is 50 \% Greek to me" \; cat %sé)Ú copiousoutputrrúaudiocompose %sú"An audio fragment"ú showaudio %sé©Úeditrrrrú mpeg_play %sé ©rrzps-to-terminal %sé)Ú needsterminalrrzidraw %sé)rrrzxdvi %séú extcompose %sú4"A reference to data stored in an external location"úQshowexternal %s %{access-type} %{name} %{site} %{directory} %{mode} %{server}é ©Z composetypedrrrrz?test "`echo %{charset} | tr '[A-Z]' '[a-z]'`" = iso-8859-8z)shownonascii iso-8859-8 -e richtext -p %sé )Útestr rrz display %sé ú/usr/local/bin/showaudio %téú animate %sé z "cat %s | lp"z showframe %s)Úprintrré) zapplication/x-moviez application/*ú audio/basicú video/mpegzapplication/postscriptzapplication/x-dviúmessage/external-bodyz text/richtextzimage/x-xwindowdumpúaudio/*úvideo/*zapplication/framez image/rgbrc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚHelperFunctionTestcCsžt ¡}| |t¡|D]}| |t¡qtj ¡J}d|vrP|d t j ¡}n ddg}t j   |¡|d<t ¡}Wdƒn1s„0Y|  ||¡dS)NÚMAILCAPSz/testdir1/.mailcapz/testdir2/mailcap) ÚmailcapÚlistmailcapfilesÚassertIsInstanceÚlistÚstrrÚsupportÚEnvironmentVarGuardÚsplitÚosÚpathsepÚjoinÚ assertEqual)ÚselfZmcfilesÚmÚenvZ env_mailcaps©r;ú-/usr/local/lib/python3.9/test/test_mailcap.pyÚtest_listmailcapfilesEs  &z(HelperFunctionTest.test_listmailcapfilesc CsnttdƒD}| t¡t |¡}Wdƒn1s60YWdƒn1sT0Y| |t¡dS)NÚr)ÚopenÚ MAILCAPFILEZ assertWarnsÚDeprecationWarningr,ZreadmailcapfileÚassertDictEqualÚMAILCAPDICT_DEPRECATED)r8ÚmcfÚdr;r;r<Útest_readmailcapfileXs  Fz'HelperFunctionTest.test_readmailcapfilecCsˆdddœdddœg}t td¡}| ||¡d}ddd d d d œg}t td |¡}| ||¡ddiddig}t td¡}| ||¡dS)Nr!r"rrrr&rr r r r rr%r)r,ÚlookupÚ MAILCAPDICTZassertListEqualrC)r8ZexpectedÚactualÚkeyr;r;r<Ú test_lookup_s"ÿ  ü  zHelperFunctionTest.test_lookupc Cs‚gd¢}gd¢dfgd¢dfgd¢dfgd¢d fgd ¢d fdd d |gdfdd d |gdfg}|D]}| tj|dŽ|d¡q^dS)N)zid=1znumber=2ztotal=3)rr(úfoo.txtr)úecho foor(rLrM)zecho %sr(rLz echo foo.txt)úecho %tr(rLz echo audio/*)zecho \%tr(rLrNr(rLz echo %{total}zecho 3rr)r7r,Úsubst)r8ÚplistZ test_casesZtcr;r;r<Ú test_substus     ù zHelperFunctionTest.test_substN)Ú__name__Ú __module__Ú __qualname__r=rFrKrQr;r;r;r<r*Csr*c@seZdZdd„Zdd„ZdS)Ú GetcapsTestcCsJtj ¡,}t|d<t ¡}| |t¡Wdƒn1s<0YdS)Nr+)rr1r2r@r,ÚgetcapsrBrH)r8r:Úcapsr;r;r<Útest_mock_getcaps‡s zGetcapsTest.test_mock_getcapscCs€t ¡}| |t¡t ¡}dd„|Dƒ}|rp| ¡D]6\}}| |t¡| |t¡|D]}| |t¡qZq6n | i|¡dS)NcSsg|]}tj |¡r|‘qSr;)r4ÚpathÚexists)Ú.0rDr;r;r<Ú •óz3GetcapsTest.test_system_mailcap..) r,rVr.Údictr-Úitemsr0r/r7)r8rWZ mailcapfilesZexistingmcfilesÚkÚvÚer;r;r<Útest_system_mailcaps   zGetcapsTest.test_system_mailcapN)rRrSrTrXrcr;r;r;r<rU…s rUc@s6eZdZdd„Ze ejdkd¡dd„ƒZdd„Z d S) Ú FindmatchTestc Cs2t}d}gd¢}ddddddœ}dd d œ}d d d œ}d dddddœ}idgidf|dgidf|dgid|ff|ddgid|ff|ddgid|ff|ddgid|ff|ddgidf|dgd|id ||ff|ddgd|id||ff|dgd|dœd|ff|d gd|id!|ff|d"gd#|id$|ffg }| |¡dS)%NrL)zaccess-type=defaultz name=johnzsite=python.orgzdirectory=/tmpzmode=fooz server=barr r r r rrr rr!r"rrrrrrr&©NNzfoo/barzanimate /dev/nullr%rzaudiocompose /dev/nullrrZfoobarr)Úfilename)rJrfr(z /usr/local/bin/showaudio audio/*r'rPz?showexternal /dev/null default john python.org /tmp foo bar)rHÚ _run_cases) r8ÚcZfnamerPZaudio_basic_entryZ audio_entryZ video_entryZ message_entryÚcasesr;r;r<Útest_findmatch¤sTû  ü   þþþþîzFindmatchTest.test_findmatchÚposixz!Requires 'test' command on systemcCsLddigddigdœ}|ddgidddiff|ddgidfg}| |¡dS)Nrz test 1 -eq 1z test 1 -eq 0)ú test/passú test/failrlrmre)rg)r8rWrir;r;r<Ú test_test×sÿüzFindmatchTest.test_testcCs2|D](}| tj|di|d¤Ž|d¡qdS)Nrrr)r7r,Z findmatch)r8rirhr;r;r<rgészFindmatchTest._run_casesN) rRrSrTrjÚunittestZ skipUnlessr4Únamernrgr;r;r;r<rd¢s3 rdÚ__main__)r,r4ÚcopyZ test.supportrror1Zfindfiler@rHÚdeepcopyrCÚvaluesZ entry_listÚentryÚpopZTestCaser*rUrdrRÚmainr;r;r;r<Úsh üþü   ÿ üý     Ô1  BL