Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_warnings.cpython-34.pyo

�
g f���@s�ddlmZddlZddlZddlmZddlZddlZddlm	Z	ddl
mZddlmZddl
Ze	jddd	g�Ze	jdd
d	g�Zedd��ZGd
d�d�ZGdd�de�ZGdd�deej�ZGdd�deej�ZGdd�de�ZGdd�deej�ZGdd�deej�ZGdd�de�ZGdd�deej�ZGdd �d eej�ZGd!d"�d"e�ZGd#d$�d$eej�ZGd%d&�d&eej�Z Gd'd(�d(eej�Z!Gd)d*�d*e�Z"Gd+d,�d,e"ej�Z#Gd-d.�d.e"ej�Z$Gd/d0�d0e�Z%Gd1d2�d2e%ej�Z&Gd3d4�d4e%ej�Z'Gd5d6�d6e�Z(Gd7d8�d8e(ej�Z)Gd9d:�d:e(ej�Z*Gd;d<�d<ej�Z+Gd=d>�d>ej�Z,d?d@�Z-e-Z.e/dAkr|ej0�ndS)B�)�contextmanagerN)�StringIO)�support)�assert_python_ok)�
warning_tests�warningsZblocked�	_warningsZfreshccs�x:ttfD],}y|jj�Wq
tk
r8Yq
Xq
Wytj�Wntk
r_YnXtj}|j}z2|dd�|_|jd�|t_dVWd|t_||_XdS)z8Use a specific warnings implementation in warning_tests.N�once)	�sysr�__warningregistry__�clear�AttributeError�	NameErrorr�filters�simplefilter)�moduleZto_clear�original_warningsZoriginal_filters�r�7/opt/alt/python34/lib64/python3.4/test/test_warnings.py�warnings_states$
	
		
			rcs:eZdZdZ�fdd�Z�fdd�Z�S)�BaseTestz'Basic bookkeeping required for testing.cs�tjj|_dt�kr+t�d=nttd�rCt`nttd�r[t`n|j	tj
d<|j	tj_tt|�j
�dS)Nrr)�unittest�caser�old_unittest_module�globals�hasattrrrr
r�modules�superr�setUp)�self)�	__class__rrr.s
		zBaseTest.setUpcs3ttjd<|jtj_tt|�j	�dS)Nr)
rr
rrrrrrr�tearDown)r)r rrr!As
zBaseTest.tearDown)�__name__�
__module__�__qualname__�__doc__rr!rr)r rr*src@s"eZdZdZdd�ZdS)�PublicAPITestszGEnsures that the correct values are exposed in the
    public API.
    cCs]|jt|jd��dddddddd	g}|jt|jj�t|��dS)
N�__all__�warn�
warn_explicit�showwarning�
formatwarning�filterwarningsr�
resetwarnings�catch_warnings)�
assertTruerrZassertSetEqual�setr')rZ
target_apirrr�test_module_all_attributeLs		z(PublicAPITests.test_module_all_attributeN)r"r#r$r%r1rrrrr&Fsr&c@seZdZeZdS)�CPublicAPITestsN)r"r#r$�
c_warningsrrrrrr2Tsr2c@seZdZeZdS)�PyPublicAPITestsN)r"r#r$�py_warningsrrrrrr4Wsr4c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�FilterTestsz$Testing the filtering functionality.cCs^tjd|j��C}|jj�|jjddt�|jt|jjd�WdQXdS)Nr�error�categoryzFilterTests.test_error)rr.rr-r,�UserWarning�assertRaisesr()r�wrrr�
test_error^s

