a
    •˜ëj.ó  ã                   @   s  d dl mZ d dl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 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 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 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& 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-G d)d*„ d*ej,ƒZ.G d+d,„ d,ej/ƒZ0G d-d.„ d.ej,ƒZ1G d/d0„ d0ej,ƒZ2G d1d2„ d2ej,ƒZ3G d3d4„ d4ej,ƒZ4G d5d6„ d6eeej,ƒZ5G d7d8„ d8ej,ƒZ6G d9d:„ d:ej,ƒZ7G d;d<„ d<ej,ƒZ8G d=d>„ d>ej,ƒZ9G d?d@„ d@ej,ƒZ:G dAdB„ dBej,ƒZ;G dCdD„ dDeej,ƒZ<G dEdF„ dFej,ƒZ=G dGdH„ dHej,ƒZ>G dIdJ„ dJej,ƒZ?dS )Ké    Né   )ÚAssertsCompiledSQL)ÚAssertsExecutionResults)Úconfig)Úfixtures)Úassert_raises)Úeq_)Úin_)Ú	CursorSQL)ÚColumn)ÚTableé   )Ú	bindparam)Úcase)Úcolumn)ÚComputed)Úexists)Úfalse)Ú
ForeignKey)Úfunc)ÚIdentity)ÚInteger)Úliteral)Úliteral_column)Únull)Úselect)ÚString)Útable)Útesting)Útext)Útrue)Útuple_)Ú	TupleType)Úunion)Úvalues)ÚDatabaseError)ÚProgrammingErrorc                   @   s@   e Zd ZdZedd„ ƒZedd„ ƒZdd„ Zej	j
dd	„ ƒZd
S )ÚCollateTestTc                 C   s&   t d|tdtdd�tdtdƒƒƒ d S )NÚ
some_tableÚidT©Úprimary_keyÚdataéd   ©r   r   r   r   ©ÚclsÚmetadata© r2   úc/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/sqlalchemy/testing/suite/test_select.pyÚdefine_tables4   s    üzCollateTest.define_tablesc                 C   s(   |  | jj ¡ dddœdddœg¡ d S )Né   úcollate data1©r)   r,   r   úcollate data2©ÚexecuteÚtablesr(   Úinsert©r0   Ú
connectionr2   r2   r3   Úinsert_data=   s    
þþzCollateTest.insert_datac                 C   sB   t j ¡ �$}t| |¡ ¡ |ƒ W d   ƒ n1 s40    Y  d S ©N©r   ÚdbÚconnectr   r:   Úfetchall©Úselfr   ÚresultÚconnr2   r2   r3   Ú_assert_resultG   s    zCollateTest._assert_resultc                 C   sB   t j t j¡}|  t| jjƒ | jjj	j
 |¡ ¡ ¡ddg¡ d S )N)r5   r6   )r   r8   )r   ÚrequiresZget_order_by_collationr   rI   r   r;   r(   Úorder_byÚcr,   ZcollateZasc)rF   Z	collationr2   r2   r3   Útest_collate_order_byK   s    ÿüz!CollateTest.test_collate_order_byN)Ú__name__Ú
__module__Ú__qualname__Ú__sparse_driver_backend__Úclassmethodr4   r?   rI   r   rJ   Zorder_by_collationrM   r2   r2   r2   r3   r'   1   s   

	r'   c                   @   sl   e Zd ZdZdZedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zejjdd„ ƒZdS )ÚOrderByLabelTestz©Test the dialect sends appropriate ORDER BY expressions when
    labels are used.

    This essentially exercises the "supports_simple_order_by_label"
    setting.

    Tc                 C   sB   t d|tdtdd�tdtƒtdtƒtdtdƒƒtd	tdƒƒƒ d S )
Nr(   r)   Tr*   ÚxÚyÚqé2   Úpr.   r/   r2   r2   r3   r4   b   s    ùzOrderByLabelTest.define_tablesc                 C   sB   |  | jj ¡ ddddddœddddddœddd	d
ddœg¡ d S )Nr5   r   Zq1Zp3)r)   rT   rU   rV   rX   r   Zq2Úp2é   Zq3Úp1r9   r=   r2   r2   r3   r?   n   s    
ýþzOrderByLabelTest.insert_datac                 C   sB   t j ¡ �$}t| |¡ ¡ |ƒ W d   ƒ n1 s40    Y  d S r@   rA   rE   r2   r2   r3   rI   y   s    zOrderByLabelTest._assert_resultc                 C   s4   | j j}|jj d¡}|  t|ƒ |¡g d¢¡ d S )NÚlx©©r5   ©r   ©r   )r;   r(   rL   rT   ÚlabelrI   r   rK   ©rF   r   r\   r2   r2   r3   Ú
test_plain}   s    zOrderByLabelTest.test_plainc                 C   s<   | j j}|jj|jj  d¡}|  t|ƒ |¡g d¢¡ d S )Nr\   )r`   ©é   ©é   )	r;   r(   rL   rT   rU   ra   rI   r   rK   rb   r2   r2   r3   Útest_composed_int‚   s    z"OrderByLabelTest.test_composed_intc                 C   s`   | j j}|jj|jj  d¡}t |jj¡|jj	  d¡}|  
t||ƒ || ¡ ¡g d¢¡ d S )Nr\   Úly))r   Zq1p3)re   Zq2p2)rg   Zq3p1)r;   r(   rL   rT   rU   ra   r   ÚlowerrV   rX   rI   r   rK   Údesc)rF   r   r\   ri   r2   r2   r3   Útest_composed_multiple‡   s    þz'OrderByLabelTest.test_composed_multiplec                 C   s8   | j j}|jj d¡}|  t|ƒ | ¡ ¡g d¢¡ d S )Nr\   )r`   r_   r^   )	r;   r(   rL   rT   ra   rI   r   rK   rk   rb   r2   r2   r3   Útest_plain_desc�   s    z OrderByLabelTest.test_plain_descc                 C   s@   | j j}|jj|jj  d¡}|  t|ƒ | 	¡ ¡g d¢¡ d S )Nr\   )rf   rd   r`   )
r;   r(   rL   rT   rU   ra   rI   r   rK   rk   rb   r2   r2   r3   Útest_composed_int_desc•   s    z'OrderByLabelTest.test_composed_int_descc                 C   sR   | j j}|jj|jj  d¡}tt |jj	¡|ƒ 
|¡ |¡}|  |g d¢¡ d S )Nr\   ))r5   r   )r5   re   )r5   rg   )r;   r(   rL   rT   rU   ra   r   r   Úcountr)   Zgroup_byrK   rI   )rF   r   ÚexprÚstmtr2   r2   r3   Útest_group_by_composedš   s
    ÿz'OrderByLabelTest.test_group_by_composedN)rN   rO   rP   Ú__doc__rQ   rR   r4   r?   rI   rc   rh   rl   rm   rn   r   rJ   Zgroup_by_complex_expressionrr   r2   r2   r2   r3   rS   W   s   


	rS   c                   @   s   e Zd ZdZdZdd„ ZdS )ÚValuesExpressionTest)Ztable_value_constructorTc                 C   sD   t tdtƒtdtƒdd� g d¢¡}t| t|ƒ¡ ¡ g d¢ƒ d S )Nr)   ÚnameZ	my_values)ru   ))r5   Zname1)r   Zname2)r   Zname3)	r$   r   r   r   r,   r   r:   r   Úall)rF   r>   Z
value_exprr2   r2   r3   Útest_tuples©   s    ÿþþz ValuesExpressionTest.test_tuplesN)rN   rO   rP   Ú__requires__rQ   rw   r2   r2   r2   r3   rt   ¤   s   rt   c                   @   s2  e Zd ZdZedd„ ƒZedd„ ƒZdHdd	„ZdId
d„Zdd„ Z	dd„ Z
ejjdd„ ƒZejjdd„ ƒZejg d¢g d¢g d¢dd�ejjdd„ ƒƒZejjdd„ ƒZejjdd„ ƒZejjdd „ ƒZejjd!d"„ ƒZejjd#d$„ ƒZejjd%d&„ ƒZejjd'd(„ ƒZejjd)d*„ ƒZejjd+d,„ ƒZejjd-d.„ ƒZejjd/d0„ ƒZ ejjd1d2„ ƒZ!ejjejj"d3d4„ ƒƒZ#ejjd5d6„ ƒZ$ejjd7d8„ ƒZ%ejj&d9d:„ ƒZ'ejj&ejj(d;d<„ ƒƒZ)ejj&ejj(d=d>„ ƒƒZ*ejj+d?d@„ ƒZ,ejj+ejj(dAdB„ ƒƒZ-ejj&ejj+dCdD„ ƒƒZ.ejj&ejj+ejj(dEdF„ ƒƒƒZ/dGS )JÚFetchLimitOffsetTestTc                 C   s*   t d|tdtdd�tdtƒtdtƒƒ d S ©Nr(   r)   Tr*   rT   rU   ©r   r   r   r/   r2   r2   r3   r4   ·   s    ûz"FetchLimitOffsetTest.define_tablesc                 C   sJ   |  | jj ¡ ddddœddddœddddœddddœddddœg¡ d S )Nr5   r   ©r)   rT   rU   r   rZ   re   é   r9   r=   r2   r2   r3   r?   Á   s    





