관리-도구
편집 파일: test_other.cpython-311.pyc
� �܋f�� � �� � d Z ddlmZ ddlmZ ddlmZmZm Z G d� de� � Z G d� de� � Z G d � d e� � Z G d� de� � Z G d � de� � ZdS )z& Tests for various Pyflakes behavior. � )�version_info)�messages)�TestCase�skip�skipIfc � � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d � Z" e#e$d!k d"� � d#� � � Z%d$� Z&d%� Z'd&� Z(d'� Z)d(� Z*d)� Z+ e,d*� � d+� � � Z-d,� Z.d-� Z/d.� Z0d/� Z1d0� Z2d1� Z3d2� Z4d3� Z5d4� Z6d5� Z7d6� Z8d7� Z9d8� Z:d9S ):�Testc �F � | � dt j � � d S )Nzdef fu(bar, bar): pass)�flakes�m�DuplicateArgument��selfs �i/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyflakes/test/test_other.py�test_duplicateArgszTest.test_duplicateArgs s � ����,�a�.A�B�B�B�B�B� c �\ � | � dt j t j � � d S )NzG a = 1 def f(): a; a=1 f() )r r �UndefinedLocal�UnusedVariabler s r �$test_localReferencedBeforeAssignmentz)Test.test_localReferencedBeforeAssignment s4 � ���� � � �q�/� 1� 1� 1� 1� 1r c �� � | � d� � | � d� � | � dt j � � | � d� � | � d� � dS )z_ Test that reusing a variable in a generator does not raise a warning. z8 a = 1 (1 for a, b in [(1, 2)]) zU class A: a = 1 list(1 for a, b in [(1, 2)]) zQ def f(): a = 1 (1 for a, b in [(1, 2)]) zK (1 for a, b in [(1, 2)]) (1 for a, b in [(1, 2)]) zY for a, b in [(1, 2)]: pass (1 for a, b in [(1, 2)]) N�r r r r s r �test_redefinedInGeneratorzTest.test_redefinedInGenerator � � � ��� � � � � ��� � � � � ��� � � � � � � ��� � � � � ��� � � � � � r c �� � | � d� � | � d� � | � dt j � � | � d� � | � d� � dS )zg Test that reusing a variable in a set comprehension does not raise a warning. z8 a = 1 {1 for a, b in [(1, 2)]} zQ class A: a = 1 {1 for a, b in [(1, 2)]} zQ def f(): a = 1 {1 for a, b in [(1, 2)]} zK {1 for a, b in [(1, 2)]} {1 for a, b in [(1, 2)]} zY for a, b in [(1, 2)]: pass {1 for a, b in [(1, 2)]} Nr r s r � test_redefinedInSetComprehensionz%Test.test_redefinedInSetComprehension5 r r c �� � | � d� � | � d� � | � dt j � � | � d� � | � d� � dS )zh Test that reusing a variable in a dict comprehension does not raise a warning. z< a = 1 {1: 42 for a, b in [(1, 2)]} zU class A: a = 1 {1: 42 for a, b in [(1, 2)]} zU def f(): a = 1 {1: 42 for a, b in [(1, 2)]} zS {1: 42 for a, b in [(1, 2)]} {1: 42 for a, b in [(1, 2)]} z] for a, b in [(1, 2)]: pass {1: 42 for a, b in [(1, 2)]} Nr r s r �!test_redefinedInDictComprehensionz&Test.test_redefinedInDictComprehensionR r r c �F � | � dt j � � dS )zf Test that shadowing a function definition with another one raises a warning. z5 def a(): pass def a(): pass N�r r �RedefinedWhileUnusedr s r �test_redefinedFunctionzTest.test_redefinedFunctiono s1 � � ��� � � #� %� %� %� %� %r c �0 � | � d� � dS )zq Test that shadowing a function definition named with underscore doesn't raise anything. z5 def _(): pass def _(): pass N�r r s r � test_redefinedUnderscoreFunctionz%Test.test_redefinedUnderscoreFunctiony �) � � ��� � � � � � r c �F � | � dt j � � dS )zQ Test that shadowing an underscore importation raises a warning. z; from .i18n import _ def _(): pass Nr r s r �#test_redefinedUnderscoreImportationz(Test.test_redefinedUnderscoreImportation� �1 � � ��� � � #� %� %� %� %� %r c �F � | � dt j � � dS )zw Test that shadowing a function definition in a class suite with another one raises a warning. zN class A: def a(): pass def a(): pass Nr r s r �test_redefinedClassFunctionz Test.test_redefinedClassFunction� �1 � � ��� � � #� %� %� %� %� %r c �0 � | � d� � dS )z{ Test that shadowing a function definition twice in an if and else block does not raise a warning. z\ if True: def a(): pass else: def a(): pass Nr$ r s r �test_redefinedIfElseFunctionz!Test.test_redefinedIfElseFunction� �) � � ��� � � � � � r c �F � | � dt j � � dS )zh Test that shadowing a function definition within an if block raises a warning. zN if True: def a(): pass def a(): pass Nr r s r �test_redefinedIfFunctionzTest.test_redefinedIfFunction� r, r c �0 � | � d� � dS )z{ Test that shadowing a function definition twice in try and except block does not raise a warning. zZ try: def a(): pass except: def a(): pass Nr$ r s r �test_redefinedTryExceptFunctionz$Test.test_redefinedTryExceptFunction� r/ r c �F � | � dt j � � dS )zh Test that shadowing a function definition within a try block raises a warning. zk try: def a(): pass def a(): pass except: pass Nr r s r �test_redefinedTryFunctionzTest.test_redefinedTryFunction� s1 � � ��� � � #� %� %� %� %� %r c �0 � | � d� � dS )z� Test that shadowing a variable in a list comprehension in an if and else block does not raise a warning. zY if False: a = 1 else: [a for a in '12'] Nr$ r s r �test_redefinedIfElseInListCompz#Test.test_redefinedIfElseInListComp� r/ r c �0 � | � d� � dS )z� Test that shadowing a function definition with a decorated version of that function does not raise a warning. zi from somewhere import somedecorator def a(): pass a = somedecorator(a) Nr$ r s r �test_functionDecoratorzTest.test_functionDecorator� r/ r c �0 � | � d� � dS )z� Test that shadowing a function definition in a class suite with a decorated version of that function does not raise a warning. zS class A: def a(): pass a = classmethod(a) Nr$ r s r �test_classFunctionDecoratorz Test.test_classFunctionDecorator� �) � � ��� � � � � � r c �0 � | � d� � d S )Nz� class A: @property def t(self): pass @t.setter def t(self, value): pass @t.deleter def t(self): pass r$ r s r �test_modernPropertyzTest.test_modernProperty� s'