zFilterTests.test_errorcswtjd�j��\}�jj�d���fdd�}|��jjddt��jt|�WdQXdS)Nrz%FilterTests.test_ignore_after_defaultcs�jj�t�dS)N)rr(r9r)�messagerrr�fisz/FilterTests.test_error_after_default.<locals>.fr7r8)rr.rr-r,r9r:)rr;r>r)r=rr�test_error_after_defaultes
z$FilterTests.test_error_after_defaultcCsttjddd|j��S}|jj�|jjddt�|jjdt�|jt|�d�WdQXdS)N�recordTr�ignorer8zFilterTests.test_ignorer)	rr.rr-r,r9r(�assertEqual�len)rr;rrr�test_ignoreos
zFilterTests.test_ignorecs�tjddd�j��p}�jj�d���fdd�}|��jjddt�|�|��jt|�d	�WdQXdS)
Nr@Trz%FilterTests.test_ignore_after_defaultcs�jj�t�dS)N)rr(r9r)r=rrrr>|sz0FilterTests.test_ignore_after_default.<locals>.frAr8�)rr.rr-r,r9rBrC)rr;r>r)r=rr�test_ignore_after_defaultws
z%FilterTests.test_ignore_after_defaultcCs�tjddd|j���}|jj�|jjddt�d}|jj|t�|j||dj�|jj|t�|j|d	j|�WdQXdS)
Nr@Tr�alwaysr8zFilterTests.test_alwaysrE���rH)	rr.rr-r,r9r(r/r=)rr;r=rrr�test_always�s
zFilterTests.test_alwayscs4tjddd�j��}�jj�d���fdd�}|��jt|�d��j|d
jjd��|��jt|�d��jjd	d
t	�|��jt|�d��j|djjd��|��jt|�d��j|djjd��WdQXdS)Nr@Trz$FilterTests.test_always_after_ignorecs�jj�t�dS)N)rr(r9r)r=rrrr>�sz0FilterTests.test_always_after_default.<locals>.frErrGr8��rHrHrH)
rr.rr-rBrCr=�argsr,r9)rr;r>r)r=rr�test_always_after_default�s"
z%FilterTests.test_always_after_defaultcCs�tjddd|j���}|jj�|jjddt�td�}x�td�D]}}|jj|t�|dkr�|j|dj	|�|dd�=qZ|d	kr�|jt
|�d�qZtd
��qZWWdQXdS)Nr@Tr�defaultr8zFilterTests.test_defaultrJrrEzloop variant unhandledrH)rr.rr-r,r9�ranger(rBr=rC�
ValueError)rr;r=�xrrr�test_default�s
zFilterTests.test_defaultcCs�tjddd|j���}|jj�|jjddt�td�}|jj|t�|j|dj|�|dd�=|jj|t�|jt	|�d�WdQXdS)	Nr@Trr8zFilterTests.test_modulerErrH)
rr.rr-r,r9r(rBr=rC)rr;r=rrr�test_module�s

zFilterTests.test_modulecCs�tjddd|j���}|jj�|jjddt�td�}|jj|tdd�|j|d
j|�|dd�=|jj|tdd
�|jt	|�d�|jj|tdd�|jt	|�d�WdQXdS)Nr@Trr	r8zFilterTests.test_onceztest_warnings.py�*rE�
rztest_warnings2.pyrH)
rr.rr-r,r9r)rBr=rC)rr;r=rrr�	test_once�s

zFilterTests.test_oncecCsatjd|j��F}|jj�|jjddt�|jt|jjdt�WdQXdS)Nrr7r8zFilterTests.test_inheritance)	rr.rr-r,�Warningr:r9r()rr;rrr�test_inheritance�s

zFilterTests.test_inheritancecCs�tjddd|j���}|jj�|jjddt�|jjddtdd�|dd�=y|jjdt�Wntk
r�|jd	�YnX|jt	|�d
�WdQXdS)Nr@TrrAr8r7�appendzFilterTests.test_orderingz!order handling for actions failedr)
rr.rr-r,r9r(ZfailrBrC)rr;rrr�
test_ordering�s