ûþz FetchLimitOffsetTest.insert_datar2   Fc                 C   sT   |r:|  ||¡ ¡ }tt|ƒt|ƒƒ tt|ƒt|ƒƒ nt|  ||¡ ¡ |ƒ d S r@   )r:   rD   r   ÚlenÚset)rF   r>   r   rG   ÚparamsÚset_Z	query_resr2   r2   r3   rI   Î   s
    z#FetchLimitOffsetTest._assert_resultc                 C   sD   t j ¡ �&}t| ||¡ ¡ |ƒ W d   ƒ n1 s60    Y  d S r@   )r   rB   rC   r   Zexec_driver_sqlrD   ©rF   r   rG   r€   rH   r2   r2   r3   Ú_assert_result_strÙ   s    z'FetchLimitOffsetTest._assert_result_strc                 C   sN   | j j}t|ƒ |jj¡}|  || d¡ddg¡ |  || d¡g d¢¡ d S ©Nr   ©r5   r5   r   ©r   r   r   r   ©r…   r†   ©r   r   rZ   )r;   r(   r   rK   rL   r)   rI   Úlimit)rF   r>   r   rq   r2   r2   r3   Útest_simple_limitÝ   s    ýýz&FetchLimitOffsetTest.test_simple_limitc                 C   sV   | j j}t|jjƒ |jj¡ d¡ ¡ }tt|ƒt|ƒƒ 	¡  ¡ }|  
||dg¡ d S )Nr5   r^   )r;   r(   r   rL   r)   rK   r‰   Zscalar_subqueryr#   ÚsubqueryrI   )rF   r>   r   rq   Úur2   r2   r3   Ú test_limit_render_multiple_timesë   s    ÿÿýz5FetchLimitOffsetTest.test_limit_render_multiple_timesc                 C   sX   | j j}|  |t|ƒ |jj¡ d¡ddg¡ |  |t|ƒ |jj¡ d¡g d¢¡ d S r„   ©r;   r(   rI   r   rK   rL   r)   Úfetch©rF   r>   r   r2   r2   r3   Útest_simple_fetchû   s    ýýz&FetchLimitOffsetTest.test_simple_fetchc                 C   sX   | j j}|  |t|ƒ |jj¡ d¡g d¢¡ |  |t|ƒ |jj¡ d¡ddg¡ d S )Nr   ©rˆ   ©rZ   rZ   re   ©re   rZ   r}   r   r“   r”   ©r;   r(   rI   r   rK   rL   r)   Úoffsetr�   r2   r2   r3   Útest_simple_offset	  s    ýýz'FetchLimitOffsetTest.test_simple_offset)©r   r   ©r   r5   ©r   r   )r™   r˜   rš   )©r   r5   r™   r›   Úcases©Úargnamesc                 C   sf   | j j}|ji d�}g d¢}|D ]@\}}|||| … }|  |t|ƒ |jj¡ |¡ 	|¡|¡ q d S )N)Zcompiled_cache©r…   r†   rˆ   r“   r”   )
r;   r(   Zexecution_optionsrI   r   rK   rL   r)   r‰   r–   )rF   r>   rœ   r   Zassert_datar‰   r–   Úexpectedr2   r2   r3   Útest_simple_limit_offset  s    ýz-FetchLimitOffsetTest.test_simple_limit_offsetc                 C   sd   | j j}|  |t|ƒ |jj¡ d¡ d¡ddg¡ |  |t|ƒ |jj¡ d¡ d¡g d¢¡ d S )Nr   r5   r†   rˆ   r   r’   ©	r;   r(   rI   r   rK   rL   r)   r�   r–   r�   r2   r2   r3   Útest_simple_fetch_offset,  s    ýýz-FetchLimitOffsetTest.test_simple_fetch_offsetc                 C   s,   | j j}| j|t|ƒ d¡g d¢dd� d S )Né
   rŸ   T©r�   )r;   r(   rI   r   r�   r�   r2   r2   r3   Útest_fetch_offset_no_order;  s    üz/FetchLimitOffsetTest.test_fetch_offset_no_orderc                 C   sX   | j j}|  |t|ƒ |jj¡ d¡g d¢¡ |  |t|ƒ |jj¡ d¡g d¢¡ d S )Nr   rŸ   r5   ©r†   rˆ   r“   r”   r•   r�   r2   r2   r3   Útest_simple_offset_zeroE  s    ýýz,FetchLimitOffsetTest.test_simple_offset_zeroc                 C   sX   | j j}t|ƒ |jj¡ d¡ d¡}|jt	j
jddid�}t|ƒ}|  |ddg¡ dS ©	z7test that 'literal binds' mode works - no bound params.r   r5   Úliteral_bindsT)ÚdialectÚcompile_kwargsr†   rˆ   N)r;   r(   r   rK   rL   r)   r‰   r–   Úcompiler   rB   r«   Ústrrƒ   ©rF   r   rq   Zsqlr2   r2   r3   Útest_limit_offset_nobindsT  s    ÿz.FetchLimitOffsetTest.test_limit_offset_nobindsc                 C   sX   | j j}t|ƒ |jj¡ d¡ d¡}|jt	j
jddid�}t|ƒ}|  |ddg¡ dS r©   )r;   r(   r   rK   rL   r)   r�   r–   r­   r   rB   r«   r®   rƒ   r¯   r2   r2   r3   Útest_fetch_offset_nobindsa  s    ÿz.FetchLimitOffsetTest.test_fetch_offset_nobindsc                 C   sp   | j j}| j|t|ƒ |jj¡ tdƒ¡ddgddid� | j|t|ƒ |jj¡ tdƒ¡g d¢ddid� d S )NÚlr…   r†   r   ©r€   r‡   r   )	r;   r(   rI   r   rK   rL   r)   r‰   r   r�   r2   r2   r3   Útest_bound_limitn  s    üüz%FetchLimitOffsetTest.test_bound_limitc                 C   sp   | j j}| j|t|ƒ |jj¡ tdƒ¡g d¢ddid� | j|t|ƒ |jj¡ tdƒ¡g d¢ddid� d S )NÚor’   r   r³   r§   r5   )	r;   r(   rI   r   rK   rL   r)   r–   r   r�   r2   r2   r3   Útest_bound_offset  s    üüz&FetchLimitOffsetTest.test_bound_offsetc                 C   sˆ   | j j}| j|t|ƒ |jj¡ tdƒ¡ 	tdƒ¡ddgdddœd� | j|t|ƒ |jj¡ tdƒ¡ 	tdƒ¡g d	¢d
ddœd� d S )Nr²   rµ   r†   rˆ   r   r5   )r²   rµ   r³   r’   r   )
r;   r(   rI   r   rK   rL   r)   r‰   r   r–   r�   r2   r2   r3   Útest_bound_limit_offset�  s2    ÿþýù
ÿþýùz,FetchLimitOffsetTest.test_bound_limit_offsetc                 C   sˆ   | j j}| j|t|ƒ |jj¡ tdƒ¡ 	tdƒ¡ddgdddœd� | j|t|ƒ |jj¡ tdƒ¡ 	tdƒ¡g d	¢d
ddœd� d S )NÚfrµ   r†   rˆ   r   r5   )r¸   rµ   r³   r’   r   )
r;   r(   rI   r   rK   rL   r)   r�   r   r–   r�   r2   r2   r3   Útest_bound_fetch_offset§  s2    ÿþýù
ÿþýùz,FetchLimitOffsetTest.test_bound_fetch_offsetc                 C   s>   | j j}|  |t|ƒ |jj¡ tdƒtdƒ ¡ddg¡ d S )NÚ1Ú2r“   r”   )	r;   r(   rI   r   rK   rL   r)   r–   r   r�   r2   r2   r3   Útest_expr_offset¾  s    ÿþûz%FetchLimitOffsetTest.test_expr_offsetc                 C   s>   | j j}|  |t|ƒ |jj¡ tdƒtdƒ ¡g d¢¡ d S )Nrº   r»   r‡   )	r;   r(   rI   r   rK   rL   r)   r‰   r   r�   r2   r2   r3   Útest_expr_limitÉ  s    ÿþûz$FetchLimitOffsetTest.test_expr_limitc                 C   sP   | j j}|  |t|ƒ |jj¡ tdƒtdƒ ¡ 	tdƒtdƒ ¡ddg¡ d S ©Nrº   rˆ   r“   ©
r;   r(   rI   r   rK   rL   r)   r‰   r   r–   r�   r2   r2   r3   Útest_expr_limit_offsetÔ  s    ÿþýúz+FetchLimitOffsetTest.test_expr_limit_offsetc                 C   sP   | j j}|  |t|ƒ |jj¡ tdƒtdƒ ¡ 	tdƒtdƒ ¡ddg¡ d S r¾   )
r;   r(   rI   r   rK   rL   r)   r�   r   r–   r�   r2   r2   r3   Útest_expr_fetch_offsetà  s    ÿþýúz+FetchLimitOffsetTest.test_expr_fetch_offsetc                 C   s|   | j j}|  |t|ƒ |jj¡ d¡ t	dƒt	dƒ ¡ddg¡ |  |t|ƒ |jj¡ d¡ t	dƒt	dƒ ¡g d¢¡ d S )Nr   rº   rˆ   r“   r   r’   )
r;   r(   rI   r   rK   rL   r)   r‰   r–   r   r�   r2   r2   r3   Útest_simple_limit_expr_offsetí  s.    ÿþýú	ÿþýúz2FetchLimitOffsetTest.test_simple_limit_expr_offsetc                 C   s|   | j j}|  |t|ƒ |jj¡ tdƒtdƒ ¡ 	d¡ddg¡ |  |t|ƒ |jj¡ tdƒtdƒ ¡ 	d¡ddg¡ d S )Nrº   r   rˆ   r“   r5   r†   r¿   r�   r2   r2   r3   Útest_expr_limit_simple_offset  s.    ÿþýú	ÿþýúz2FetchLimitOffsetTest.test_expr_limit_simple_offsetc                 C   sp   | j j}| j|t|ƒ |jj ¡ ¡jddd�ddgdd� | j|t|ƒ |jj ¡ ¡jddd�g d¢dd� d S )	Nr5   T©Ú	with_tiesr“   r”   r¥   r   r’   ©	r;   r(   rI   r   rK   rL   rT   rk   r�   r�   r2   r2   r3   Útest_simple_fetch_ties  s    üüz+FetchLimitOffsetTest.test_simple_fetch_tiesc                 C   sX   | j j}| t|ƒ |jj¡jddd� d¡¡ 	¡ }t
|d dƒ t
t|ƒh d£ƒ d S )Nr   TrÄ   r   rˆ   ¾   r”   rˆ   r“   ©r;   r(   r:   r   rK   rL   rT   r�   r–   rD   r   r   ©rF   r>   r   Úfar2   r2   r3   Útest_fetch_offset_ties(  s    ÿþýÿz+FetchLimitOffsetTest.test_fetch_offset_tiesc                 C   sl   | j j}|  |t|ƒ |jj¡jddd� d¡ddg¡ |  |t|ƒ |jj¡jddd� d¡dd	g¡ d S )
Nr   TrÄ   r5   r†   rˆ   r   r“   r”   )	r;   r(   rI   r   rK   rL   rT   r�   r–   r�   r2   r2   r3   Ú#test_fetch_offset_ties_exact_number5  s.    ÿþýú	ÿþýúz8FetchLimitOffsetTest.test_fetch_offset_ties_exact_numberc                 C   s4   | j j}|  |t|ƒ |jj¡jddd�dg¡ d S )Né   T©Úpercentr…   rŽ   r�   r2   r2   r3   Útest_simple_fetch_percentK  s    ýz.FetchLimitOffsetTest.test_simple_fetch_percentc                 C   s<   | j j}|  |t|ƒ |jj¡jddd� d¡ddg¡ d S )Né(   TrÏ   r5   r†   rˆ   r¢   r�   r2   r2   r3   Útest_fetch_offset_percentT  s    ÿþýúz.FetchLimitOffsetTest.test_fetch_offset_percentc                 C   s@   | j j}| j|t|ƒ |jj ¡ ¡jdddd�ddgdd� d S )NrÎ   T©rÐ   rÅ   r“   r”   r¥   rÆ   r�   r2   r2   r3   Útest_simple_fetch_percent_tiesa  s    
ÿþúz3FetchLimitOffsetTest.test_simple_fetch_percent_tiesc                 C   sZ   | j j}| t|ƒ |jj¡jdddd� d¡¡ 	¡ }t
|d dƒ t
t|ƒh d£ƒ d S )NrÒ   TrÔ   r   r   rˆ   rÈ   rÉ   rÊ   r2   r2   r3   Útest_fetch_offset_percent_tiesn  s    ÿþýÿz3FetchLimitOffsetTest.test_fetch_offset_percent_tiesN)r2   F)r2   )0rN   rO   rP   Ú__backend__rR   r4   r?   rI   rƒ   rŠ   r�   r   rJ   Zfetch_firstr‘   r–   r—   Úcombinationsr¡   r£   Zfetch_no_order_byr¦   r¨   r°   r±   Zbound_limit_offsetr´   r¶   r·   r¹   Zsql_expression_limit_offsetr¼   r½   rÀ   Zfetch_expressionrÁ   rÂ   rÃ   Z
fetch_tiesrÇ   Zfetch_offset_with_optionsrÌ   rÍ   Zfetch_percentrÑ   rÓ   rÕ   rÖ   r2   r2   r2   r3   ry   ´   s’   
	
 ÿ



