U
    [¹ÖhŁ  ć                   @   sv   d dl mZ d dlmZ d dlmZ d dlmZ ddl mZ ddl mZ ddl m	Z	 dd	l m
Z
 G d
d dejZdS )é   )Śfixtures)Śeq_)ŚColumn)ŚTableé   )ŚInteger)Śselect)Śtesting)Śunionc                   @   sz   e Zd ZdZedd Zedd ZdddZd	d
 Zdd Z	e
jje
jjdd Ze
jjdd Zdd Zdd ZdS )ŚDeprecatedCompoundSelectTestTc                 C   s*   t d|tdtddtdttdt d S )NŚ
some_tableŚidT)Zprimary_keyŚxŚy)r   r   r   )ŚclsZmetadata© r   śP./venv/lib/python3.8/site-packages/sqlalchemy/testing/suite/test_deprecations.pyŚdefine_tables   s    ūz*DeprecatedCompoundSelectTest.define_tablesc              
   C   s@   |  | jj ” ddddddddddddddddg” d S )Né   r   )r   r   r   r   é   é   )ŚexecuteŚtablesr   Śinsert)r   Ś
connectionr   r   r   Śinsert_data    s    




üžz(DeprecatedCompoundSelectTest.insert_datar   c                 C   s   t | ||” ” | d S )N)r   r   Zfetchall)ŚselfZconnr   ŚresultŚparamsr   r   r   Ś_assert_result,   s    z+DeprecatedCompoundSelectTest._assert_resultc              	   C   st   | j j}t| |jjdk”}t| |jjdk”}t||}t d”" |  	|| 
|jj”ddg” W 5 Q R X d S ©Nr   r   śAThe SelectBase.c and SelectBase.columns attributes are deprecated©r   r   r   ©r   r   r   )r   r   r   ŚwhereŚcr   r
   r	   Śexpect_deprecatedr   Śorder_by©r   r   ŚtableŚs1Śs2Zu1r   r   r   Śtest_plain_union/   s    
’  ’z-DeprecatedCompoundSelectTest.test_plain_unionc              	   C   s|   | j j}t| |jjdk”}t| |jjdk”}t|| ”  ” }t 	d”" |  
|| |jj”ddg” W 5 Q R X d S r    )r   r   r   r$   r%   r   r
   Śaliasr	   r&   r   r'   r(   r   r   r   Ś"_dont_test_select_from_plain_unionD   s    ’  ’z?DeprecatedCompoundSelectTest._dont_test_select_from_plain_unionc              	   C   s   | j j}t| |jjdk” d” |jj”}t| |jjdk” d” |jj”}t|| d”}t	 
d”" |  || |jj”ddg” W 5 Q R X d S ©Nr   r   r   r!   r"   r#   )r   r   r   r$   r%   r   Ślimitr'   r
   r	   r&   r   r(   r   r   r   Ś&test_limit_offset_selectable_in_unionsR   s    &&’  ’zCDeprecatedCompoundSelectTest.test_limit_offset_selectable_in_unionsc              	   C   s   | j j}t| |jjdk” |jj”}t| |jjdk” |jj”}t|| d”}t	 
d”" |  || |jj”ddg” W 5 Q R X d S r    )r   r   r   r$   r%   r   r'   r
   r0   r	   r&   r   r(   r   r   r   Ś"test_order_by_selectable_in_unionsb   s      ’  ’z?DeprecatedCompoundSelectTest.test_order_by_selectable_in_unionsc              	   C   s   | j j}t| |jjdk” ” }t| |jjdk” ” }t|| d”}t	 
d”" |  || |jj”ddg” W 5 Q R X d S r    )r   r   r   r$   r%   r   Zdistinctr
   r0   r	   r&   r   r'   r(   r   r   r   Ś"test_distinct_selectable_in_unionsq   s    ’  ’z?DeprecatedCompoundSelectTest.test_distinct_selectable_in_unionsc              	   C   sŖ   | j j}t| |jjdk” d” |jj” ”  ” }t| |jjdk” d” |jj” ”  ” }t	|| d”}t
 d”" |  || |jj”ddg” W 5 Q R X d S r/   )r   r   r   r$   r%   r   r0   r'   r-   r
   r	   r&   r   r(   r   r   r   Ś.test_limit_offset_aliased_selectable_in_unions   s4    
’žż
’	
’žż
’	’  ’zKDeprecatedCompoundSelectTest.test_limit_offset_aliased_selectable_in_unionsN)r   )Ś__name__Ś
__module__Ś__qualname__Z__backend__Śclassmethodr   r   r   r,   r.   r	   ZrequiresZorder_by_col_from_unionZ/parens_in_union_contained_select_w_limit_offsetr1   Z0parens_in_union_contained_select_wo_limit_offsetr2   r3   r4   r   r   r   r   r      s   
	


r   N)Ś r   Z
assertionsr   Zschemar   r   r   r   r	   r
   Z
TablesTestr   r   r   r   r   Ś<module>	   s   