Your IP : 216.73.216.213


Current Path : /opt/alt/python33/lib64/python3.3/test/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/test/__pycache__/test_capi.cpython-33.pyo

�
��f=7c@s�ddlZddlZddlZddlZddlZddlZddlZddlmZyddl	Z	Wne
k
r�dZ	YnXyddlZWne
k
r�dZYnXej
d�Zdd�ZGdd�d�ZGdd	�d	ej�Zejed
�Gdd�dej��ZGd
d�dej�ZGdd�dej�ZGdd�dej�Zejed
�Gdd�dej��ZGdd�dej�Zedkr�ej�ndS(iN(usupportu	_testcapicCs|S(usome doc((uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutestfunctionsutestfunctioncBs2|EeZdZeje�Zeje�ZdS(uInstanceMethodN(u__name__u
__module__u__qualname__u	_testcapiuinstancemethoduidutestfunction(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuInstanceMethodsuInstanceMethodcBs�|EeZdZdd�Zejed�dd��Zdd�Zdd	�Z	eje
d
�dd��Zeje
d
�d
d��ZdS(uCAPITestcCs�t�}|jt|�|j��|j|j�|k�|j|jjtj�|jtjjtj�dtj_|jtjd�|jtt	|jdd�dS(Nutestu	attribute(
uInstanceMethoduassertEqualuidu
assertTrueutestfunctionu__doc__u	attributeuassertRaisesuAttributeErrorusetattr(uselfuinst((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_instancemethod"s	uCAPITest.test_instancemethodu!Threading required for this test.c
Cs�tj��2tjtjddgdtjdtj�}WdQX|j�\}}|j|d�|j	|j
�jd��dS(Nu-cu4import _testcapi;_testcapi.crash_no_current_thread()ustdoutustderrss8Fatal Python error: PyThreadState_Get: no current thread(usupportusuppress_crash_popupu
subprocessuPopenusysu
executableuPIPEucommunicateuassertEqualu
assertTrueurstripu
startswith(uselfupuoutuerr((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu test_no_FatalError_infinite_loop-s
		u)CAPITest.test_no_FatalError_infinite_loopcCs|jttj�dS(N(uassertRaisesu
ValueErroru	_testcapiu!make_memoryview_from_NULL_pointer(uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu!test_memoryview_from_NULL_pointer<su*CAPITest.test_memoryview_from_NULL_pointerc
Cs+td�}td�}y
|�Wn�tk
r}z�|j}tj�}tj|j|d�}tj�}tj|�}tj�}	|j	|d|�|j
||j||f�|j
||�|j
|	|�|j
||j|df�|j
||�WYdd}~XnX|jd�dS(Nu5uTESTiF(
u
ValueErroru	TypeErroru
__traceback__usysuexc_infou	_testcapiuset_exc_infou	__class__uNoneuassertEqualuassertSequenceEqualu
assertTrueuFalse(
uselfuraised_exceptionunew_excueutbuorig_sys_exc_infou
orig_exc_infounew_sys_exc_infounew_exc_infoureset_sys_exc_info((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu
test_exc_info?s$
	#uCAPITest.test_exc_infou(_posixsubprocess required for this test.cCs�Gdd�dt�}|jttjd|�dddgdddd	d
ddd
ddddd�Gdd�dt�}|jttjd|�dddgdddd	d
ddd
ddddd�dS(NcBs |EeZdZdd�ZdS(u1CAPITest.test_seq_bytes_to_charp_array.<locals>.ZcSsdS(Ni((uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu__len__Zsu9CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__len__N(u__name__u
__module__u__qualname__u__len__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuZYsuZiiiiiiii	i
iii
iiiicBs,|EeZdZdd�Zdd�ZdS(u1CAPITest.test_seq_bytes_to_charp_array.<locals>.ZcSstjS(N(usysumaxsize(uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu__len__`su9CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__len__cSsdS(Nsx((uselfui((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu__getitem__bsu=CAPITest.test_seq_bytes_to_charp_array.<locals>.Z.__getitem__N(u__name__u
__module__u__qualname__u__len__u__getitem__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuZ_s(uobjectuassertRaisesu	TypeErroru_posixsubprocessu	fork_execuMemoryError(uselfuZ((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_seq_bytes_to_charp_arrayVs@u&CAPITest.test_seq_bytes_to_charp_arraycCslGdd�dt�}|jttj|�dgdddgddd	d
ddd
dddddd�dS(NcBs |EeZdZdd�ZdS(u-CAPITest.test_subprocess_fork_exec.<locals>.ZcSsdS(Ni((uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu__len__jsu5CAPITest.test_subprocess_fork_exec.<locals>.Z.__len__N(u__name__u
__module__u__qualname__u__len__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuZisuZs1iiiiiiii	i
iii
iiii(uobjectuassertRaisesu	TypeErroru_posixsubprocessu	fork_exec(uselfuZ((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_subprocess_fork_execgsu"CAPITest.test_subprocess_fork_execN(
u__name__u
__module__u__qualname__utest_instancemethoduunittestu
skipUnlessu	threadingu test_no_FatalError_infinite_loopu!test_memoryview_from_NULL_pointeru
test_exc_infou_posixsubprocessutest_seq_bytes_to_charp_arrayutest_subprocess_fork_exec(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuCAPITest suCAPITestu!Threading required for this test.cBs_|EeZdZdd�Zd
dd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S(uTestPendingCallscs]�fdd�}xDt|�D]6}tjtj�d�xtj|�r?Pq?q?qWdS(Ncs�jd�dS(N(uappenduNone((ul(u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyucallbackusu6TestPendingCalls.pendingcalls_submit.<locals>.callbackg{�G�z�?(urangeutimeusleepurandomu	_testcapiu_pending_threadfunc(uselfulunucallbackui((ulu3/opt/alt/python33/lib64/python3.3/test/test_capi.pyupendingcalls_submittsu$TestPendingCalls.pendingcalls_submitcCs�d}x�t|�|kr�drDtjrDtdt|�f�nxtd�D]}||}qQW|r�|jj�r�q	n|d7}|j|dkd|t|�f�q	Wdr�tjr�tdt|�f�ndS(Niu(%i)i�ii'u(timeout waiting for %i callbacks, got %iF(	ulenuFalseusupportuverboseuprinturangeueventuis_setu
assertTrue(uselfulunucontextucountuiua((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyupendingcalls_wait�s
u"TestPendingCalls.pendingcalls_waitcCs�d}g}Gdd�dt�}|�}g|_d|_||j|_d|_tj�|_tj�|_	xLt
|j�D];}tjd|jd|f�}|j
�|j|�q�W|j|j||�x|D]}|j�q�WdS(Ni cBs|EeZdZdS(u8TestPendingCalls.test_pendingcalls_threaded.<locals>.fooN(u__name__u
__module__u__qualname__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyufoo�sufooiiutargetuargs(uobjectulununThreadsu	nFinishedu	threadinguLockulockuEventueventurangeuThreadupendingcalls_threadustartuappendupendingcalls_waitujoin(uselfunuthreadsufooucontextuiut((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_pendingcalls_threaded�s"				

u+TestPendingCalls.test_pendingcalls_threadedcCs�z|j|j|j�Wd|j�<|jd7_|j}dr^tjr^td|�nWdQX||j	kr�|j
j�nXdS(Niufinished threads: F(upendingcalls_submitulunulocku	nFinisheduFalseusupportuverboseuprintunThreadsueventuset(uselfucontextu	nFinished((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyupendingcalls_thread�s
	u$TestPendingCalls.pendingcalls_threadcCs0g}d}|j||�|j||�dS(Ni@(upendingcalls_submitupendingcalls_wait(uselfulun((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_pendingcalls_non_threaded�su/TestPendingCalls.test_pendingcalls_non_threadedcCs�ddl}tj�\}}dj|�}t|d��g}tj|�}|j|d�|jt	j
|�ttj
��|jt	j
|�t|��WdQXdS(Niu�if 1:
            import sys, builtins, pickle
            with open({:d}, "wb") as f:
                pickle.dump(id(sys.modules), f)
                pickle.dump(id(builtins), f)
            urb(ubuiltinsuosupipeuformatuopenu	_testcapiurun_in_subinterpuassertEqualuassertNotEqualupickleuloaduidusysumodules(uselfubuiltinsuruwucodeufuret((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_subinterps�s"u TestPendingCalls.test_subinterpsN(
u__name__u
__module__u__qualname__upendingcalls_submituNoneupendingcalls_waitutest_pendingcalls_threadedupendingcalls_threadutest_pendingcalls_non_threadedutest_subinterps(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuTestPendingCallsqs
uTestPendingCallscBs |EeZdZdd�ZdS(uTest6012cCs |jtjdd�d�dS(NuHellouWorldi(uassertEqualu	_testcapiu
argparsing(uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest�su
Test6012.testN(u__name__u
__module__u__qualname__utest(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuTest6012�suTest6012cBs>|EeZdZejejjd�d�dd��ZdS(u
EmbeddingTestuwinutest doesn't work under WindowscCs,tjjtjjtjjt���}tj�}tj|�z�tjj|dd�}tjj|�s�|jd|�nt	j
|gdt	jdt	j�}|j�\}}|j
|jdd|j|f�tjrt�t|jd��t|jd��nWdtj|�XdS(	NuModulesu
_testembedu%r doesn't existustdoutustderriubad returncode %d, stderr is %rulatin1(uosupathudirnameu__file__ugetcwduchdirujoinuexistsuskipTestu
subprocessuPopenuPIPEucommunicateuassertEqualu
returncodeusupportuverboseuprintudecode(uselfubasepathuoldcwduexeupuoutuerr((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_subinterps�s&*
		uEmbeddingTest.test_subinterpsN(	u__name__u
__module__u__qualname__uunittestuskipIfusysuplatformu
startswithutest_subinterps(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu
EmbeddingTest�su
EmbeddingTestcBs,|EeZdZdd�Zdd�ZdS(uSkipitemTestc"Cs�f}d}idd6}ddg}xytdd�D]h}t|�}|dkrYq5n|d}y)tj|||jd	�|�d}Wngtk
r�}	zd
}
t|	�|
k}WYdd}	~	Xn+tk
r�}	zd}WYdd}	~	XnXd|}y)tj|||jd	�|�d}WnFtk
rq}	z&d
j	|�}
t|	�|
k}WYdd}	~	XnXdj	||||�}
|j
|||
�q5WdS(uA
        If this test failed, you probably added a new "format unit"
        in Python/getargs.c, but neglected to update our poor friend
        skipitem() in the same file.  (If so, shame on you!)

        With a few exceptions**, this function brute-force tests all
        printable ASCII*** characters (32 to 126 inclusive) as format units,
        checking to see that PyArg_ParseTupleAndKeywords() return consistent
        errors both when the unit is attempted to be used and when it is
        skipped.  If the format unit doesn't exist, we'll get one of two
        specific error messages (one for used, one for skipped); if it does
        exist we *won't* get that error--we'll get either no error or some
        other error.  If we get the specific "does not exist" error for one
        test and not for the other, there's a mismatch, and the test fails.

           ** Some format units have special funny semantics and it would
              be difficult to accomodate them here.  Since these are all
              well-established and properly skipped in skipitem() we can
              get away with not testing them--this test is really intended
              to catch *new* format units.

          *** Python C source files must be ASCII.  Therefore it's impossible
              to have non-ASCII format units.

        iiubuai iu()e|$uiuasciiu7argument 1 must be impossible<bad format char>, not intNu|u!impossible<bad format char>: '{}'u�test_skipitem_parity: detected mismatch between convertsimple and skipitem for format unit '{}' ({}), not skipped {}, skipped {}(iF(urangeuchru	_testcapiuparse_tuple_and_keywordsuencodeuFalseu	TypeErrorustruRuntimeErroruformatuassertIs(uselfuempty_tupleutuple_1udict_bukeywordsuiucuformatuwhen_not_skippedueusuoptional_formatuwhen_skippedumessage((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu
test_skipitem�s:


$

%uSkipitemTest.test_skipitemcCs�|jttjfidg�|jttjfidd�|jttjfiddgd�|jttjfiddg�dS(Ni*su(uassertRaisesu	TypeErroru	_testcapiuparse_tuple_and_keywordsu
ValueError(uself((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_parse_tuple_and_keywords?su*SkipitemTest.test_parse_tuple_and_keywordsN(u__name__u
__module__u__qualname__u
test_skipitemutest_parse_tuple_and_keywords(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuSkipitemTest�sEuSkipitemTestcBs)|EeZdZejdd��ZdS(uTestThreadStatecsC�fdd�}|�tjd|�}|j�|j�dS(Ncsbg��fdd�}tj|�|}}tjd��j�jtj��dd�dS(Ncs�jtj��dS(N(uappendu	threadingu	get_ident((uidents(u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyucallbackSsuCTestThreadState.test_thread_state.<locals>.target.<locals>.callbackiiu/Couldn't find main thread correctly in the list(u	_testcapiu_test_thread_stateutimeusleepuassertEqualucountu	threadingu	get_ident(ucallbackuaub(uself(uidentsu3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutargetPs


u1TestThreadState.test_thread_state.<locals>.targetutarget(u	threadinguThreadustartujoin(uselfutargetut((uselfu3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest_thread_stateMs


u!TestThreadState.test_thread_stateN(u__name__u
__module__u__qualname__usupportureap_threadsutest_thread_state(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyuTestThreadStateJsuTestThreadStatecBs |EeZdZdd�ZdS(u
Test_testcapicCsCx<tt�D].}|jd�r
tt|�}|�q
q
WdS(Nutest_(udiru	_testcapiu
startswithugetattr(uselfunameutest((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyutest__testcapicsuTest_testcapi.test__testcapiN(u__name__u
__module__u__qualname__utest__testcapi(u
__locals__((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu
Test_testcapibsu
Test_testcapiu__main__(uosupickleurandomu
subprocessusysutimeuunittestutestusupportu_posixsubprocessuImportErroruNoneu	threadingu
import_moduleu	_testcapiutestfunctionuInstanceMethoduTestCaseuCAPITestu
skipUnlessuTestPendingCallsuTest6012u
EmbeddingTestuSkipitemTestuTestThreadStateu
Test_testcapiu__name__umain(((u3/opt/alt/python33/lib64/python3.3/test/test_capi.pyu<module>s:

QbR