ü

	















ry   c                   @   sH   e Zd ZdZdZdZedd„ ƒZedd„ ƒZdd	„ Z	d
d„ Z
dd„ ZdS )ÚSameNamedSchemaTableTestztests for #7471T)Zschemasc              	   C   sB   t d|tdtdd�tjd� t d|tdtdd�tdtdd�ƒ d S )	Nr(   r)   Tr*   )ÚschemaÚsome_table_idF©Znullable)r   r   r   r   Útest_schemar/   r2   r2   r3   r4   „  s     üüüz&SameNamedSchemaTableTest.define_tablesc                 C   sD   |   ddtj ¡\}}| | ¡ ddi¡ | | ¡ dddœ¡ d S )Nr(   ú%s.some_tabler)   r5   )r)   rÛ   )r;   r   rÝ   r:   r<   )r0   r>   r(   Úsome_table_schemar2   r2   r3   r?   ˜  s
    
ÿz$SameNamedSchemaTableTest.insert_datac              	   C   sJ   |   ddtj ¡\}}t| t||ƒ |||jj|jj	k¡¡ 
¡ dƒ d S )Nr(   rÞ   ©r5   r5   r5   )r;   r   rÝ   r   r:   r   Ú	join_fromrL   rÛ   r)   Úfirst©rF   r>   r(   rß   r2   r2   r3   Útest_simple_join_both_tables   s    
ÿ
ýÿøz5SameNamedSchemaTableTest.test_simple_join_both_tablesc              	   C   sV   |   ddtj ¡\}}t| t|ƒ |||jj|jj	k¡ 
|jj	dk¡¡ ¡ dƒ d S )Nr(   rÞ   r5   ©r5   r5   )r;   r   rÝ   r   r:   r   rá   rL   rÛ   r)   Úwhererâ   rã   r2   r2   r3   Ú!test_simple_join_whereclause_only°  s    
ÿü
úÿ	öz:SameNamedSchemaTableTest.test_simple_join_whereclause_onlyc              	   C   sŒ   |   ddtj ¡\}}t|ƒ |||jj|jjk¡ |jjdk¡ 	¡ }t
| t||jjƒ |||jj|jjk¡ |jjdk¡¡ ¡ dƒ d S )Nr(   rÞ   r5   rà   )r;   r   rÝ   r   rá   rL   rÛ   r)   ræ   r‹   r   r:   râ   )rF   r>   r(   rß   Zsubqr2   r2   r3   Útest_subqueryÂ  s.    
ÿü
úÿü
úÿ	öz&SameNamedSchemaTableTest.test_subqueryN)rN   rO   rP   rs   rQ   rx   rR   r4   r?   rä   rç   rè   r2   r2   r2   r3   rÙ   }  s   

rÙ   c                   @   sZ   e Zd ZdZddd„Zedd„ ƒZedd„ ƒZd	d
„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )ÚJoinTestTr2   c                 C   sD   t j ¡ �&}t| ||¡ ¡ |ƒ W d   ƒ n1 s60    Y  d S r@   rA   r‚   r2   r2   r3   rI   ã  s    zJoinTest._assert_resultc              	   C   s@   t d|tdtdd�ƒ t d|tdtdd�tdtdƒdd	�ƒ d S )
NÚar)   Tr*   ÚbÚa_idza.idFrÜ   )r   r   r   r   r/   r2   r2   r3   r4   ç  s    üzJoinTest.define_tablesc              	   C   sj   |  | jj ¡ ddiddiddiddiddig¡ |  | jj ¡ dddœdddœdddœdddœg¡ d S )Nr)   r5   r   r   rZ   re   )r)   rì   )r:   r;   rê   r<   rë   r=   r2   r2   r3   r?   ñ  s    
 þ
