Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.145.86.133
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_code.pyc
�
?��cc@s�dZddlZddlZddlmZmZmZd�Zd�Zdej	fd��YZ
d�Zd	ej	fd
��YZdej	fd��YZ
dd
�Zedkr�e�ndS(s�This module includes tests of the code object representation.

>>> def f(x):
...     def g(y):
...         return x + y
...     return g
...

>>> dump(f.func_code)
name: f
argcount: 1
names: ()
varnames: ('x', 'g')
cellvars: ('x',)
freevars: ()
nlocals: 2
flags: 3
consts: ('None', '<code object g>')

>>> dump(f(4).func_code)
name: g
argcount: 1
names: ()
varnames: ('y',)
cellvars: ()
freevars: ('x',)
nlocals: 1
flags: 19
consts: ('None',)

>>> def h(x, y):
...     a = x + y
...     b = x - y
...     c = a * b
...     return c
...
>>> dump(h.func_code)
name: h
argcount: 2
names: ()
varnames: ('x', 'y', 'a', 'b', 'c')
cellvars: ()
freevars: ()
nlocals: 5
flags: 67
consts: ('None',)

>>> def attrs(obj):
...     print obj.attr1
...     print obj.attr2
...     print obj.attr3

>>> dump(attrs.func_code)
name: attrs
argcount: 1
names: ('attr1', 'attr2', 'attr3')
varnames: ('obj',)
cellvars: ()
freevars: ()
nlocals: 1
flags: 67
consts: ('None',)

>>> def optimize_away():
...     'doc string'
...     'not a docstring'
...     53
...     53L

>>> dump(optimize_away.func_code)
name: optimize_away
argcount: 0
names: ()
varnames: ()
cellvars: ()
freevars: ()
nlocals: 0
flags: 67
consts: ("'doc string'", 'None')

i����N(trun_doctesttrun_unittesttcpython_onlyccsDx=|D]5}t|�}|jd�r7d|jVq|VqWdS(s.Yield a doctest-safe sequence of object reprs.s<code objects<code object %s>N(treprt
startswithtco_name(tttelttr((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytconstsXs

cCsaxBddddddddgD]"}d	|t|d
|�fGHqWdGtt|j��GHdS(
s1Print out a text representation of a code object.tnametargcounttnamestvarnamestcellvarstfreevarstnlocalstflagss%s: %stco_sconsts:N(tgetattrttupleR	t	co_consts(tcotattr((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytdumpas tCodeTestcBseZed��ZRS(cCs^ddl}|jddd�}|j|jd�|j|jd�|j|jd�dS(Ni����tfilenametfuncnamei(t	_testcapit
code_newemptytassertEqualtco_filenameRtco_firstlineno(tselfRR((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt
test_newemptyks
(t__name__t
__module__RR"(((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyRiscCs|td|ddd!�kS(Nt_ii����(tintern(ts((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt
isinternedtstCodeConstsTestcBs_eZd�Zd�Zd�Zed��Zed��Zed��Zed��Z	RS(cCsBx|D]}||kr|SqW|j||�|jd�dS(NsShould never be reached(tassertIntfail(R!R	tvaluetv((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt
find_constys

cCs't|�s#|jd|f�ndS(NsString %r is not interned(R(R+(R!R'((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytassertIsInterned�scCs't|�r#|jd|f�ndS(NsString %r is interned(R(R+(R!R'((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytassertIsNotInterned�scCs8tddd�}|j|jd�}|j|�dS(Nsres = "str_value"t?texect	str_value(tcompileR.RR/(R!RR-((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyttest_interned_string�scCs<tddd�}|j|jd�}|j|d�dS(Nsres = ("str_value",)R1R2R3i(R3(R4R.RR/(R!RR-((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyttest_interned_string_in_tuple�scCs dd�}|j|��dS(NR3cSs|S(N((ta((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytf�s(R/(R!R8((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyttest_interned_string_default�scCs8tddd�}|j|jd�}|j|�dS(Nsres = "str\0value!"R1R2s
strvalue!(R4R.RR0(R!RR-((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyttest_interned_string_with_null�s(
R#R$R.R/R0RR5R6R9R:(((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyR)ws			tCodeWeakRefTestcBseZd�ZRS(cs�i}de�|U|d}~e�_�fd�}ej|j|�}�je|���~�je|����j�j�dS(Ns
def f(): passR8cs
t�_dS(N(tTruetcalled(tcode(R!(s5/usr/local/python-2.7/lib/python2.7/test/test_code.pytcallback�s(	tglobalstFalseR=tweakreftreft__code__t
assertTruetbooltassertFalse(R!t	namespaceR8R?tcoderef((R!s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt
test_basic�s

	(R#R$RJ(((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyR;�scCs1ddlm}t||�tttt�dS(Ni����(t	test_code(ttestRKRRRR)R;(tverboseRK((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt	test_main�s
t__main__(t__doc__tunittestRBttest.test_supportRRRR	RtTestCaseRR(R)R;tNoneRNR#(((s5/usr/local/python-2.7/lib/python2.7/test/test_code.pyt<module>Qs				*
© 2025 GrazzMean