a :êdgOã@s´ddlZddlZddlZddlmZddlmZmZddlm Z ddl m Z z ddl Z Wne yndZ Yn0ej e¡ZGdd„de je jejƒZdd „Zed kr°eeƒƒdS) éN)Ú run_unittest)ÚcheckÚ HAS_DOCUTILS)Úsupport)ÚDistutilsSetupErrorc@sbeZdZddd„Zdd„Ze ed¡dd„ƒZe ed¡d d „ƒZ e ed¡d d „ƒZ d d„Z dS)Ú CheckTestCaseNc KsŽ|dur i}|dur&t ¡}t |¡|jfi|¤Ž\}}t|ƒ}| ¡| ¡D]\}} t||| ƒqR| ¡|  ¡|durŠt |¡|S©N) ÚosÚgetcwdÚchdirÚ create_distrZinitialize_optionsÚitemsÚsetattrZensure_finalizedÚrun) ÚselfÚmetadataÚcwdÚoptionsZold_dirÚpkg_infoÚdistÚcmdÚnameÚvalue©rú6/usr/local/lib/python3.9/distutils/tests/test_check.pyÚ_runs  zCheckTestCase._runcCs¦| ¡}| |jd¡ddddddœ}| |¡}| |jd¡|jt|jifiddi¤Ž|j|dd}| |jd¡dddddd d d œ}| |¡}| |jd¡dS) NéÚxxx)ÚurlÚauthorÚ author_emailrÚversionrÚstricté)r"uÉricuSomething about esszet ßuMore things about esszet ß)rrr rr!Ú descriptionÚlong_description)rÚ assertEqualÚ _warningsÚ assertRaisesr)rrrrrrÚtest_check_metadata)s&þ ü z!CheckTestCase.test_check_metadatazwon't test without docutilscCsT| ¡\}}t|ƒ}d}| |¡}| t|ƒd¡d}| |¡}| t|ƒd¡dS)Nútitle === testr#ztitle ===== testr)r rÚ_check_rst_datar&Úlen)rrrrÚ broken_restÚmsgsÚrestrrrÚtest_check_documentJs   z!CheckTestCase.test_check_documentcCs´d}|j|d\}}t|ƒ}| ¡| |jd¡ddddd|dœ}|jt|j|fidddœ¤Žd|d<|j|ddd}| |jd ¡d |d<|j|tddd }| |jd ¡dS) Nr*©r%r#r)rrr rr!r%©r"Úrestructuredtextutitle ===== test ßr%rz)title ===== .. include:: includetest.rst)rr"r3) r rÚcheck_restructuredtextr&r'r(rrÚHERE)rr-rrrrrrrÚtest_check_restructuredtextYs&ýÿz)CheckTestCase.test_check_restructuredtextcCsžg}| t d¡¡| t d¡¡|D]p}|j|d\}}t|ƒ}| ¡| |¡}tdurp| t |ƒd¡q(| t |ƒd¡| t |ddƒd¡q(dS)Nz} Here's some code: .. code:: python def foo(): pass zƒ Here's some code: .. code-block:: python def foo(): pass r1rr#z0Cannot analyze code. Pygments package not found.) ÚappendÚtextwrapÚdedentr rr4r+Úpygmentsr&r,Ústr)rZexample_rst_docsZrest_with_coderrrr.rrrÚ1test_check_restructuredtext_with_syntax_highlightts  þz?CheckTestCase.test_check_restructuredtext_with_syntax_highlightcCs,dddœ}|jt|jifidddœ¤ŽdS)Nr)rrr#r2)r(rr)rrrrrÚtest_check_all˜s  ÿÿÿzCheckTestCase.test_check_all)NN) Ú__name__Ú __module__Ú __qualname__rr)ÚunittestZ skipUnlessrr0r6r<r=rrrrrs !      #rcCs t t¡Sr)rAZ makeSuiterrrrrÚ test_suiteŸsrBÚ__main__)r r8rAZ test.supportrZdistutils.command.checkrrZdistutils.testsrZdistutils.errorsrr:Ú ImportErrorÚpathÚdirnameÚ__file__r5ZLoggingSilencerZTempdirManagerZTestCaserrBr>rrrrÚs&       þ