üþzJoinTest.insert_datac                 C   sJ   |   dd¡\}}t||ƒ | |¡¡ |jj|jj¡}|  |g d¢¡ d S ©Nrê   rë   )rà   )r5   r   r5   )r   rZ   r   )r   re   r   ©r;   r   Úselect_fromÚjoinrK   rL   r)   rI   ©rF   rê   rë   rq   r2   r2   r3   Útest_inner_join_fk  s    &zJoinTest.test_inner_join_fkc              	   C   sd   |   dd¡\}}t||ƒ | |tƒ ¡¡ |jj|jj¡}|  |dd„ t	 
g d¢g d¢¡D ƒ¡ d S )Nrê   rë   c                 S   s    g | ]\\}\}}|||f‘qS r2   r2   )Ú.0rê   rë   rL   r2   r2   r3   Ú
<listcomp>  s   ÿz1JoinTest.test_inner_join_true.<locals>.<listcomp>)r^   r_   r`   ©rZ   rd   )rå   r™   )rZ   r   )re   r   )r;   r   rï   rð   r    rK   rL   r)   rI   Ú	itertoolsÚproductrñ   r2   r2   r3   Útest_inner_join_true	  s     
ÿþÿþþþzJoinTest.test_inner_join_truec                 C   sJ   |   dd¡\}}t||ƒ | |tƒ ¡¡ |jj|jj¡}|  |g ¡ d S )Nrê   rë   )	r;   r   rï   rð   r   rK   rL   r)   rI   rñ   r2   r2   r3   Útest_inner_join_false  s    
ÿþÿzJoinTest.test_inner_join_falsec                 C   sN   |   dd¡\}}t||ƒ | |tƒ ¡¡ |jj|jj¡}|  |g d¢¡ d S )Nrê   rë   ))r5   NN)r   NN)r   NN)rZ   NN)re   NN)	r;   r   rï   Z	outerjoinr   rK   rL   r)   rI   rñ   r2   r2   r3   Útest_outer_join_false(  s    
ÿþÿþzJoinTest.test_outer_join_falsec                 C   sJ   |   dd¡\}}t||ƒ | |¡¡ |jj|jj¡}|  |g d¢¡ d S rí   rî   rñ   r2   r2   r3   Útest_outer_join_fk<  s    &zJoinTest.test_outer_join_fkN)r2   )rN   rO   rP   rQ   rI   rR   r4   r?   rò   rø   rù   rú   rû   r2   r2   r2   r3   ré   à  s   

	
ré   c                   @   sŠ   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e
jjdd„ ƒZdd„ ZdS )ÚCompoundSelectTestTc                 C   s*   t d|tdtdd�tdtƒtdtƒƒ d S rz   r{   r/   r2   r2   r3   r4   G  s    ûz CompoundSelectTest.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 )Nr5   r   r|   r   rZ   re   r9   r=   r2   r2   r3   r?   Q  s    




üþzCompoundSelectTest.insert_datar2   c                 C   sD   t j ¡ �&}t| ||¡ ¡ |ƒ W d   ƒ n1 s60    Y  d S r@   rA   r‚   r2   r2   r3   rI   ]  s    z!CompoundSelectTest._assert_resultc                 C   s\   | j j}t|ƒ |jjdk¡}t|ƒ |jjdk¡}t||ƒ}|  | |j	j¡ddg¡ d S ©Nr   r   r†   rˆ   )
r;   r(   r   ræ   rL   r)   r#   rI   rK   Úselected_columns©rF   r   Ús1Ús2Úu1r2   r2   r3   Útest_plain_uniona  s    
ÿz#CompoundSelectTest.test_plain_unionc                 C   sd   | j j}t|ƒ |jjdk¡}t|ƒ |jjdk¡}t||ƒ ¡  ¡ }|  | 	|j
j¡ddg¡ d S rý   )r;   r(   r   ræ   rL   r)   r#   ÚaliasrI   rK   rþ   rÿ   r2   r2   r3   Útest_select_from_plain_unionk  s    ÿz/CompoundSelectTest.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¡}|  	| |j
j¡ddg¡ d S ©Nr   r5   r   r†   rˆ   )r;   r(   r   ræ   rL   r)   r‰   rK   r#   rI   rþ   rÿ   r2   r2   r3   Ú&test_limit_offset_selectable_in_unionsu  s    &&ÿz9CompoundSelectTest.test_limit_offset_selectable_in_unionsc                 C   sv   | j j}t|ƒ |jjdk¡ |jj¡}t|ƒ |jjdk¡ |jj¡}t||ƒ d¡}|  	| |j
j¡ddg¡ d S rý   )r;   r(   r   ræ   rL   r)   rK   r#   r‰   rI   rþ   rÿ   r2   r2   r3   Ú"test_order_by_selectable_in_unions�  s      ÿz5CompoundSelectTest.test_order_by_selectable_in_unionsc                 C   sj   | j j}t|ƒ |jjdk¡ ¡ }t|ƒ |jjdk¡ ¡ }t||ƒ d¡}|  	| 
|jj¡ddg¡ d S rý   )r;   r(   r   ræ   rL   r)   Údistinctr#   r‰   rI   rK   rþ   rÿ   r2   r2   r3   Ú"test_distinct_selectable_in_unionsŒ  s    ÿz5CompoundSelectTest.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¡ |jj¡ddg¡ d S r  )r;   r(   r   ræ   rL   r)   r‰   rK   r#   r  rI   rÿ   r2   r2   r3   Ú&test_limit_offset_in_unions_from_alias–  s    &&ÿz9CompoundSelectTest.test_limit_offset_in_unions_from_aliasc                 C   s’   | j j}t|ƒ |jjdk¡ d¡ |jj¡ ¡  ¡ }t|ƒ |jjdk¡ d¡ |jj¡ ¡  ¡ }t	||ƒ d¡}|  
| |jj¡ddg¡ d S r  )r;   r(   r   ræ   rL   r)   r‰   rK   r  r#   rI   rþ   rÿ   r2   r2   r3   Ú.test_limit_offset_aliased_selectable_in_unions¢  s*    
ÿþý
ÿ	
ÿþý
ÿ	ÿzACompoundSelectTest.test_limit_offset_aliased_selectable_in_unionsN)r2   )rN   rO   rP   rQ   rR   r4   r?   rI   r  r  r   rJ   Zorder_by_col_from_unionZ/parens_in_union_contained_select_w_limit_offsetr  Z0parens_in_union_contained_select_wo_limit_offsetr  r
  r  r  r2   r2   r2   r3   rü   D  s"   
	








rü   c                   @   sl   e Zd ZdZdZedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dd„ Z
dd„ Zejjdd„ ƒZejjdd„ ƒZdS )ÚPostCompileParamsTestT)Zstandard_cursor_sqlc              
   C   s6   t d|tdtdd�tdtƒtdtƒtdtdƒƒƒ d S ©	Nr(   r)   Tr*   rT   rU   ÚzrW   r.   r/   r2   r2   r3   r4   Â  s    úz#PostCompileParamsTest.define_tablesc                 C   sH   |  | jj ¡ dddddœdddddœdddddœddd	d
dœg¡ d S ©Nr5   r   Úz1)r)   rT   rU   r  r   Úz2rZ   Úz3re   Úz4r9   r=   r2   r2   r3   r?   Í  s    
üþz!PostCompileParamsTest.insert_datac                 C   s<   | j j}t|jjƒ |jjtddd�k¡}|  |di ¡ d S )NrV   T©Úliteral_executezKSELECT some_table.id FROM some_table WHERE some_table.x = __[POSTCOMPILE_q]©	r;   r(   r   rL   r)   ræ   rT   r   Úassert_compile©rF   r   rq   r2   r2   r3   Útest_compileÙ  s    ÿüz"PostCompileParamsTest.test_compilec                 C   sB   | j j}t|jjƒ |jjtdddd�k¡}| j|di dd� d S )NrV   r¤   Tr  z<SELECT some_table.id FROM some_table WHERE some_table.x = 10)rª   r  r  r2   r2   r3   Útest_compile_literal_bindsç  s    ÿüz0PostCompileParamsTest.test_compile_literal_bindsc              	   C   s°   | j j}t|jjƒ |jjtddd�k¡}|  ¡ �L}t	j
 ¡ �"}| |tdd�¡ W d   ƒ n1 sf0    Y  W d   ƒ n1 s„0    Y  | tdt	j
jjr¤dni ƒ¡ d S )NrV   Tr  r¤   ©rV   z>SELECT some_table.id 
FROM some_table 
WHERE some_table.x = 10r2   )r;   r(   r   rL   r)   ræ   rT   r   Úsql_execution_asserterr   rB   rC   r:   ÚdictÚassert_r
   r«   Ú
positional©rF   r   rq   ZasserterrH   r2   r2   r3   Útest_executeõ  s    ÿ
Nýÿz"PostCompileParamsTest.test_executec              	   C   s¸   | j j}t|jjƒ |jj tdddd�¡¡}|  	¡ �P}t
j ¡ �&}| |tg d¢d�¡ W d   ƒ n1 sn0    Y  W d   ƒ n1 sŒ0    Y  | tdt
jjjr¬dni ƒ¡ d S )NrV   T©Ú	expandingr  )re   r}   rg   r  zFSELECT some_table.id 
FROM some_table 
WHERE some_table.x IN (5, 6, 7)r2   )r;   r(   r   rL   r)   ræ   rT   r	   r   r  r   rB   rC   r:   r  r  r
   r«   r   r!  r2   r2   r3   Ú+test_execute_expanding_plus_literal_execute  s    ÿ
RýÿzAPostCompileParamsTest.test_execute_expanding_plus_literal_executec              	   C   sÔ   | j j}t|jjƒ t|jj|jjƒ 	t
dddd�¡¡}|  ¡ �P}tj ¡ �&}| |tddgd�¡ W d   ƒ n1 sx0    Y  W d   ƒ n1 s–0    Y  | tdtjjjr¶dnd	 tjjjrÈd
ni ƒ¡ d S )NrV   Tr#  )re   r¤   )é   é   r  zbSELECT some_table.id 
FROM some_table 
WHERE (some_table.x, some_table.y) IN (%s(5, 10), (12, 18))úVALUES Ú r2   )r;   r(   r   rL   r)   ræ   r!   rT   rU   r	   r   r  r   rB   rC   r:   r  r  r
   r«   Útuple_in_valuesr   r!  r2   r2   r3   Ú1test_execute_tuple_expanding_plus_literal_execute  s"    ÿÿ
RýûÿzGPostCompileParamsTest.test_execute_tuple_expanding_plus_literal_executec              	   C   sÔ   | j j}t|jjƒ t|jj|jjƒ 	t
dddd�¡¡}|  ¡ �P}tj ¡ �&}| |tddgd�¡ W d   ƒ n1 sx0    Y  W d   ƒ n1 s–0    Y  | tdtjjjr¶dnd	 tjjjrÈd
ni ƒ¡ d S )NrV   Tr#  )re   r  )r&  r  r  zfSELECT some_table.id 
FROM some_table 
WHERE (some_table.x, some_table.z) IN (%s(5, 'z1'), (12, 'z3'))r(  r)  r2   )r;   r(   r   rL   r)   ræ   r!   rT   r  r	   r   r  r   rB   rC   r:   r  r  r
   r«   r*  r   r!  r2   r2   r3   Ú?test_execute_tuple_expanding_plus_literal_heterogeneous_execute3  s"    ÿÿ
RýûÿzUPostCompileParamsTest.test_execute_tuple_expanding_plus_literal_heterogeneous_executeN)rN   rO   rP   r×   rx   rR   r4   r?   r  r  r"  r%  r   rJ   Útuple_inr+  r,  r2   r2   r2   r3   r  »  s   



r  c                   @   sr  e Zd ZdZedd„ ƒZedd„ ƒZdDdd„Zd	d
„ Zdd„ Z	e
jjdd„ ƒZe
jjdd„ ƒZe
jjdd„ ƒZe
jjdd„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Ze
jjd!d"„ ƒZe
jjd#d$„ ƒZe
jjd%d&„ ƒZe
jjd'd(„ ƒZe
jjd)d*„ ƒZe
jjd+d,„ ƒZe
jjd-d.„ ƒZd/d0„ Zd1d2„ Z d3d4„ Z!d5d6„ Z"d7d8„ Z#d9d:„ Z$d;d<„ Z%d=d>„ Z&d?d@„ Z'dAdB„ Z(dCS )EÚExpandingBoundInTestTc              
   C   s6   t d|tdtdd�tdtƒtdtƒtdtdƒƒƒ d S r  r.   r/   r2   r2   r3   r4   O  s    úz"ExpandingBoundInTest.define_tablesc                 C   sH   |  | jj ¡ dddddœdddddœdddddœddd	d
dœg¡ d S r  r9   r=   r2   r2   r3   r?   Z  s    
üþz ExpandingBoundInTest.insert_datar2   c                 C   sD   t j ¡ �&}t| ||¡ ¡ |ƒ W d   ƒ n1 s60    Y  d S r@   rA   r‚   r2   r2   r3   rI   f  s    z#ExpandingBoundInTest._assert_resultc                 C   s`   | j j}t|jjƒ |jj tdƒ¡¡ |jj	 tdƒ¡¡ 
|jj¡}| j|g g g dœd� d S )NrV   rX   )rV   rX   r³   )r;   r(   r   rL   r)   ræ   rT   r	   r   rU   rK   rI   r  r2   r2   r3   Ú"test_multiple_empty_sets_bindparamj  s    ÿþýÿz7ExpandingBoundInTest.test_multiple_empty_sets_bindparamc                 C   sN   | j j}t|jjƒ |jj g ¡¡ |jj g ¡¡ 	|jj¡}|  
|g ¡ d S r@   )r;   r(   r   rL   r)   ræ   rT   r	   rU   rK   rI   r  r2   r2   r3   Útest_multiple_empty_sets_directv  s    ÿþýÿz4ExpandingBoundInTest.test_multiple_empty_sets_directc                 C   sT   | j j}t|jjƒ t|jj|jjƒ 	t
dƒ¡¡ |jj¡}| j|g dg id� d S ©NrV   r³   ©r;   r(   r   rL   r)   ræ   r!   rT   r  r	   r   rK   rI   r  r2   r2   r3   Ú)test_empty_heterogeneous_tuples_bindparam‚  s    ÿþÿz>ExpandingBoundInTest.test_empty_heterogeneous_tuples_bindparamc                    s@   ˆ j j‰‡ ‡fdd„}|g g ƒ |g d¢g d¢ƒ |g g ƒ d S )Nc                    s@   t ˆjjƒ tˆjjˆjjƒ | ¡¡ ˆjj¡}ˆ  	||¡ d S r@   )
r   rL   r)   ræ   r!   rT   r  r	   rK   rI   ©Úvalr    rq   ©rF   r   r2   r3   Úgo�  s    ÿþÿzGExpandingBoundInTest.test_empty_heterogeneous_tuples_direct.<locals>.go©)r   r  )r   r  )rZ   r  ©r_   r`   rõ   ©r;   r(   ©rF   r7  r2   r6  r3   Ú&test_empty_heterogeneous_tuples_directŒ  s
    
z;ExpandingBoundInTest.test_empty_heterogeneous_tuples_directc                 C   sT   | j j}t|jjƒ t|jj|jjƒ 	t
dƒ¡¡ |jj¡}| j|g dg id� d S r1  ©r;   r(   r   rL   r)   ræ   r!   rT   rU   r	   r   rK   rI   r  r2   r2   r3   Ú'test_empty_homogeneous_tuples_bindparamœ  s    ÿþÿz<ExpandingBoundInTest.test_empty_homogeneous_tuples_bindparamc                    s@   ˆ j j‰‡ ‡fdd„}|g g ƒ |g d¢g d¢ƒ |g g ƒ d S )Nc                    s@   t ˆjjƒ tˆjjˆjjƒ | ¡¡ ˆjj¡}ˆ  	||¡ d S r@   )
r   rL   r)   ræ   r!   rT   rU   r	   rK   rI   r4  r6  r2   r3   r7  ª  s    ÿþÿzEExpandingBoundInTest.test_empty_homogeneous_tuples_direct.<locals>.go))r5   r   ©r   r   ©r   rZ   r]   r:  r;  r2   r6  r3   Ú$test_empty_homogeneous_tuples_direct¦  s
    
z9ExpandingBoundInTest.test_empty_homogeneous_tuples_directc                 C   sR   | j j}t|jjƒ |jj tdƒ¡¡ 	|jj¡}| j
|g d¢dg d¢id� d S )NrV   r9  ©r   r   rZ   r³   ©r;   r(   r   rL   r)   ræ   rT   r	   r   rK   rI   r  r2   r2   r3   Útest_bound_in_scalar_bindparam¶  s    ÿþÿz3ExpandingBoundInTest.test_bound_in_scalar_bindparamc                 C   sF   | j j}t|jjƒ |jj g d¢¡¡ |jj¡}|  	|g d¢¡ d S )NrB  r9  ©
r;   r(   r   rL   r)   ræ   rT   r	   rK   rI   r  r2   r2   r3   Útest_bound_in_scalar_direct¿  s    ÿþÿz0ExpandingBoundInTest.test_bound_in_scalar_directc                 C   sV   | j j}t|jjƒ |jj ddg¡¡ |jj g ¡¡ 	|jj¡}|  
|ddg¡ d S )Nr   r   r_   r`   ©r;   r(   r   rL   r)   ræ   rT   r	   Únot_inrK   rI   r  r2   r2   r3   Ú!test_nonempty_in_plus_empty_notinÈ  s    ÿþýÿz6ExpandingBoundInTest.test_nonempty_in_plus_empty_notinc                 C   sR   | j j}t|jjƒ |jj g ¡¡ |jj ddg¡¡ 	|jj¡}|  
|g ¡ d S )Nr   r   rG  r  r2   r2   r3   Ú!test_empty_in_plus_notempty_notinÒ  s    ÿþýÿz6ExpandingBoundInTest.test_empty_in_plus_notempty_notinc                 C   s8   t dƒ tdtdd�¡}| j|g d¢dg d¢id� dS )	z†test related to #7292.

        as a type is given to the bound param, there is no ambiguity
        to the type of element.

        ú3select id FROM some_table WHERE z IN :q ORDER BY idrV   T©Útype_r$  r9  ©r  r  r  r³   N)r   Ú
