o
    ܎j                     @   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)primary_keyxy)r   r   r   )clsmetadata r   j/home/air/Certificate/back/venv/lib/python3.10/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   fetchall)selfconnr   resultparamsr   r   r   _assert_result,   s   z+DeprecatedCompoundSelectTest._assert_resultc                 C   s   | j j}t||jjdk}t||jjdk}t||}td | 	||
|jjddg W d    d S 1 s>w   Y  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s2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 d    d S 1 sBw   Y  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 d    d S 1 sQw   Y  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 d    d S 1 sKw   Y  d S r$   )r   r   r   r(   r)   r   r+   r
   r5   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 d    d S 1 sEw   Y  d S r$   )r   r   r   r(   r)   r   distinctr
   r5   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 d    d S 1 sYw   Y  d S r4   )r   r   r   r(   r)   r   r5   r+   r2   r
   r	   r*   r#   r,   r   r   r   .test_limit_offset_aliased_selectable_in_unions   s.   
	
	"zKDeprecatedCompoundSelectTest.test_limit_offset_aliased_selectable_in_unionsN)r   )__name__
__module____qualname____backend__classmethodr   r   r#   r1   r3   r	   requiresorder_by_col_from_union/parens_in_union_contained_select_w_limit_offsetr6   0parens_in_union_contained_select_wo_limit_offsetr7   r9   r:   r   r   r   r   r      s     
	


r   N) r   
assertionsr   schemar   r   r   r   r	   r
   
TablesTestr   r   r   r   r   <module>   s   