zFilterTests.test_orderingc
Cs�tjddd|j��t}|jjddtdd�|jt|jjd�|jj�d}|jj|�|j	t
|dj�|�|j|dj
tk�|jjd
dtdd�d}|jj|�|jt
|dj�|�|jj�|jjddtdd�|jt|jjd
�d}|jj|�|j	t
|dj�|�|j|dj
tk�WdQXdS)Nr@Trr7�rzconvert to errorzhandle normallyrErAzfiltered outzhex*zhex/octznonmatching textrHrHrHrHrH)rr.rr,rWr:r9r(r-rB�strr=r/r8ZassertNotEqual)rr;�textrrr�test_filterwarnings�s(

zFilterTests.test_filterwarningscs�G�fdd�d���fdd�td�D��tjddd|j��O}�|j_|jjtd	�dd
d�|jt|d
j	�d	�WdQXdS)Ncs"eZdZ�fdd�ZdS)z.FilterTests.test_mutate_filter_list.<locals>.Xcsg�dd�<dS)Nr)r�a)�Lrr�matchsz4FilterTests.test_mutate_filter_list.<locals>.X.matchN)r"r#r$rar)r`rr�Xsrbcs+g|]!}d��t��df�qS)rNr)r9)�.0�i)rbrr�
<listcomp>s	z7FilterTests.test_mutate_filter_list.<locals>.<listcomp>rJr@Tr�bzf.pyrTrErH)
rOrr.rrr)r9rBr\r=)rr;r)r`rbr�test_mutate_filter_listsz#FilterTests.test_mutate_filter_listN)r"r#r$r%r<r?rDrFrIrMrRrSrVrXrZr^rgrrrrr6Zs

r6c@seZdZeZdS)�CFilterTestsN)r"r#r$r3rrrrrrhsrhc@seZdZeZdS)�
PyFilterTestsN)r"r#r$r5rrrrrrisric@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	j
eed�d
�dd��Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�	WarnTestsz2Test warnings.warn() and warnings.warn_explicit().cCs�tjddd|j��}|jjd�xetd�D]W}d|}|jj|�|jt|dj�|�|j	|d	j
tk�q;WWdQXdS)
Nr@Trr	�zmulti %drErHrH)rr.rrrOr(rBr\r=r/r8r9)rr;rdr]rrr�test_messages
zWarnTests.test_messagec
Cs�x�tddfD]s}tjddd|j��P}|jjd�|jj|�|jt|dj�tt	|���WdQXqWdS)NrTr@Trr	rErH)
rWrr.rrr(rBr\r=r9)r�obr;rrr�test_warn_nonstandard_types"sz%WarnTests.test_warn_nonstandard_typescCs�t|j���tjddd|j��g}tjd�|jtjj	|dj
�d�tjd�|jtjj	|d	j
�d�WdQXWdQXdS)
Nr@TrZspam1rEzwarning_tests.pyZspam2rHrH)rrrr.r�innerrB�os�path�basename�filename�outer)rr;rrr�
test_filename-s

zWarnTests.test_filenamecCs�t|j��mtjddd|j��K}tjddd�|jtjj	|dj
�d�tjddd�|jtjj	|dj
�d�tjd	dd
�|jtjj	|dj
�d�tjddd
�|jtjj	|dj
�d�tjd
dd�|jtjj	|dj
�d�tjddd�|jtjj	|dj
�d�WdQXWdQXdS)Nr@TrZspam3�
stacklevelrEzwarning_tests.pyZspam4Zspam5rJztest_warnings.pyZspam6zspam6.5rKZspam7i'r
rHrHrHrHrHrH)rrrr.rrorBrprqrrrsrt)rr;rrr�test_stacklevel8s*zWarnTests.test_stacklevelcCs�tj}zqt`t|j��Vtjddd|j��4}tjddd�|j|djtj	�WdQXWdQXWd|t_XdS)Nr@TrZspam8rvrErH)
r�__file__rrrr.rorBrsr")rrsr;rrr�test_missing_filename_not_mainSs	*z(WarnTests.test_missing_filename_not_main�argvztest needs sys.argvcCs�tj}tj}z~t`dt_t|j��Ztjddd|j��8}tjddd�|j|d	j	t
jd�WdQXWdQXWd|t_|t_XdS)
N�__main__r@TrZspam9rvrErrH)rrxr"rrrr.rorBrsr
rz)rrs�module_namer;rrr�$test_missing_filename_main_with_argvas			.	z.WarnTests.test_missing_filename_main_with_argvcCs�tj}tj}tj}z}t`dt_t`t|j��Stjddd|j��1}tj	ddd�|j
|djd�WdQXWdQXWd|t_|t_|t_XdS)	Nr{r@TrZspam10rvrErH)rrxr"r
rzrrrr.rorBrs)rrsr|rzr;rrr�'test_missing_filename_main_without_argvss				'		z1WarnTests.test_missing_filename_main_without_argvcCs�tj}tj}tj}z�t`dt_dgt_t|j��Stjddd|j��1}tj	ddd�|j
|d	jd�WdQXWdQXWd|t_|t_|t_XdS)
Nr{r[r@TrZspam11rvrErH)rrxr"r
rzrrrr.rorBrs)r�	file_namer|rzr;rrr�1test_missing_filename_main_with_argv_empty_string�s				'		z;WarnTests.test_missing_filename_main_with_argv_empty_stringcCs�tjddd|j���}|jj�|jjddt�xgd
D]_}ytj|�Wntk
rvwHYnX|jj	dt|d	�|j
|dj|�qHWWdQXdS)Nr@TrrGr8�
nonascii�surrogate�r]rE)r�r�rH)rr.rr-r,r9rp�fsencode�UnicodeEncodeErrorr)rBrs)rr;rsrrr�%test_warn_explicit_non_ascii_filename�s


z/WarnTests.test_warn_explicit_non_ascii_filenamec	Csv|jt|jjdtdd�|jt|jjdddd�|jttf|jjdtdddd�dS)NrE�registryrT)r:�	TypeErrorrr)r9r
rW)rrrr�test_warn_explicit_type_errors�s	z(WarnTests.test_warn_explicit_type_errorsc	CsCGdd�dt�}|jt��|jj|��WdQXdS)Nc@s"eZdZdZdd�ZdS)z-WarnTests.test_bad_str.<locals>.BadStrWarningz-Warning with a bad format string for __str__.cSsdidd6S)NzA bad formatted string %(err)zthere is no %(err)s�errr)rrrr�__str__�sz5WarnTests.test_bad_str.<locals>.BadStrWarning.__str__N)r"r#r$r%r�rrrr�
BadStrWarning�sr�)rWr:rPrr()rr�rrr�test_bad_str�szWarnTests.test_bad_strN)r"r#r$r%rlrnrurwryr�
skipUnlessrr
r}r~r�r�r�r�rrrrrjs'
rjc@s"eZdZeZdd�ZdS)�
CWarnTestscCs6|jt|jk�|jt|jjd��dS)N�__code__)�assertFalserrrr()rrrr�test_accelerated�szCWarnTests.test_acceleratedN)r"r#r$r3rr�rrrrr��sr�c@s"eZdZeZdd�ZdS)�PyWarnTestscCs6|jt|jk�|jt|jjd��dS)Nr�)r�rrr/rr()rrrr�test_pure_python�szPyWarnTests.test_pure_pythonN)r"r#r$r5rr�rrrrr��sr�c@s4eZdZdd�Zdd�Zdd�ZdS)�
WCmdLineTestscCs�tjd|j���|j|jj|jjd�|j|jj|jjd�|j|jj|jjd�|jjd�|jt|jjd�WdQXdS)Nrz1:2:3:4:5:6zbogus::Warningzignore:2::4:-5zerror::Warning::0zconvert to error)rr.rr:�_OptionError�
_setoptionr9r()rrrr�test_improper_input�sz!WCmdLineTests.test_improper_inputcCs/tddd�\}}}|jd|�dS)Nz-Wxxxz-c�passs0Invalid -W option ignored: invalid action: 'xxx')r�assertIn)r�rc�outr�rrr�test_improper_option�sz"WCmdLineTests.test_improper_optioncCsBtddd�\}}}|j|j��|jd|�dS)Nz-Wiz-cz?import sys; sys.modules['warnings'].warn('foo', RuntimeWarning)sRuntimeWarning)rr��strip�assertNotIn)rr�r�r�rrr�test_warnings_bootstrap�s	z%WCmdLineTests.test_warnings_bootstrapN)r"r#r$r�r�r�rrrrr��s
r�c@seZdZeZdS)�CWCmdLineTestsN)r"r#r$r3rrrrrr��sr�c@seZdZeZdS)�PyWCmdLineTestsN)r"r#r$r5rrrrrr��sr�c@s|eZdZdZeZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dS)�_WarningsTestsz'Tests specific to the _warnings module.c
Csytjd|j��^}|jjddtdd�|jt|jjd�|j`|jt|jjd�WdQXdS)Nrr7r[rzconvert to error)	rr.rr,rWr:r9r(r)rr;rrr�test_filters	z_WarningsTests.test_filtercCsstd�}zS|jj}iatjddd|j�� }|jj�|jjddt�|jj|tdd�|j	|dj
|�|dd�=|jj|tdd�|j	t|�d
�i|j_ia|jjd�|j	|dj
j
|j
�|dd�=|j`ia|jj|tdd�|j	t|�d
�WdQXWd||j_XdS)
Nzonceregistry testr@Trr	r8�filerTrErrHrH)r9r�onceregistryrrr.r-r,r)rBr=rCr(rL)rr=Zoriginal_registryr;rrr�test_onceregistrys.


	 z _WarningsTests.test_onceregistrycCs�td�}|jj}z�tjddd|j��j}|jj�i}|jj|tddd|�|j|dj|�|jt	|�d�|jt	|�d	�|j
d
|�|dd�=|j`i}i}|jj|tddd|�|j|dj|�|jt	|�d�|jt	|�d	�|dd�=d|j_i}i}|jj|tdd
d|�|jt	|�d�WdQXWd||j_XdS)Nzdefaultaction testr@Trz<test>rTr�rErJ�version�+rA�,rrHrH)r9r�
defaultactionrr.r-r)rBr=rCr�)rr=Zoriginalr;r�rrrr�test_default_action-s<

	
 z"_WarningsTests.test_default_actioncCs�d}tjd|j��X|jjddt�|j`tjd��#}|jj|�|j	�}WdQXWdQX|j