bindparamsr   r   rI   ©rF   rq   r2   r2   r3   Útest_typed_str_inÜ  s    ÿþ
ýz&ExpandingBoundInTest.test_typed_str_inc                 C   s6   t dƒ tddd�¡}| j|g d¢dg d¢id� dS )	zÂtest related to #7292.

        for untyped expression, we look at the types of elements.
        Test for Sequence to detect tuple in.  but not strings or bytes!
        as always....

        rK  rV   T©r$  r9  rN  r³   N©r   rO  r   rI   rP  r2   r2   r3   Útest_untyped_str_iní  s    	ÿ
þ
ýz(ExpandingBoundInTest.test_untyped_str_inc                 C   s\   | j j}t|jjƒ t|jj|jjƒ 	t
dƒ¡¡ |jj¡}| j|g d¢dg d¢id� d S )NrV   r9  ©r?  r@  )rZ   re   r³   r=  r  r2   r2   r3   Ú!test_bound_in_two_tuple_bindparamÿ  s    ÿþÿÿz6ExpandingBoundInTest.test_bound_in_two_tuple_bindparamc                 C   sP   | j j}t|jjƒ t|jj|jjƒ 	g d¢¡¡ 
|jj¡}|  |g d¢¡ d S )NrU  r9  )r;   r(   r   rL   r)   ræ   r!   rT   rU   r	   rK   rI   r  r2   r2   r3   Útest_bound_in_two_tuple_direct  s    ÿþÿz3ExpandingBoundInTest.test_bound_in_two_tuple_directc                 C   s\   | j j}t|jjƒ t|jj|jjƒ 	t
dƒ¡¡ |jj¡}| j|g d¢dg d¢id� d S )NrV   r9  r8  r³   r2  r  r2   r2   r3   Ú/test_bound_in_heterogeneous_two_tuple_bindparam  s    ÿþÿ
ýzDExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_bindparamc                 C   sP   | j j}t|jjƒ t|jj|jjƒ 	g d¢¡¡ 
|jj¡}|  |g d¢¡ d S )Nr8  r9  )r;   r(   r   rL   r)   ræ   r!   rT   r  r	   rK   rI   r  r2   r2   r3   Ú,test_bound_in_heterogeneous_two_tuple_direct#  s    ÿþúÿ	þzAExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_directc                 C   s6   t dƒ tddd�¡}| j|g d¢dg d¢id� d S )Nú8select id FROM some_table WHERE (x, z) IN :q ORDER BY idrV   TrR  r9  r8  r³   rS  rP  r2   r2   r3   Ú4test_bound_in_heterogeneous_two_tuple_text_bindparam4  s    ÿ
þ
ýzIExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparamc              	   C   sh   G dd„ dt jƒ}tdƒ tdttƒ tƒ ƒdd�¡}| j|g d¢d|dd	ƒ|d
dƒ|ddƒgid� d S )Nc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
zhExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuplec                 W   s
   || _ d S r@   ©Ú_data©rF   r,   r2   r2   r3   Ú__init__D  s    zqExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__init__c                 S   s
   t | jƒS r@   ©Úiterr]  ©rF   r2   r2   r3   Ú__iter__G  s    zqExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__iter__c                 S   s
   | j | S r@   r\  ©rF   Úidxr2   r2   r3   Ú__getitem__J  s    ztExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__getitem__c                 S   s
   t | jƒS r@   ©r~   r]  rb  r2   r2   r3   Ú__len__M  s    zpExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__len__N©rN   rO   rP   r_  rc  rf  rh  r2   r2   r2   r3   Ú
