§
x<ˆj ã ó^ — d dl Z d dlmZ d dlmZ G d„ de¦ « Z G d„ de¦ « ZdS )é N)Úchecker)ÚTestCasec ó@ — e Zd ZdZed„ ¦ « Zd„ Zd„ Zd„ Zd„ Z dS )ÚTypeableVisitorTestsz&
Tests of L{_TypeableVisitor}
c ó~ — t j | ¦ « }t j ¦ « }| |¦ « |S )zV
Run L{_TypeableVisitor} on the parsed source and return the visitor.
)ÚastÚparser Ú_TypeableVisitorÚvisit)ÚsÚtreeÚvisitors úl/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/pyflakes/test/test_checker.pyÚ_run_visitorz!TypeableVisitorTests._run_visitor s6 € õ
Œy˜‰|Œ|ˆÝÔ*Ñ,Ô,ˆØ�
Š
�dÑÔÐØˆó c ó — | d¦ « }| |j g d¢¦ « | |j d t
j ¦ « | |j d t
j ¦ « | |j d t
j ¦ « | |j d t
j ¦ « dS )zA
Test that the typeable node types are collected
z�x = 1 # assignment
for x in range(1): pass # for loop
def f(): pass # function definition
with a as b: pass # with statement
)é é é é r r r r N)
r ÚassertEqualÚtypeable_linesÚassertIsInstanceÚtypeable_nodesr ÚAssignÚForÚFunctionDefÚWith©Úselfr s r Útest_node_typesz$TypeableVisitorTests.test_node_types sà € ð ×#Ò#ð
ñ
ô
ˆð
×Ò˜Ô/°°°Ñ>Ô>Ð>Ø×Ò˜gÔ4°QÔ7½¼ÑDÔDÐDØ×Ò˜gÔ4°QÔ7½¼ÑAÔAÐAØ×Ò˜gÔ4°QÔ7½¼ÑIÔIÐIØ×Ò˜gÔ4°QÔ7½¼ÑBÔBÐBÐBÐBr c ó — | d¦ « }| |j ddg¦ « | |j d t
j ¦ « | |j d t
j ¦ « dS )zƒ
Test the common pitfall of missing `generic_visit` in visitors by
ensuring that nested nodes are reported
zdef f():
x = 1
r r N)r r r r r r r r r s r Útest_visitor_recursesz*TypeableVisitorTests.test_visitor_recurses( sƒ € ð
×#Ò#ð
ñ
ô
ˆð
×Ò˜Ô/°!°Q°Ñ8Ô8Ð8Ø×Ò˜gÔ4°QÔ7½¼ÑIÔIÐIØ×Ò˜gÔ4°QÔ7½¼ÑDÔDÐDÐDÐDr c ól — | d¦ « }| |j g d¢¦ « | |j d t
j ¦ « | |j d t
j ¦ « | |j d t
j ¦ « dS )z@
Test that the PEP 492 node types are collected
zoasync def f(): # async def
async for x in y: pass # async for
async with a as b: pass # async with
)r r r r r r N) r r r r r r ÚAsyncFunctionDefÚAsyncForÚ AsyncWithr s r Útest_py35_node_typesz)TypeableVisitorTests.test_py35_node_types7 s¤ € ð ×#Ò#ð
ñ
ô
ˆð
×Ò˜Ô/°°°Ñ;Ô;Ð;Ø×Ò˜gÔ4°QÔ7½Ô9MÑNÔNÐNØ×Ò˜gÔ4°QÔ7½¼ÑFÔFÐFØ×Ò˜gÔ4°QÔ7½¼ÑGÔGÐGÐGÐGr c óÌ — | d¦ « }| |j ddg¦ « | |j d j d j d¦ « dS )ún
Test that when two typeable nodes are present on a line, the last
typeable one wins.
zx = 1; y = 1r r ÚyN)r r r r ÚtargetsÚidr s r Útest_last_node_winsz(TypeableVisitorTests.test_last_node_winsG sc € ð
×#Ò# NÑ3Ô3ˆà×Ò˜Ô/°!°Q°Ñ8Ô8Ð8à×Ò˜Ô/°Ô2Ô:¸1Ô=Ô@À#ÑFÔFÐFÐFÐFr N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr r! r# r( r. © r r r r sƒ € € € € € ðð ð ðð ñ „\ððCð Cð Cð$
Eð
Eð
EðHð Hð Hð Gð Gð Gð Gð Gr r c ój — e Zd ZdZed„ ¦ « Zd„ Zd„ Zd„ Zd„ Z d„ Z
d„ Zd „ Zd
„ Z
d„ Zd„ Zd
„ ZdS )ÚCollectTypeCommentsTestsz,
Tests of L{_collect_type_comments}
c ó¸ — t j | ¦ « }t j | ¦ « }t j ||¦ « }d„ | ¦ « D ¦ « S )zÒ
Run L{_collect_type_comments} on the parsed source and return the
mapping from nodes to comments. The return value is converted to
a set: {(node_type, tuple of comments), ...}
c ód — h | ]-\ }}t |¦ « t d „ |D ¦ « ¦ « f’Œ.S )c 3 ó K — | ] \ }}|V — Œ
d S )Nr4 )Ú.0Ú_r s r ú