
    yIf                     >    d Z ddlmZ ddlmZ  G d de          ZdS )z2
Tests for dict duplicate keys Pyflakes behavior.
    )messages)TestCasec                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )Testc                 \    |                      dt          j        t          j                   d S )Nz{'yes': 1, 'yes': 2}flakesmMultiValueRepeatedKeyLiteralselfs    K/var/www/piapp/venv/lib/python3.11/site-packages/pyflakes/test/test_dict.pytest_duplicate_keyszTest.test_duplicate_keys   1    "**	
 	
 	
 	
 	
    c                 0    |                      d           d S )Nz{b'a': 1, u'a': 2}r	   r   s    r   (test_duplicate_keys_bytes_vs_unicode_py3z-Test.test_duplicate_keys_bytes_vs_unicode_py3   s    ()))))r   c                 \    |                      dt          j        t          j                   d S )Nz{1: b'a', 1: u'a'}r   r   s    r   *test_duplicate_values_bytes_vs_unicode_py3z/Test.test_duplicate_values_bytes_vs_unicode_py3   1     **	
 	
 	
 	
 	
r   c                     |                      dt          j        t          j        t          j        t          j                   d S )Nz&{'yes': 1, 'yes': 2, 'no': 2, 'no': 3}r   r   s    r   test_multiple_duplicate_keysz!Test.test_multiple_duplicate_keys   s=    4****	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nz`
            def f(thing):
                pass
            f({'yes': 1, 'yes': 2})
            r   r   s    r   test_duplicate_keys_in_functionz$Test.test_duplicate_keys_in_function%   5    
 **	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nzlambda x: {(0,1): 1, (0,1): 2}r   r   s    r   test_duplicate_keys_in_lambdaz"Test.test_duplicate_keys_in_lambda0   s1    ,**	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nz{(0,1): 1, (0,1): 2}r   r   s    r   test_duplicate_keys_tupleszTest.test_duplicate_keys_tuples7   r   r   c                 \    |                      dt          j        t          j                   d S )Nz{(0,1): 1, (0,1.0): 2}r   r   s    r   (test_duplicate_keys_tuples_int_and_floatz-Test.test_duplicate_keys_tuples_int_and_float>   s1    $**	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nz{1: 1, 1: 2}r   r   s    r   test_duplicate_keys_intszTest.test_duplicate_keys_intsE   s1    **	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nz{True: 1, True: 2}r   r   s    r   test_duplicate_keys_boolszTest.test_duplicate_keys_boolsL   r   r   c                 \    |                      dt          j        t          j                   d S )Nz{False: 1, False: 2}r   r   s    r   test_duplicate_keys_bools_falsez$Test.test_duplicate_keys_bools_falseS   s1    "**	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )Nz{None: 1, None: 2}r   r   s    r   test_duplicate_keys_nonezTest.test_duplicate_keys_none[   r   r   c                 \    |                      dt          j        t          j                   d S )Nz8
            a = 1
            {a: 1, a: 2}
            )r	   r
   MultiValueRepeatedKeyVariabler   s    r   test_duplicate_variable_keysz!Test.test_duplicate_variable_keysb   s5     ++	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   d S )NzJ
            a = 1
            b = 2
            {1: a, 1: b}
            r   r   s    r   test_duplicate_variable_valuesz#Test.test_duplicate_variable_valuesl   r   r   c                 \    |                      dt          j        t          j                   d S )NzJ
            a = 1
            b = 1
            {1: a, 1: b}
            r   r   s    r   )test_duplicate_variable_values_same_valuez.Test.test_duplicate_variable_values_same_valuew   s7     	
 **	
 	
 	
 	
 	
r   c                 \    |                      dt          j        t          j                   dS )z
        These do look like different values, but when it comes to their use as
        keys, they compare as equal and so are actually duplicates.
        The literal dict {1: 1, 1.0: 1} actually becomes {1.0: 1}.
        z(
            {1: 1, 1.0: 2}
            Nr   r   s    r    test_duplicate_key_float_and_intz%Test.test_duplicate_key_float_and_int   s7     	 **	
 	
 	
 	
 	
r   c                 0    |                      d           d S )Nz&
        {'yes': 1, 'yes': 1}
        r   r   s    r   &test_no_duplicate_key_error_same_valuez+Test.test_no_duplicate_key_error_same_value   '      	 	 	 	 	r   c                 0    |                      d           d S )Nz%
        {'yes': 1, 'no': 2}
        r   r   s    r   test_no_duplicate_key_errorsz!Test.test_no_duplicate_key_errors   r6   r   c                 0    |                      d           d S )Nz{(0,1): 1, (0,2): 1}r   r   s    r   0test_no_duplicate_keys_tuples_same_first_elementz5Test.test_no_duplicate_keys_tuples_same_first_element   s    *+++++r   c                 0    |                      d           d S )Nz^
        def test(thing):
            pass
        test({True: 1, None: 2, False: 1})
        r   r   s    r   &test_no_duplicate_key_errors_func_callz+Test.test_no_duplicate_key_errors_func_call   '      	 	 	 	 	r   c                 0    |                      d           d S )Nz{True: 1, None: 2, False: 1}r   r   s    r   )test_no_duplicate_key_errors_bool_or_nonez.Test.test_no_duplicate_key_errors_bool_or_none   s    233333r   c                 0    |                      d           d S )Nz
        {1: 1, 2: 1}
        r   r   s    r   !test_no_duplicate_key_errors_intsz&Test.test_no_duplicate_key_errors_ints   r6   r   c                 0    |                      d           d S )NzN
        test = 'yes'
        rest = 'yes'
        {test: 1, rest: 2}
        r   r   s    r   !test_no_duplicate_key_errors_varsz&Test.test_no_duplicate_key_errors_vars   r=   r   c                 0    |                      d           d S )Nz&
        {(0,1): 1, (0,2): 1}
        r   r   s    r   #test_no_duplicate_key_errors_tuplesz(Test.test_no_duplicate_key_errors_tuples   r6   r   c                 0    |                      d           d S )Nzl
        class Test():
            pass
        f = Test()
        f.a = 1
        {f.a: 1, f.a: 1}
        r   r   s    r   0test_no_duplicate_key_errors_instance_attributesz5Test.test_no_duplicate_key_errors_instance_attributes   s'      	 	 	 	 	r   N)__name__
__module____qualname__r   r   r   r   r   r   r    r"   r$   r&   r(   r*   r-   r/   r1   r3   r5   r8   r:   r<   r?   rA   rC   rE   rG    r   r   r   r   	   s       
 
 
* * *
 
 

 
 
	
 	
 	

 
 

 
 

 
 

 
 

 
 

 
 

 
 

 
 
	
 	
 	

 
 

 
 
  
  
, , ,  4 4 4  
    
    r   r   N)__doc__pyflakesr   r
   pyflakes.test.harnessr   r   rK   r   r   <module>rO      ss     # " " " " " * * * * * *x x x x x8 x x x x xr   