LikeATupleC  s   rj  rZ  rV   TrL  r9  r   r  r   r  rZ   r  r³   )	Úcollections_abcÚSequencer   rO  r   r"   r   r   rI   ©rF   rj  rq   r2   r2   r3   Ú?test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tupleA  s$    ÿÿýýÿýzTExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuplec              	   C   s\   G dd„ dt jƒ}tdƒ tddd�¡}| j|g d¢d|dd	ƒ|d
dƒ|ddƒgid� d S )Nc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
zgExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuplec                 W   s
   || _ d S r@   r\  r^  r2   r2   r3   r_  i  s    zpExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__init__c                 S   s
   t | jƒS r@   r`  rb  r2   r2   r3   rc  l  s    zpExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__iter__c                 S   s
   | j | S r@   r\  rd  r2   r2   r3   rf  o  s    zsExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__getitem__c                 S   s
   t | jƒS r@   rg  rb  r2   r2   r3   rh  r  s    zoExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__len__Nri  r2   r2   r2   r3   rj  h  s   rj  rZ  rV   TrR  r9  r   r  r   r  rZ   r  r³   )rk  rl  r   rO  r   rI   rm  r2   r2   r3   Ú>test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuplec  s     ÿ
þýÿýzSExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuplec                 C   sJ   | j j}t|jjƒ |jj tdƒ¡¡ 	|jj¡}| j
|g dg id� d S r1  rC  r  r2   r2   r3   Ú(test_empty_set_against_integer_bindparam„  s    ÿþÿz=ExpandingBoundInTest.test_empty_set_against_integer_bindparamc                 C   s>   | j j}t|jjƒ |jj g ¡¡ |jj¡}|  	|g ¡ d S r@   rE  r  r2   r2   r3   Ú%test_empty_set_against_integer_direct�  s    &z:ExpandingBoundInTest.test_empty_set_against_integer_directc                 C   sN   | j j}t|jjƒ |jj tdƒ¡¡ 	|jj¡}| j
|g d¢dg id� d S ©NrV   ©r^   r_   r`   rõ   r³   )r;   r(   r   rL   r)   ræ   rT   rH  r   rK   rI   r  r2   r2   r3   Ú1test_empty_set_against_integer_negation_bindparam’  s    ÿþÿzFExpandingBoundInTest.test_empty_set_against_integer_negation_bindparamc                 C   sB   | j j}t|jjƒ |jj g ¡¡ |jj¡}|  	|g d¢¡ d S ©Nrs  )
r;   r(   r   rL   r)   ræ   rT   rH  rK   rI   r  r2   r2   r3   Ú.test_empty_set_against_integer_negation_direct›  s    $ÿzCExpandingBoundInTest.test_empty_set_against_integer_negation_directc                 C   sJ   | j j}t|jjƒ |jj tdƒ¡¡ 	|jj¡}| j
|g dg id� d S r1  )r;   r(   r   rL   r)   ræ   r  r	   r   rK   rI   r  r2   r2   r3   Ú'test_empty_set_against_string_bindparam¢  s    ÿþÿz<ExpandingBoundInTest.test_empty_set_against_string_bindparamc                 C   s>   | j j}t|jjƒ |jj g ¡¡ |jj¡}|  	|g ¡ d S r@   )
r;   r(   r   rL   r)   ræ   r  r	   rK   rI   r  r2   r2   r3   Ú$test_empty_set_against_string_direct«  s    &z9ExpandingBoundInTest.test_empty_set_against_string_directc                 C   sN   | j j}t|jjƒ |jj tdƒ¡¡ 	|jj¡}| j
|g d¢dg id� d S rr  )r;   r(   r   rL   r)   ræ   r  rH  r   rK   rI   r  r2   r2   r3   Ú0test_empty_set_against_string_negation_bindparam°  s    ÿþÿzEExpandingBoundInTest.test_empty_set_against_string_negation_bindparamc                 C   sB   | j j}t|jjƒ |jj g ¡¡ |jj¡}|  	|g d¢¡ d S ru  )
r;   r(   r   rL   r)   ræ   r  rH  rK   rI   r  r2   r2   r3   Ú-test_empty_set_against_string_negation_direct¹  s    $ÿzBExpandingBoundInTest.test_empty_set_against_string_negation_directc                 C   sD   t ttƒ  tddd�¡tƒ ftƒ d�ƒ}t| |¡ ¡ d dƒ d S )NÚfoor2   )Úvalue©Zelse_r   ©Fr   )	r   r   r   r	   r   r    r   r:   Úfetchone©rF   r>   rq   r2   r2   r3   Ú)test_null_in_empty_set_is_false_bindparamÀ  s    þûÿ	z>ExpandingBoundInTest.test_null_in_empty_set_is_false_bindparamc                 C   s<   t ttƒ  g ¡tƒ ftƒ d�ƒ}t| |¡ ¡ d dƒ d S )Nr}  r   r~  )r   r   r   r	   r    r   r:   r  r€  r2   r2   r3   Ú&test_null_in_empty_set_is_false_directÌ  s    
þûÿ	z;ExpandingBoundInTest.test_null_in_empty_set_is_false_directN)r2   ))rN   rO   rP   r×   rR   r4   r?   rI   r/  r0  r   rJ   Ztuple_in_w_emptyr3  r<  r>  rA  rD  rF  rI  rJ  rQ  rT  r-  rV  rW  rX  rY  r[  rn  ro  rp  rq  rt  rv  rw  rx  ry  rz  r�  r‚  r2   r2   r2   r3   r.  L  s\   




	

	
		



	



!
 				r.  c                   @   sv  e Zd ZdZdZdZedd„ ƒZedd„ ƒZdd	„ Z	d
d„ Z
ejjdd„ ƒZdd„ Zejjdd„ ƒZejjdd„ ƒZdd„ Zdd„ Zejjdd„ ƒZejjdd„ ƒZejjdd„ ƒZdd„ Zejjd d!„ ƒZejjd"d#„ ƒZejjd$d%„ ƒZejjd&d'„ ƒZejjd(d)„ ƒZejje d*h d+£fd,h d-£fd.h d-£fd/d0hfd1e e!d2d3ƒƒfd4e e!d2d3ƒƒfd5e ƒ f¡d6d7„ ƒƒZ"dS )8ÚLikeFunctionsTestTÚonceNc                 C   s&   t d|tdtdd�tdtdƒƒƒ d S )Nr(   r)   Tr*   r,   rW   r.   r/   r2   r2   r3   r4   ß  s    üzLikeFunctionsTest.define_tablesc                 C   sp   |  | jj ¡ dddœdddœdddœdd	dœd
ddœdddœdddœdddœdddœdddœdd dœg¡ d S )Nr5   Zabcdefgr7   r   zab/cdefgr   zab%cdefgrZ   Zab_cdefgre   zabcde/fgr}   zabcde%fgrg   zab#cdefgé   Zab9cdefgé	   zabcde#fgr¤   Zabcd9fgé   r9   r=   r2   r2   r3   r?   è  s    
õþzLikeFunctionsTest.insert_datac                 C   sb   | j j}tj ¡ �2}dd„ | t|jjƒ 	|¡¡D ƒ}W d   ƒ n1 sJ0    Y  t
||ƒ d S )Nc                 S   s   h | ]
\}|’qS r2   r2   )ró   r|  r2   r2   r3   Ú	<setcomp>ÿ  s   ÿz*LikeFunctionsTest._test.<locals>.<setcomp>)r;   r(   r   rB   rC   r:   r   rL   r)   ræ   r   )rF   rp   r    r(   rH   Úrowsr2   r2   r3   Ú_testû  s    þ$zLikeFunctionsTest._testc                 C   s&   | j jjj}|  | d¡h d£¡ d S )Núab%c¾
   r5   r   r   rZ   re   r}   rg   r…  r†  r¤   ©r;   r(   rL   r,   rŠ  Ú
startswith©rF   Úcolr2   r2   r3   Útest_startswith_unescaped  s    z+LikeFunctionsTest.test_startswith_unescapedc                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nr‹  T©Ú
autoescaper   r�  r�  r2   r2   r3   Útest_startswith_autoescape
  s    z,LikeFunctionsTest.test_startswith_autoescapec                 C   s*   | j jjj}|  | tdƒ¡h d£¡ d S )Nz'ab%c'rŒ  )r;   r(   rL   r,   rŠ  rŽ  r   r�  r2   r2   r3   Útest_startswith_sqlexpr  s
    þz)LikeFunctionsTest.test_startswith_sqlexprc                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nzab##cú#©Úescaperg   r�  r�  r2   r2   r3   Útest_startswith_escape  s    z(LikeFunctionsTest.test_startswith_escapec                 C   sD   | j jjj}|  |jdddd�dh¡ |  |jdddd�dh¡ d S )Nr‹  Tr–  ©r“  r˜  r   zab#crg   r�  r�  r2   r2   r3   Ú!test_startswith_autoescape_escape  s    z3LikeFunctionsTest.test_startswith_autoescape_escapec                 C   s&   | j jjj}|  | d¡h d£¡ d S )Núe%fg¾	   r5   r   r   rZ   re   r}   rg   r…  r†  ©r;   r(   rL   r,   rŠ  Úendswithr�  r2   r2   r3   Útest_endswith_unescaped!  s    z)LikeFunctionsTest.test_endswith_unescapedc                 C   s*   | j jjj}|  | tdƒ¡h d£¡ d S )Nz'e%fg'r�  )r;   r(   rL   r,   rŠ  rŸ  r   r�  r2   r2   r3   Útest_endswith_sqlexpr%  s    ÿz'LikeFunctionsTest.test_endswith_sqlexprc                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nrœ  Tr’  r}   rž  r�  r2   r2   r3   Útest_endswith_autoescape+  s    z*LikeFunctionsTest.test_endswith_autoescapec                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nze##fgr–  r—  r†  rž  r�  r2   r2   r3   Útest_endswith_escape0  s    z&LikeFunctionsTest.test_endswith_escapec                 C   sD   | j jjj}|  |jdddd�dh¡ |  |jdddd�dh¡ d S )Nrœ  Tr–  rš  r}   ze#fgr†  rž  r�  r2   r2   r3   Útest_endswith_autoescape_escape5  s    z1LikeFunctionsTest.test_endswith_autoescape_escapec                 C   s&   | j jjj}|  | d¡h d£¡ d S )Núb%cder�  ©r;   r(   rL   r,   rŠ  Úcontainsr�  r2   r2   r3   Útest_contains_unescaped;  s    z)LikeFunctionsTest.test_contains_unescapedc                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nr¥  Tr’  r   r¦  r�  r2   r2   r3   Útest_contains_autoescape?  s    z*LikeFunctionsTest.test_contains_autoescapec                 C   s(   | j jjj}|  |jddd�dh¡ d S )Nzb##cder–  r—  rg   r¦  r�  r2   r2   r3   Útest_contains_escapeD  s    z&LikeFunctionsTest.test_contains_escapec                 C   sD   | j jjj}|  |jdddd�dh¡ |  |jdddd�dh¡ d S )Nzb%cdTr–  rš  r   zb#cdrg   r¦  r�  r2   r2   r3   Útest_contains_autoescape_escapeI  s    z1LikeFunctionsTest.test_contains_autoescape_escapec                 C   s(   | j jjj}|  | d¡ h d£¡ d S )Núa.cde>   r   r   rZ   rg   r…  r¤   ©r;   r(   rL   r,   rŠ  Úregexp_matchr�  r2   r2   r3   Útest_not_regexp_matchO  s    z'LikeFunctionsTest.test_not_regexp_matchc                 C   s.   | j jjj}|  | dd¡ d¡h d£¡ d S )Nr¬  ZFOO¾   r5   re   r}   r†  )r;   r(   rL   r,   rŠ  Úregexp_replacer§  r�  r2   r2   r3   Útest_regexp_replaceT  s    ÿz%LikeFunctionsTest.test_regexp_replacer¬  r°  Úabc>   r5   re   r}   r†  r¤   z^abcZ9cder…  z^ar5   r‡  z(b|c)z^(b|c)c                 C   s"   | j jjj}|  | |¡|¡ d S r@   r­  )rF   r   r    r�  r2   r2   r3   Útest_regexp_match[  s    z#LikeFunctionsTest.test_regexp_match)#rN   rO   rP   rQ   Úrun_insertsÚrun_deletesrR   r4   r?   rŠ  r‘  r   rJ   Zlike_escapesr”  r•  r™  r›  r   r¡  r¢  r£  r¤  r¨  r©  rª  r«  r®  r¯  r±  r²  rØ   r   Úranger´  r2   r2   r2   r3   rƒ  Ù  s\   















