a  ze5@sddlmZddlZddlZddlmZddlZddlZddlZddl Z ddl m Z ddl m Z mZddlmZddlZe jddgd Ze jddgd Zeed Zed d ZGdddeZGdddZGdddeZGdddee jZGdddee jZ GdddeZ!Gddde!e jZ"Gddde!e jZ#GdddeZ$Gd d!d!e$e jZ%Gd"d#d#e$e jZ&Gd$d%d%eZ'Gd&d'd'e'e jZ(Gd(d)d)e'e jZ)Gd*d+d+ee jZ*Gd,d-d-eZ+Gd.d/d/e+e jZ,Gd0d1d1e+e jZ-Gd2d3d3eZ.Gd4d5d5e.e jZ/Gd6d7d7e.e jZ0Gd8d9d9eZ1Gd:d;d;e1e jZ2Gdd?d?e jZ4Gd@dAdAe jZ5dBdCZ6e6Z7e8dDkre 9dS)E)contextmanagerN)StringIO)support)assert_python_okassert_python_failure stacklevelwarnings _warnings)Zblocked)ZfreshZgettotalrefcountc csttfD]&}z|jWqty,Yq0qz tWntyNYn0tj}|j}z4|dd|_|d|t_dVW|t_||_n|t_||_0dS)Nonce) sys warning_tests__warningregistry__clearAttributeError NameErrorr filters simplefilter)moduleZto_clearoriginal_warningsZoriginal_filtersrO/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_warnings/__init__.pywarnings_states(     rc@s eZdZdS) TestWarningN__name__ __module__ __qualname__rrrrr.srcs(eZdZfddZfddZZS)BaseTestcs`tjj|_dtvrtd=ttdr*t`ttdr8t`|j tj d<|j tj_t t | dS)Nrr )unittestcaser old_unittest_moduleglobalshasattrr rr rmodulessuperrsetUpself __class__rrr&6s      zBaseTest.setUpcs&ttjd<|jtj_tt| dS)Nr ) rr r$r!rr r r%rtearDownr'r)rrr+Is  zBaseTest.tearDown)rrrr&r+ __classcell__rrr)rr2s rc@seZdZddZdS)PublicAPITestscCs6|t|jdgd}|t|jjt|dS)N__all__)warn warn_explicit showwarning formatwarningfilterwarningsr resetwarningscatch_warnings) assertTruer#rZassertSetEqualsetr.)r(Z target_apirrrtest_module_all_attributeTs z(PublicAPITests.test_module_all_attributeN)rrrr8rrrrr-Nsr-c@seZdZeZdS)CPublicAPITestsNrrr c_warningsrrrrrr9\sr9c@seZdZeZdS)PyPublicAPITestsNrrr py_warningsrrrrrr<_sr<c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%S)& FilterTestscCs^tj|jd<}|j|jjdtd|t|jjdWdn1sP0YdS)NrerrorcategoryFilterTests.test_error)rr5rr4r3 UserWarning assertRaisesr/r(wrrr test_errorfs   rDc stjjd}jdfdd}t}|Wdn1sP0Y|}d|d|jjdt d t |Wdn1s0YdS) Nr@%FilterTests.test_ignore_after_defaultcsjtdSNrr/rErmessager(rrfqsz/FilterTests.test_error_after_default..fz2UserWarning: FilterTests.test_ignore_after_defaultz&self.module.warn(message, UserWarning)rArB) rr5rr4rcaptured_stderrgetvalueassertInr3rErF)r(rHrOstderrrrMrtest_error_after_defaultms  $z$FilterTests.test_error_after_defaultcCs~tjd|jdZ}|j|jjdtd|jdt|t|d|t t dgWdn1sp0YdS)NTrecordrignorerBFilterTests.test_ignorerversion) rr5rr4r3rEr/ assertEquallenlistrrGrrr test_ignores rXcstjdjd^}jdfdd}|jjdtd||t|dWdn1st0YdS) NTrUrJcsjtdSrKrLrrMrrrOsz0FilterTests.test_ignore_after_default..frWrB)rr5rr4r3rErZr[r(rHrOrrMrtest_ignore_after_defaults rJcstjdjd}jjjdtddfdd}|t|d|d jj d |t|d |d jj d Wdn1s0YdS) NTrUalwaysrBFilterTests.test_alwayscsjtdSrKrLrrMrrrOsz"FilterTests.test_always..fr^r) rr5rr4r3rErZr[rNargsr_rrMr test_alwayss rbcstjdjd}jdfdd}|t|d|djjd|t|djjd t d |t|d |djjd|t|d |djjdWdn1s0YdS) NTrUz$FilterTests.test_always_after_ignorecsjtdSrKrLrrMrrrOsz0FilterTests.test_always_after_default..fr^rcrrarBrd) rr5rr4rZr[rNrer3rEr_rrMrtest_always_after_defaults& z%FilterTests.test_always_after_defaultcCstjd|jd}|j|jjdtdtd}tdD]Z}|j|t|dkrt||dj ||dd=q<|d kr|t |dq}|j|jjdtd|t|jjdtWdn1sR0YdS)Nr@rArBFilterTests.test_inheritance) rr5rr4r3WarningrFrEr/rGrrrtest_inheritances   r}c Cstjd|jd}|j|jjdtd|jjdtdd|dd=z|jdtWntyv|dYn0|t |d Wdn1s0YdS) NTrUrWrBrA)rCappendFilterTests.test_orderingz!order handling for actions failedr) rr5rr4r3rEr/ZfailrZr[rGrrr test_orderings    rcCsBtjd|jd}|jddtdd|t|jjd|jd}|j|| t |dj || |dj t|jd dtddd }|j||t |dj ||j|jdd tdd|t|jjd d }|j|| t |dj || |dj tWdn1s40YdS)NTrUrArconvert to errorzhandle normallyrcrWz filtered outzhex*zhex/octznonmatching text)rr5rr3r~rFrEr/r4rZstrrNassertIsrCZassertNotEqual)r(rHtextrrrtest_filterwarningss,     zFilterTests.test_filterwarningscCstjd|jd}|jdt|jddt|t|jjd|t|jjd|jd||g|jd||gWdn1s0YdS) NTrUrWrAmatchz match prefixz suffix matchzsomething completely different) rr5rrrEr3rFr/rZrGrrrtest_message_matching*s   z!FilterTests.test_message_matchingcsGfdddfddtdDtjd|jdD}|j_|jtddd d |t|d j dWdn1s0YdS) NcseZdZfddZdS)z.FilterTests.test_mutate_filter_list..Xcsgdd<dSrKr)r(aLrrr8sz4FilterTests.test_mutate_filter_list..X.matchN)rrrrrrrrX7srcsg|]}dtdfqS)rir)rE).0i)rrr ;z7FilterTests.test_mutate_filter_list..rdTrUbzf.pyrtrc) rkrr5rrr0rErZrrNrGr)rrrtest_mutate_filter_list6sz#FilterTests.test_mutate_filter_listcCstj|jd|j|jjdtd|t|jjd|jjdtd|jjdtd|t|jjdd||jjdddd Wdn1s0YdS) Nr@rArBr^rWrdz(filterwarnings inserted duplicate filterrz>filterwarnings did not promote filter to the beginning of list) rr5rr4r3rErZr[rr'rrr%test_filterwarnings_duplicate_filtersBs  z1FilterTests.test_filterwarnings_duplicate_filterscCstj|jd|j|jjdtd|t|jjd|jjdtd|jjdtd|t|jjdd||jjdddd Wdn1s0YdS) Nr@rArBr^rWrd&simplefilter inserted duplicate filterrzz3import warnings warnings.warn('hello', UserWarning)execT)rVrarBr) compilerr5rrrErrZrx)r(rxZcodeobjrHrrrtest_exec_filenames&zWarnTests.test_exec_filenamec Cstjd|jd~}|j|jjdtddD]N}zt|WntyXYq0Yn0|j dt|d| |dj |q0Wdn1s0YdS) NTrUrarB)u nonasciié€u surrogaterr^rc) rr5rr4r3rErfsencodeUnicodeEncodeErrorr0rZrx)r(rHrxrrr%test_warn_explicit_non_ascii_filenames   z/WarnTests.test_warn_explicit_non_ascii_filenamec CsT|t|jjdtdd|t|jjdddd|jttf|jjdtdddddS)Nr^rtregistry)rFr{rr0rErr~r'rrrtest_warn_explicit_type_errorss    z(WarnTests.test_warn_explicit_type_errorscCsLGdddt}|t|j|Wdn1s>0YdS)Nc@seZdZddZdS)z-WarnTests.test_bad_str..BadStrWarningcSs dddiS)NzA bad formatted string %(err)errzthere is no %(err)srr'rrr__str__sz5WarnTests.test_bad_str..BadStrWarning.__str__N)rrrrrrrr BadStrWarningsr)r~rFrlrr/)r(rrrr test_bad_strs zWarnTests.test_bad_strc Cs*Gdddt}Gddd}|t}|jddWdn1sL0Y|dt|j|t}|jd|Wdn1s0Y|dt|j|t }|jd|Wdn1s0Y|dt|jtj |jd|j |j d | |}|jd |Wdn1sV0Y| d t|j| t}|jd dWdn1s0Y| d t|j| |}|jd |Wdn1s0Y||jtWdn1s0YdS) Nc@s eZdZdS)z6WarnTests.test_warning_classes..MyWarningClassNrrrrrMyWarningClasssrc@s eZdZdS)z:WarnTests.test_warning_classes..NonWarningSubclassNrrrrrNonWarningSubclasssrzbad warning categoryrz)category must be a Warning subclass, not r@rizgood warning category)r~rFr{rr/rRr exceptionrr5r4r3Z assertWarnsrZwarningrEZassertIsInstance)r(rrcmrrrtest_warning_classess: , , .   . . .zWarnTests.test_warning_classesN) rrrrrrrrrrrrrrrrrrys       rc@seZdZeZddZdS) CWarnTestscCs&|t|j|t|jjddSN__code__) assertIsNotrr assertFalser#r/r'rrrtest_accelerated#szCWarnTests.test_acceleratedN)rrrr;rrrrrrrsrc@seZdZeZddZdS) PyWarnTestscCs&|t|j|t|jjddSr)rrrr6r#r/r'rrrtest_pure_python,szPyWarnTests.test_pure_pythonN)rrrr>rrrrrrr'src@seZdZddZddZdS) WCmdLineTestsc Cstj|jd\||jj|jjd||jj|jjd||jj|jjd||jj|jdWdn1s0Y||jj|jdWdn1s0Y||jj|jdWdn1s0Y||jjd|jd Wdn1s60Y|jd |t|jjd Wdn1st0YdS) Nr@z 1:2:3:4:5:6zbogus::Warningzignore:2::4:-5z ignore::123zignore::123abcz ignore::===uWärninguignore::Wärningzerror::Warning::0r) rr5rrF _OptionError _setoptionZassertRaisesRegexrEr/r'rrrtest_improper_input3s(   ***, z!WCmdLineTests.test_improper_inputc Cstj|jd|jd||jj|jdWdn1sL0Y||jj|jdWdn1s0Y|jd|t|jdtWdn1s0YWdn1s0YdS)Nr@zignore::Warningzignore::TestWarningz ignore::test.test_warnings.bogusz%error::test.test_warnings.TestWarningz test warning)rr5rrrFrrr/r'rrrtest_import_from_moduleHs **  z%WCmdLineTests.test_import_from_moduleN)rrrrrrrrrr1src@seZdZeZdS)CWCmdLineTestsNr:rrrrrTsrc@s eZdZeZddZddZdS)PyWCmdLineTestscCs"tddd\}}}|d|dS)Nz-Wxxx-cpasss0Invalid -W option ignored: invalid action: 'xxx')rrRr(rcoutrrrrtest_improper_option[sz$PyWCmdLineTests.test_improper_optioncCs0tddd\}}}|||d|dS)Nz-Wirz?import sys; sys.modules['warnings'].warn('foo', RuntimeWarning)sRuntimeWarning)rrstrip assertNotInrrrrtest_warnings_bootstrapbs  z'PyWCmdLineTests.test_warnings_bootstrapN)rrrr>rrrrrrrrXsrc@seZdZeZddZddZddZddZd d Z d d Z d dZ ddZ ddZ ddZejddZejddZejddZdS)_WarningsTestscCsptj|jdN}|jddtdd|t|jjd|j`|t|jjdWdn1sb0YdS)Nr@rArrr) rr5rr3r~rFrEr/rrGrrr test_filterrs  z_WarningsTests.test_filtercCs2td}z|jj}iatjd|jd}|j|jjdtd|j|tdd| |dj ||dd=|j|tdd| t |d i|j_ia|j d| |dj j |j |dd=|j`ia|j|tdd| t |d Wdn1s0YW||j_n ||j_0dS) Nzonceregistry testTrUr rBfilertrcr)rEr onceregistryrrr5r4r3r0rZrNr[r/re)r(rNZoriginal_registryrHrrrtest_onceregistry|s2    2z _WarningsTests.test_onceregistrycCsdtd}|jj}zBtjd|jd}|ji}|jj|tdd|d||dj||t |d|t |d | d ||dd=|j`i}i}|jj|tdd |d||dj||t |d|t |d |dd=d |j_i}i}|jj|tdd |d|t |dWdn1s@0YW||j_n ||j_0dS)Nzdefaultaction testTrUzrtrrcr^rdrY+rW,r) rEr defaultactionrr5r4r0rZrNr[rR)r(rNZoriginalrHrrrrrtest_default_actionsF    2z"_WarningsTests.test_default_actionc Csd}tj|jdd|jjdtd|j`td$}|j|| }Wdn1s^0YWdn1s|0Y| ||dS)Nzdel showwarning testr@rarBrS) rr5rr3rEr1rcaptured_outputr/rQrR)r(rstreamresultrrrtest_showwarning_missings  Dz'_WarningsTests.test_showwarning_missingc Csd}tj|jd|jjdtd|jj}zP|j`td$}|j|| }Wdn1sh0YW||j_n ||j_0Wdn1s0Y| ||dS)Nzdel _showwarnmsg testr@rarBrS) rr5rr3rE _showwarnmsgrrr/rQrR)r(rshowrrrrrtest_showwarnmsg_missings  (2z'_WarningsTests.test_showwarnmsg_missingc Cstj|jdx|jjdtdt|j_td|j dWdn1sT0Yd|j_| t |jj dWdn1s0YdS)Nr@rarBstdoutzWarning!) rr5rr3rEprintr1rrr/rFr{r'rrrtest_showwarning_not_callables *z,_WarningsTests.test_showwarning_not_callablec Cs8d}tj|jdb|jjdtd|j`td"}t || }Wdn1s\0YWdn1sz0Y| | ddd|| dd \}}tjtjd d }|d d }|\}} } } t| } | ||| | dtj| | d|dt|| d} | || dS)Nztest show_warningr@rarBrS rdzToo many newlines in %rr^r.py:rg z )rr5rr3rEr1rrr rrQrZcountsplitrrsplitextrrsplitintr linecachegetliner) r(rrrZ first_lineZ second_lineZ expected_fileZfirst_line_partsrlineZ warning_classrNZ expected_linerrrtest_show_warning_outputs(  D   z'_WarningsTests.test_show_warning_outputc Cst}|d}zrtjd|jd}|B}|jjdtdd|d<tdt|t|Wdn1sl0YW||d<n ||d<0dS)NrTrUrarBr) r"rr5rr3rEr/r6r[)r(Z globals_dictZoldfileZcatchrHrrrtest_filename_nones .z!_WarningsTests.test_filename_nonecCs8tdd\}}}||d|d||d|dS)Nrzjimport sys; sys.stderr = None; import warnings; warnings.simplefilter('always'); warnings.warn('Warning!')rsWarning!sError)rrZrr(rrrSrrrtest_stderr_none s    z_WarningsTests.test_stderr_nonec Csdd}|j}tj|d|jdtdt.}|jdtdd|d d d d Wdn1sf0Y|d | |j }zf|` t0}|jdtdd|d gd d d Wdn1s0Y|d| W||_ n||_ 0Wdn1s 0YdS)NcsGfddd}|S)NcseZdZfddZdS)zI_WarningsTests.test_issue31285..get_bad_loader..BadLoadercsGfdddt}|dS)NcseZdZfddZdS)zg_WarningsTests.test_issue31285..get_bad_loader..BadLoader.get_source..BadSourcecsSrKrr'splitlines_ret_valrr splitlinesszr_WarningsTests.test_issue31285..get_bad_loader..BadLoader.get_source..BadSource.splitlinesN)rrrrrrrr BadSourcesrZspam)r)r(fullnamerrrr get_sourceszT_WarningsTests.test_issue31285..get_bad_loader..BadLoader.get_sourceN)rrrrrrrr BadLoadersrr)rrrrrget_bad_loadersz6_WarningsTests.test_issue31285..get_bad_loaderr@rirBfoobarr^rtZfoobar) __loader__rryzUserWarning: fooZeggszUserWarning: eggs) rrr5r3rErrPr0rRrQr)r(rwmodrSrrrrtest_issue31285s0  $ $z_WarningsTests.test_issue31285c Cs|j}tj|d|dt|ddN|t$|jdt ddddWdn1sb0YWdn1s0YWdn1s0YdS)Nr@r rrrr^r) rrr5r3r swap_attrrFr{r0r~r(rrrrtest_issue314116s   z_WarningsTests.test_issue31411c Cs|j}tj|dddtddfg|_|t |dtddWdn1sV0Yg|_t |ddJ|t |dtddWdn1s0YWdn1s0YWdn1s0YdS)Nr@rrrr^r) rrr5r~rrFr{r0rr r rrrtest_issue31416As .z_WarningsTests.test_issue31416c Cstj|jd|jjdtdttddRttdd"|t|jj dWdn1sj0YWdn1s0YWdn1s0YdS)Nr@rArBrsfoorr) rr5rr3rErZ swap_itemr"rFr/r'rrrtest_issue31566Ps z_WarningsTests.test_issue31566N)rrrr;rrrrrrrrrrrrZ cpython_onlyr r r rrrrrls" %   $  rc@s$eZdZddZddZddZdS)WarningsDisplayTestsc Csd}t}tjtjdd}d}t||}d}||||j ||f}| ||j |||||d7}||||j ||f}| ||j |||||dS)Nrwrrrgz%s:%s: %s: %s %s z for the win!) r~rrrr rrrrrrZrr2)r(rNrC file_nameline_num file_lineformatexpectrrrtest_formatwarning`s&  z'WarningsDisplayTests.test_formatwarningcCstjtjdd}d}t||}d}t}t }|j ||||}|j |||||| |||d7}|j |||||}t }|j ||||||| ||dS)Nrrrgrwz for the win!)rrrr rrrrr~rrr2r1rZrQ)r(rrZexpected_file_linerNrC file_objectrrrrtest_showwarningrs,  z%WarningsDisplayTests.test_showwarningc Csdd}tjtjdd}d}t||}d}t}t }d|d|d |d |d |}t |j d |6|j |||||||||Wdn1s0YdS) Nc Ss"d|d|d|d|d| S)Nm=:c=:f=:l=:t=r)rNrCrxlinenorrrrmyformatwarningszIWarningsDisplayTests.test_formatwarning_override..myformatwarningrrrgrwrrrrrr2)rrrr rrrrr~rrr rr1rZrQ) r(rrrrrNrCrexpectedrrrtest_formatwarning_overridesz0WarningsDisplayTests.test_formatwarning_overrideN)rrrrrrrrrrr[src@seZdZeZdS)CWarningsDisplayTestsNr:rrrrr sr c@seZdZeZddZdS)PyWarningsDisplayTestsc Cs|tjtjttjd }|tdWdn1sB0Ydd}tj tj}|dtj}td|d }| |||ddd tj}td|d |d |d  }| ||dS) NrHz def func(): f = open(__file__) # Emit ResourceWarning f = None func() cWs<t|ddi}|jdd}d|}tdd|}|S)NPYTHONIOENCODINGutf-8replacerz<.*>z<...>)rrdecodejoinrresub)reresrSrrrruns z4PyWarningsDisplayTests.test_tracemalloc..run-Wdz z:5: ResourceWarning: unclosed file <...> f = None ResourceWarning: Enable tracemalloc to get the object allocation traceback z-Xz tracemalloc=2z:5: ResourceWarning: unclosed file <...> f = None Object allocated at (most recent call last): File "z7", lineno 7 func() File "z7", lineno 3 f = open(__file__) ) Z addCleanuprunlinkZTESTFNopenwritetextwrapdedentrrabspathrrZ)r(fpr*rxrSrrrrtest_tracemallocs&.     z'PyWarningsDisplayTests.test_tracemallocN)rrrr>rr3rrrrr!sr!c@sDeZdZddZddZddZddZd d Zd d Zd dZ dS)CatchWarningTestscCs|j}|j}|j}|j|ddt|_|_Wdn1sD0Y||j|||j||j|ddt|_|_Wdn1s0Y||j|||j|dSNTrF)rrr1r5objectr)r(r orig_filtersorig_showwarningrrrtest_catch_warnings_restores,,z-CatchWarningTests.test_catch_warnings_restorecCs.|j}|j|dd}||g|t|t|d|d|t|dj d|d|t|dj d|t|dj d|t|dj d|dd=||gWdn1s0Y|j }|j|d d(}| |||j |Wdn1s 0YdS) NTrrarrcrrr^F) rr5rZrtyper\rr/rrNr1 assertIsNone)r(rrHr8rrrtest_catch_warnings_recordings"     * z/CatchWarningTests.test_catch_warnings_recordingcCs|j}|j|dd}|t|j||t|jWdn1sJ0Y|j|dd}|t|j||t|jWdn1s0YdSr5)rr5rF RuntimeError__exit__ __enter__)r(rrmrrr!test_catch_warnings_reentry_guards,z3CatchWarningTests.test_catch_warnings_reentry_guardcCs|j}|j}|j}|j|d6}||||j|||j|Wdn1sZ0Y||j||tjdur|6}||||j|||j|Wdn1s0Y||j|dS)Nr@r ) rrr1r5r;rrr r$)r(rr7r8rHrrrtest_catch_warnings_defaultss ,  ,z.CatchWarningTests.test_catch_warnings_defaultsc sd}|j}gd fdd }t|d|n|j|dd2}||j||d||Wdn1sr0Y||j|Wdn1s0Y| t |d|| |d j j d || gdS) NThis is a warningcs|dSrKrrNrCrxrrrZmy_logrr my_loggerszLCatchWarningTests.test_record_override_showwarning_before..my_loggerr1Trrar^r)NN) rrr r5rr1rr/rrZr[rNrer(rrrElogrrDr'test_record_override_showwarning_befores (,z9CatchWarningTests.test_record_override_showwarning_beforecsd}|j}gd fdd }|j|dd*}|d||_||Wdn1sZ0Y|td|djd|||gdS) NrBcs|dSrKrrCrDrrrE6szLCatchWarningTests.test_record_override_showwarning_inside..my_loggerTrrar^r)NN)rr5rr1r/rZr[rerFrrDr'test_record_override_showwarning_inside/s (z9CatchWarningTests.test_record_override_showwarning_insidec Cs|j}|tjdur|dtjdd}||jg|d| d|t |j d| d|t |j d|t |jdj d|t |jd j d| ||jgWdn1s0YtWdn1s0Ytdt f| dWdn1s80Y|t@td tfWdn1st0YWdn1s0Y|tJtdtf| dWdn1s0YWdn1s0YdS) Nr z,module to test is not loaded warnings moduleF)quietrarrrr^r)rr r$ZskipTestrZcheck_warningsrZr rr/rrNresetrErFAssertionErrorRuntimeWarning)r(rrHrrrtest_check_warningsCs0    , * @ z%CatchWarningTests.test_check_warningsN) rrrr9r<r@rArHrIrNrrrrr4s r4c@seZdZeZdS)CCatchWarningTestsNr:rrrrrObsrOc@seZdZeZdS)PyCatchWarningTestsNr=rrrrrPesrPc@sPeZdZddZddZddZddZd d Ze e d kd d dZ dS)EnvironmentVariableTestscCs&tddddd\}}}||ddS)Nr2import sys; sys.stdout.write(str(sys.warnoptions))ignore::DeprecationWarningrPYTHONWARNINGS PYTHONDEVMODEs['ignore::DeprecationWarning']rrZrrrrtest_single_warningks  z,EnvironmentVariableTests.test_single_warningcCs&tddddd\}}}||ddS)NrrRz1ignore::DeprecationWarning,ignore::UnicodeWarningrrT8['ignore::DeprecationWarning', 'ignore::UnicodeWarning']rWrrrrtest_comma_separated_warningsrs z6EnvironmentVariableTests.test_comma_separated_warningscCs(tdddddd\}}}||ddS)Nz-Wignore::UnicodeWarningrrRrSrrTrYrWrrrrtest_envvar_and_command_linezs z5EnvironmentVariableTests.test_envvar_and_command_linecCs<tdddddd\}}}||d||gddS) Nz-Werror::DeprecationWarningrzjimport sys, warnings; sys.stdout.write(str(sys.warnoptions)); warnings.warn('Message', DeprecationWarning)zdefault::DeprecationWarningrrTs<['default::DeprecationWarning', 'error::DeprecationWarning'])s"Traceback (most recent call last):s& File "", line 1, in sDeprecationWarning: Message)rrZrrrrr(test_conflicting_envvar_and_command_lines  zAEnvironmentVariableTests.test_conflicting_envvar_and_command_linec Cs|jtu}trg}nT|r$td}nd}ddt|dfddtddfddtddfddtddfddtddfg}dd|D}|rd}nd}|d 7}t d |d d \}}}d d| D} d|_ | | |dS)N__main__rirrWcSsg|]}t|qSr)rencode)rrOrrrrrzNEnvironmentVariableTests.test_default_filter_configuration..zPimport sys; sys.modules.pop('warnings', None); sys.modules['_warnings'] = None; rz5import warnings; [print(f) for f in warnings.filters]rT)Z __isolatedcSsg|] }|qSr)r)rrrrrrr) rr>Py_DEBUGr'rDeprecationWarningPendingDeprecationWarning ImportWarningResourceWarningrrZmaxDiffrZ) r(Zpure_python_apiZexpected_default_filtersZmain_module_filterZexpected_outputcoderrrSZ stdout_linesrrr!test_default_filter_configurations*       z:EnvironmentVariableTests.test_default_filter_configurationasciiz%requires non-ascii filesystemencodingcCs<dtj}tddd|dd\}}}||t|gdS)Nzignore:DeprecationWarningrrRr#r)r"rUrV)rZ FS_NONASCIIrrZrr^)r(rUrrrSrrr test_nonasciis  z&EnvironmentVariableTests.test_nonasciiN) rrrrXrZr[r\rerZ skipUnlessr getfilesystemencodingrgrrrrrQis rQc@seZdZeZdS)CEnvironmentVariableTestsNr:rrrrrisric@seZdZeZdS)PyEnvironmentVariableTestsNr=rrrrrjsrjc@seZdZddZdS) BootstrapTestc CsvtZ}td0tdd|dtdddd|dWdn1sJ0YWdn1sh0YdS)N encodingsrr)Z PYTHONPATHz-Wra)rZtemp_cwdr)r(cwdrrrtest_issue_8766szBootstrapTest.test_issue_8766N)rrrrnrrrrrksrkc@seZdZddZddZdS)FinalizationTestcCs,d}td|\}}}||ddS)Nzk import warnings warn = warnings.warn class A: def __del__(self): warn("test") a=A() rz:7: UserWarning: test)rrZr%rstrip)r(rdrrrrrrtest_finalizations  z"FinalizationTest.test_finalizationcCshd}dt}tdd|\}}}|||t|dt}tdd|\}}}|||t|dS)Ns&sys:1: ResourceWarning: unclosed file z f = open(%a)r+rzimport warnings; f = open(%a))rrr6 startswithrf)r(rrdrrrrrrtest_late_resource_warningsz+FinalizationTest.test_late_resource_warningN)rrrrqrsrrrrrosrocCstjtjdSrK)r>rrr;rrrr setUpModules rtr]): contextlibrrriorr'r r/rrrZtest.support.script_helperrrZtest.test_warnings.datarr r rZimport_fresh_moduler>r;r#r_rr~rrr-ZTestCaser9r<r?rrrrrrrrrrr r!r4rOrPrQrirjrkrortZtearDownModulermainrrrrsf      &  #p@1P $