||�dS)Nzdel showwarning testrrGr8�stderr)rr.rr,r9r*r�captured_outputr(�getvaluer�)rr]�stream�resultrrr�test_showwarning_missingRs	z'_WarningsTests.test_showwarning_missingcCs�tjd|j��r|jjddt�t|j_tjd��|jj	d�WdQXd|j_|j
t|jj	d�WdQXdS)NrrGr8�stdoutzWarning!�)rr.rr,r9�printr*rr�r(r:r�)rrrr�test_showwarning_not_callable]sz,_WarningsTests.test_showwarning_not_callablec
Csfd}tjd|j��U|jjddt�|j`tjd�� }tj	|�|j
�}WdQXWdQX|j|jd�dd|�|j
dd	�\}}tjjtj�d
d}|jdd
�}|\}}	}
}t|	�}	|j||�|j|
dtj�|j|d|�dtj||	�j�d}|j||�dS)Nztest show_warningrrGr8r��
rJzToo many newlines in %rrErz.py�:rK� z  )rr.rr,r9r*rr�rror�rB�count�splitrprq�splitextrx�rsplit�intr"�	linecache�getliner�)
rr]r�r�Z
first_lineZsecond_lineZ
expected_fileZfirst_line_partsrq�lineZ
warning_classr=Z
expected_linerrr�test_show_warning_outputfs&	
 z'_WarningsTests.test_show_warning_outputcCs�t�}|d}zqtjddd|j�}|�J}|jjddt�d|d<tjdt�|jt|��WdQXWd||d<XdS)Nrxr@TrrGr8�test)	rrr.rr,r9r(r/rC)rZglobals_dictZoldfileZcatchr;rrr�test_filename_none}s	
	
z!_WarningsTests.test_filename_nonecCsLtdd�\}}}|j|d�|jd|�|jd|�dS)Nz-czjimport sys; sys.stderr = None; import warnings; warnings.simplefilter('always'); warnings.warn('Warning!')�sWarning!sError)rrBr�)rr�r�r�rrr�test_stderr_none�s
z_WarningsTests.test_stderr_noneN)r"r#r$r%r3rr�r�r�r�r�r�r�r�rrrrr��s
%	r�c@s.eZdZdZdd�Zdd�ZdS)�WarningsDisplayTestsziTest the displaying of warnings and the ability to overload functions
    related to displaying warnings.cCs�d}t}tjjtj�dd}d}tj||�j�}d}||||j	||f}|j
||jj||||��|d7}||||j	||f}|j
||jj|||||��dS)N�msgrz.pyrKz%s:%s: %s: %s
  %s
z
 for the win!)
rWrprqr�rrxr�r�r�r"rBrr+)rr=r8r�line_numZ	file_line�format�expectrrr�test_formatwarning�s


z'WarningsDisplayTests.test_formatwarningcCstjjtj�dd}d}tj||�j�}d}t}t	�}|j
j||||�}|j
j|||||�|j
|j�|�|d7}|j
j|||||�}t	�}|j
j||||||�|j
||j��dS)Nrz.pyrKr�zfor the win!)rprqr�rrxr�r�r�rWrrr+r*rBr�)rrr�Zexpected_file_liner=r8Zfile_objectr�rrr�test_showwarning�s$		
	
z%WarningsDisplayTests.test_showwarningN)r"r#r$r%r�r�rrrrr��sr�c@seZdZeZdS)�CWarningsDisplayTestsN)r"r#r$r3rrrrrr��sr�c@seZdZeZdS)�PyWarningsDisplayTestsN)r"r#r$r5rrrrrr��sr�c@sReZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�CatchWarningTestszTest catch_warnings().cCs�|j}|j}|j}|jd|dd��t�|_|_WdQX|j|j|k�|j|j|k�|jd|dd��t�|_|_WdQX|j|j|k�|j|j|k�dS)Nrr@TF)rrr*r.�objectr/)r�wmod�orig_filters�orig_showwarningrrr�test_catch_warnings_restore�s			z-CatchWarningTests.test_catch_warnings_restorecCsb|j}|jd|dd���}|j|g�|jt|�tk�|jd�|jd�|jt|d
j	�d�|jd�|jt|dj	�d�|jt|dj	�d�|jt|dj	�d�|dd�=|j|g�WdQX|j
}|jd|dd	��0}|j|dk�|j|j
|k�WdQXdS)Nrr@TrG�foorE�barrFrHrH)rr.rBr/�type�listrr(r\r=r*)rr�r;r�rrr�test_catch_warnings_recording�s"	



	z/CatchWarningTests.test_catch_warnings_recordingcCs�|j}|jd|dd�}|jt|j�|�|jt|j�WdQX|jd|dd�}|jt|j�|�|jt|j�WdQXdS)Nrr@TF)rr.r:�RuntimeError�__exit__�	__enter__)rr�rQrrr�!test_catch_warnings_reentry_guard�s	z3CatchWarningTests.test_catch_warnings_reentry_guardcCs|j}|j}|j}|jd|��F}|j|dk�|j|j|k�|j|j|k	�WdQX|j|j|k�|tjdkr|j��F}|j|dk�|j|j|k�|j|j|k	�WdQX|j|j|k�ndS)Nrr)rrr*r.r/r
r)rr�r�r�r;rrr�test_catch_warnings_defaults�s			z.CatchWarningTests.test_catch_warnings_defaultsc.Cs�|j}|tjdk	r,|jd�ntjdd���}|j|jg�|jd�|j	d�|jt
|j�d�|j	d�|jt
|j�d�|jt
|jdj�d�|jt
|jd	j�d�|j�|j|jg�WdQXtj��WdQXtjdt
f��|j	d�WdQX|jt��!tjd
tf��WdQXWdQX|jt��.tjdtf��|j	d�WdQXWdQXdS)Nrz,module to test is not loaded warnings module�quietFrGr�r�rrEr[)rr
rZskipTestrZcheck_warningsrBrrr(r\r=�resetr9r:�AssertionError�RuntimeWarning)rr�r;rrr�test_check_warningss0	


  

z%CatchWarningTests.test_check_warningsN)	r"r#r$r%r�r�r�r�r�rrrrr��s
r�c@seZdZeZdS)�CCatchWarningTestsN)r"r#r$r3rrrrrr�/sr�c@seZdZeZdS)�PyCatchWarningTestsN)r"r#r$r5rrrrrr�2sr�c@s^eZdZdd�Zdd�Zdd�Zejej	�dkd�d	d
��Z
dS)�EnvironmentVariableTestscCs2tdddd�\}}}|j|d�dS)Nz-cz2import sys; sys.stdout.write(str(sys.warnoptions))�PYTHONWARNINGSzignore::DeprecationWarnings['ignore::DeprecationWarning'])rrB)rr�r�r�rrr�test_single_warning8sz,EnvironmentVariableTests.test_single_warningcCs2tdddd�\}}}|j|d�dS)Nz-cz2import sys; sys.stdout.write(str(sys.warnoptions))r�z1ignore::DeprecationWarning,ignore::UnicodeWarnings8['ignore::DeprecationWarning', 'ignore::UnicodeWarning'])rrB)rr�r�r�rrr�test_comma_separated_warnings>s
	z6EnvironmentVariableTests.test_comma_separated_warningscCs5tddddd�\}}}|j|d�dS)Nz-Wignore::UnicodeWarningz-cz2import sys; sys.stdout.write(str(sys.warnoptions))r�zignore::DeprecationWarnings8['ignore::UnicodeWarning', 'ignore::DeprecationWarning'])rrB)rr�r�r�rrr�test_envvar_and_command_lineEs
		z5EnvironmentVariableTests.test_envvar_and_command_line�asciiz%requires non-ascii filesystemencodingcCsAtdddddd�\}}}|j|djd��dS)Nz-cz2import sys; sys.stdout.write(str(sys.warnoptions))ZPYTHONIOENCODINGzutf-8r�uignore:DeprecaciónWarningu['ignore:DeprecaciónWarning'])rrB�encode)rr�r�r�rrr�
test_nonasciiLs	z&EnvironmentVariableTests.test_nonasciiN)r"r#r$r�r�r�rr�r
�getfilesystemencodingr�rrrrr�6s
r�c@seZdZeZdS)�CEnvironmentVariableTestsN)r"r#r$r3rrrrrr�Vsr�c@seZdZeZdS)�PyEnvironmentVariableTestsN)r"r#r$r5rrrrrr�Ysr�c@seZdZdd�ZdS)�
BootstrapTestcCs[tj��I}tjd��1tddd|�tddddd|�WdQXWdQXdS)N�	encodingsz-cr��
PYTHONPATHz-WrG)rZtemp_cwdr)r�cwdrrr�test_issue_8766^szBootstrapTest.test_issue_8766N)r"r#r$r�rrrrr�]sr�c@s7eZdZejeed�d�dd��ZdS)�FinalizationTestZ	getcountsz*types are immortal if COUNT_ALLOCS is usedcCs2d}td|�\}}}|j|d�dS)Nzk
import warnings
warn = warnings.warn

class A:
    def __del__(self):
        warn("test")

a=A()
        z-cs__main__:7: UserWarning: test)rrB)r�coder�r�r�rrr�test_finalizationjsz"FinalizationTest.test_finalizationN)r"r#r$rZskipIfrr
r�rrrrr�isr�cCstjj�tjj�dS)N)r5r�rr3rrrr�setUpModules
r�r{)1�
contextlibrr�rp�iorr
rr�rZtest.script_helperrrrrZimport_fresh_moduler5r3rrr&ZTestCaser2r4r6rhrirjr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�ZtearDownModuler"�mainrrrr�<module>sR��	
�,f