ù	rƒ  c                   @   s<   e Zd ZdZdZedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dS )ÚComputedColumnTestT)Zcomputed_columnsc                 C   s>   t d|tdtdd�tdtƒtdttdƒƒtdttd	ƒƒƒ d S )
NÚsquarer)   Tr*   ÚsideÚareazside * sideÚ	perimeterz4 * side)r   r   r   r   r/   r2   r2   r3   r4   n  s    úz ComputedColumnTest.define_tablesc                 C   s(   |  | jj ¡ dddœdddœg¡ d S )Nr5   r¤   )r)   rº  é*   )r:   r;   r¹  r<   r=   r2   r2   r3   r?   y  s    
þzComputedColumnTest.insert_datac                 C   sj   t j ¡ �L}| ttdƒƒ | jj¡ 	| jjj
j¡¡ ¡ }t|ddgƒ W d   ƒ n1 s\0    Y  d S )NÚ*)r5   r¤   r-   rÒ   )r¤   r½  éä  é¨   )r   rB   rC   r:   r   r   rï   r;   r¹  rK   rL   r)   rD   r   ©rF   rH   Úresr2   r2   r3   Útest_select_all€  s    ÿ
þÿz"ComputedColumnTest.test_select_allc                 C   sx   t j ¡ �Z}| t| jjjj| jjjj	ƒ 
| jj¡ | jjjj¡¡ ¡ }t|ddgƒ W d   ƒ n1 sj0    Y  d S )N)r-   rÒ   )r¿  rÀ  )r   rB   rC   r:   r   r;   r¹  rL   r»  r¼  rï   rK   r)   rD   r   rÁ  r2   r2   r3   Útest_select_columns‰  s    ÿý
üÿz&ComputedColumnTest.test_select_columnsN)
rN   rO   rP   rQ   rx   rR   r4   r?   rÃ  rÄ  r2   r2   r2   r3   r¸  j  s   


	r¸  c                   @   sT   e Zd ZdZdZdZdZedd„ ƒZedd„ ƒZ	dd	„ Z
d
d„ Zejjdd„ ƒZdS )ÚIdentityColumnTestT)Zidentity_columnsr„  c                 C   sd   t d|tdttddddd�dd�tdtdƒƒƒ t d	|tdttd
dddd�dd�tdtdƒƒƒ d S )NÚtbl_ar)   Tr½  )ÚalwaysÚstartZ
nominvalueZ
nomaxvaluer*   rk   r-   Útbl_béûÿÿÿr   iüÿÿ)Ú	incrementrÈ  ZminvalueZmaxvalue©r   r   r   r   r   r/   r2   r2   r3   r4   ›  s0    ÿúõü÷z IdentityColumnTest.define_tablesc                 C   s`   |  | jj ¡ ddiddig¡ |  | jj ¡ ddiddig¡ |  | jj ¡ dddœg¡ d S )Nrk   rê   rë   r½  rL   ©r)   rk   )r:   r;   rÆ  r<   rÉ  r=   r2   r2   r3   r?   ¶  s    
þ
þ

þzIdentityColumnTest.insert_datac                 C   s|   |  ttdƒƒ | jj¡ | jjjj¡¡ 	¡ }t
|ddgƒ |  ttdƒƒ | jj¡ | jjjj¡¡ 	¡ }t
|g d¢ƒ d S )Nr¾  )r½  rê   )é+   rë   ))rÊ  rë   )r   rê   )r½  rL   )r:   r   r   rï   r;   rÆ  rK   rL   r)   rD   r   rÉ  ©rF   r>   rÂ  r2   r2   r3   rÃ  Å  s     ÿ
þÿÿ
þÿz"IdentityColumnTest.test_select_allc                 C   s:   |  t| jjjjƒ | jjjj¡¡ ¡ }t|ddgƒ d S )N)r½  )rÎ  )	r:   r   r;   rÆ  rL   r)   rK   rD   r   rÏ  r2   r2   r3   rÄ  Ô  s    ÿz&IdentityColumnTest.test_select_columnsc                    s    ‡ ‡fdd„}t ttf|ƒ d S )Nc                      s    ˆ   ˆjj ¡ dddœg¡ d S )NéÈ   rê   rÍ  )r:   r;   rÆ  r<   r2   ©r>   rF   r2   r3   ÚfnÜ  s    

þz7IdentityColumnTest.test_insert_always_error.<locals>.fn)r   r%   r&   )rF   r>   rÒ  r2   rÑ  r3   Útest_insert_always_errorÚ  s    z+IdentityColumnTest.test_insert_always_errorN)rN   rO   rP   r×   rx   rµ  r¶  rR   r4   r?   rÃ  rÄ  r   rJ   Zidentity_columns_standardrÓ  r2   r2   r2   r3   rÅ  •  s   

rÅ  c                   @   s(   e Zd ZdZdZedd„ ƒZdd„ ZdS )ÚIdentityAutoincrementTestT)Zautoincrement_without_sequencec              
   C   s,   t d|tdttƒ ddd�tdtdƒƒƒ d S )NÚtblr)   T)r+   Zautoincrementrk   r-   rÌ  r/   r2   r2   r3   r4   é  s    ûöz'IdentityAutoincrementTest.define_tablesc                 C   s<   |  | jj ¡ ddi¡ |  | jj ¡ ¡ ¡ }t|dƒ d S )Nrk   Úrow)r5   rÖ  )r:   r;   rÕ  r<   r   râ   r   rÏ  r2   r2   r3   Ú test_autoincrement_with_identityø  s    z:IdentityAutoincrementTest.test_autoincrement_with_identityN)rN   rO   rP   r×   rx   rR   r4   r×  r2   r2   r2   r3   rÔ  å  s
   
rÔ  c                   @   s8   e Zd ZdZedd„ ƒZedd„ ƒZdd„ Zdd	„ Zd
S )Ú
ExistsTestTc                 C   s&   t d|tdtdd�tdtdƒƒƒ d S )NÚstuffr)   Tr*   r,   rW   r.   r/   r2   r2   r3   r4     s    üzExistsTest.define_tablesc              	   C   s8   |  | jj ¡ dddœdddœdddœdddœg¡ d S )Nr5   ú	some datar7   r   r   rZ   zsome other data)r:   r;   rÙ  r<   r=   r2   r2   r3   r?   
  s    
üþzExistsTest.insert_datac              	   C   s@   | j j}t| ttdƒƒ tƒ  |jj	dk¡¡¡ 
¡ dgƒ d S )Nr5   rÚ  r^   ©r;   rÙ  r   r:   r   r   ræ   r   rL   r,   rD   ©rF   r>   rÙ  r2   r2   r3   Útest_select_exists  s    ÿÿúzExistsTest.test_select_existsc              	   C   s>   | j j}t| ttdƒƒ tƒ  |jj	dk¡¡¡ 
¡ g ƒ d S )Nr5   zno datarÛ  rÜ  r2   r2   r3   Útest_select_exists_false!  s    ÿÿúz#ExistsTest.test_select_exists_falseN)	rN   rO   rP   rQ   rR   r4   r?   rÝ  rÞ  r2   r2   r2   r3   rØ  þ  s   

rØ  c                   @   s&   e Zd ZdZe ejj¡dd„ ƒZdS )ÚDistinctOnTestTc                 C   sV   t dƒ tdƒ¡ tdƒ¡}t d¡� |  |d¡ W d   ƒ n1 sH0    Y  d S )Nr¾  rV   r{  z:DISTINCT ON is currently supported only by the PostgreSQL zSELECT DISTINCT * FROM foo)r   r	  r   rï   r   r   Zexpect_deprecatedr  )rF   Zstmr2   r2   r3   Útest_distinct_on0  s
    ÿzDistinctOnTest.test_distinct_onN)	rN   rO   rP   rQ   r   Zfails_ifrJ   Zsupports_distinct_onrà  r2   r2   r2   r3   rß  -  s   rß  c                	   @   s@   e Zd ZdZdZedd„ ƒZejddddd	d
dd�dd„ ƒZ	dS )ÚIsOrIsNotDistinctFromTestT)Zsupports_is_distinct_fromc              
   C   s2   t d|tdtdd�tdtdd�tdtdd�ƒ d S )NÚis_distinct_testr)   Tr*   Úcol_arÜ   Úcol_br{   r/   r2   r2   r3   r4   =  s    ûz'IsOrIsNotDistinctFromTest.define_tables)Zboth_int_differentr   r5   r5   )Zboth_int_samer5   r5   r   )Zone_null_firstNr5   r5   )Zone_null_secondr   Nr5   )Z	both_nullNNr   Ziaaaz3col_a_value, col_b_value, expected_row_count_for_is)Zid_rž   c                 C   sž   | j j}| | ¡ d||dœg¡ | | ¡  |jj |jj	¡¡¡ 
¡ }tt|ƒ|ƒ |dkrbdnd}| | ¡  |jj |jj	¡¡¡ 
¡ }tt|ƒ|ƒ d S )Nr5   )r)   rã  rä  r   )r;   râ  r:   r<   r   ræ   rL   rã  Zis_distinct_fromrä  rD   r   r~   Zis_not_distinct_from)rF   Zcol_a_valueZcol_b_valueZexpected_row_count_for_isr>   rÕ  rG   Zexpected_row_count_for_is_notr2   r2   r3   Útest_is_or_is_not_distinct_fromG  s*    þÿþÿÿþz9IsOrIsNotDistinctFromTest.test_is_or_is_not_distinct_fromN)
rN   rO   rP   rQ   rx   rR   r4   r   rØ   rå  r2   r2   r2   r3   rá  9  s   
	ù	rá  c                   @   s<   e Zd ZdZdZedd„ ƒZedd„ ƒZdd„ Zd	d
„ Z	dS )ÚWindowFunctionTest)Zwindow_functionsTc                 C   s*   t d|tdtdd�tdtƒtdtƒƒ d S )Nr(   r)   Tr*   Úcol1Úcol2r{   r/   r2   r2   r3   r4   s  s    ûz WindowFunctionTest.define_tablesc                 C   s(   |  | jj ¡ dd„ tddƒD ƒ¡ d S )Nc                 S   s   g | ]}|||d  dœ‘qS )re   )r)   rç  rè  r2   ©ró   Úir2   r2   r3   rô   �  ó    z2WindowFunctionTest.insert_data.<locals>.<listcomp>r5   rW   )r:   r;   r(   r<   r·  r=   r2   r2   r3   r?   }  s    
þzWindowFunctionTest.insert_datac                 C   s`   | j j}| tt |jj¡j|jj	 
¡ gd�ƒ |jj	dk ¡¡ ¡ }t|dd„ tdƒD ƒƒ d S )N)rK   rÎ   c                 S   s   g | ]}d ‘qS ))é_   r2   ré  r2   r2   r3   rô   Ž  rë  z2WindowFunctionTest.test_window.<locals>.<listcomp>é   )r;   r(   r:   r   r   ÚmaxrL   rè  Úoverrç  rk   ræ   rv   r   r·  ©rF   r>   r(   r‰  r2   r2   r3   Útest_window„  s    ÿÿ
üÿzWindowFunctionTest.test_windowc                 C   sT   | j j}| tt |jj¡j|jj	gdd�ƒ¡ 
¡ }t|dd„ tdddƒD ƒƒ d S )N)rÊ  r   )rK   r‰  c                 S   s   g | ]
}|f‘qS r2   r2   ré  r2   r2   r3   rô   ž  rë  z?WindowFunctionTest.test_window_rows_between.<locals>.<listcomp>re   éú   )r;   r(   r:   r   r   rî  rL   rè  rï  rç  rv   r   r·  rð  r2   r2   r3   Útest_window_rows_between�  s    þÿÿ	z+WindowFunctionTest.test_window_rows_betweenN)
rN   rO   rP   rx   rQ   rR   r4   r?   rñ  ró  r2   r2   r2   r3   ræ  n  s   
	
ræ  c                   @   sì   e Zd ZdZd ZZdd„ edƒD ƒZedd„ ƒZ	edd	„ ƒZ
ejd
d„ dd„ edƒD ƒejjfdd„ eedƒƒejjfdd„ eeddƒƒejjfdd„ dgejjfdd„ eeddƒƒejjfdd„ eeddƒƒejjfdd�dd„ ƒZdS )ÚBitwiseTestTr„  c                 C   s   g | ]}||d  dœ‘qS )r5   )rê   rë   r2   ré  r2   r2   r3   rô   ¥  rë  zBitwiseTest.<listcomp>r¤   c                 C   s   t d|tdtƒtdtƒƒ d S )NÚbitwiserê   rë   r{   r/   r2   r2   r3   r4   §  s    zBitwiseTest.define_tablesc                 C   s   |  | jj ¡ | j¡ d S r@   )r:   r;   rõ  r<   Úinserted_datar=   r2   r2   r3   r?   «  s    zBitwiseTest.insert_datac                 C   s
   |   d¡S )Nre   )Zbitwise_xor©rê   r2   r2   r3   Ú<lambda>±  rë  zBitwiseTest.<lambda>c                 C   s   g | ]}|d kr|‘qS rd   r2   ré  r2   r2   r3   rô   ²  rë  c                 C   s
   |   d¡S ©Nr5   )Z
bitwise_orr÷  r2   r2   r3   rø  ¶  rë  c                 C   s
   |   d¡S )NrZ   )Zbitwise_andr÷  r2   r2   r3   rø  »  rë  rZ   r…  c                 C   s   | d   ¡ S ©Nr   )Zbitwise_notr÷  r2   r2   r3   rø  À  rë  r   c                 C   s
   |   d¡S rù  )Zbitwise_lshiftr÷  r2   r2   r3   rø  Å  rë  r5   c                 C   s
   |   d¡S rú  )Zbitwise_rshiftr÷  r2   r2   r3   rø  Ê  rë  zcase, expectedr�   c           	         sd   ˆ j j}|jj}tj||d�}t|ƒ |dk¡ |¡}| 	|¡ 
¡  ¡ }t|‡ fdd„|D ƒƒ d S )Nr÷  r   c                    s   g | ]}ˆ j | ‘qS r2   )rö  ré  rb  r2   r3   rô   Ú  rë  z,BitwiseTest.test_bitwise.<locals>.<listcomp>)r;   rõ  rL   rê   r   Zresolve_lambdar   ræ   rK   r:   Zmappingsrv   r   )	rF   r   r    r>   rÕ  rê   Úoprq   rÂ  r2   rb  r3   Útest_bitwise¯  s    "zBitwiseTest.test_bitwiseN)rN   rO   rP   r×   rµ  r¶  r·  rö  rR   r4   r?   r   rØ   rJ   Zsupports_bitwise_xorÚlistZsupports_bitwise_orZsupports_bitwise_andZsupports_bitwise_notZsupports_bitwise_shiftrü  r2   r2   r2   r3   rô  ¡  sF   

ý
ýýýýýá!rô  )@Úcollections.abcr³  rk  rö   r)  r   r   r   r   Z
assertionsr   r   r	   Z	assertsqlr
   rÚ   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   Úexcr%   r&   Z
TablesTestr'   rS   ZTestBasert   ry   rÙ   ré   rü   r  r.  rƒ  r¸  rÅ  rÔ  rØ  rß  rá  ræ  rô  r2   r2   r2   r3   Ú<module>	   s€   &M   Lcdw
ÿ     +P/53