
    -hO                     n   S SK r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJ	r	  SS
K
Jr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SS KJ!r!  SS!KJ"r"  SS"KJ#r#  SS#KJ$r$  SS$KJ%r%  SS%KJ&r&  SS&K'J(r(  SS'K'J)r)  SS(K%J*r*   " S) S*\RV                  5      r, " S+ S,\RV                  5      r- " S- S.\R\                  5      r/ " S/ S0\RV                  5      r0 " S1 S2\RV                  5      r1 " S3 S4\RV                  5      r2 " S5 S6\\\RV                  5      r3 " S7 S8\RV                  5      r4 " S9 S:\RV                  5      r5 " S; S<\RV                  5      r6 " S= S>\RV                  5      r7 " S? S@\RV                  5      r8 " SA SB\RV                  5      r9 " SC SD\\RV                  5      r: " SE SF\RV                  5      r; " SG SH\RV                  5      r<g)I    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)util)values)DatabaseError)ProgrammingError)collections_abcc                   v    \ rS rSrSr\S 5       r\S 5       rS r\	R                  R                  S 5       rSrg)	CollateTest0   Tc                 `    [        SU[        S[        SS9[        S[        S5      5      5        g )N
some_tableidTprimary_keydatad   r   r   r   r   clsmetadatas     yC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\sqlalchemy/testing/suite/test_select.pydefine_tablesCollateTest.define_tables3   s*    4d366#;'		
    c                 |    UR                  U R                  R                  R                  5       SSS.SSS./5        g )N   collate data1r/   r2   r   collate data2executetablesr.   insertr6   
connections     r8   insert_dataCollateTest.insert_data<   s;    JJ!!((*/2/2	
r;   c                     [         R                  R                  5        n[        UR	                  U5      R                  5       U5        S S S 5        g ! , (       d  f       g = fNr   dbconnectr	   rB   fetchallselfr   resultconns       r8   _assert_resultCollateTest._assert_resultF   <    YY DV$--/8 !     *A
A c                 h   [         R                  R                  [         R                  5      nU R	                  [        U R                  R                  5      R                  U R                  R                  R                  R                  R                  U5      R                  5       5      SS/5        g )N)r=   r>   )r   r@   )r   requiresget_order_by_collationr   rS   r   rC   r.   order_bycr2   collateasc)rP   	collations     r8   test_collate_order_by!CollateTest.test_collate_order_byJ   s    $$;;GNNK	4;;))*33&&((--55i@DDF "#78		
r;    N)__name__
__module____qualname____firstlineno____backend__classmethodr9   rG   rS   r   rX   order_by_collationr_   __static_attributes__ra   r;   r8   r+   r+   0   sR    K
 
 
 
9 ((
 )
r;   r+   c                       \ rS rSrSrSr\S 5       r\S 5       rS r	S r
S rS	 rS
 rS r\R                   R"                  S 5       rSrg)OrderByLabelTestV   zTest the dialect sends appropriate ORDER BY expressions when
labels are used.

This essentially exercises the "supports_simple_order_by_label"
setting.

Tc                     [        SU[        S[        SS9[        S[        5      [        S[        5      [        S[        S5      5      [        S	[        S5      5      5        g )
Nr.   r/   Tr0   xyq2   pr4   r5   s     r8   r9   OrderByLabelTest.define_tablesa   sL    4d33 3 3r
#3r
#	
r;   c                     UR                  U R                  R                  R                  5       SSSSSS.SSSSSS.SSS	S
SS./5        g )Nr=   r   q1p3)r/   rn   ro   rp   rr   r   q2p2   q3p1rA   rE   s     r8   rG   OrderByLabelTest.insert_datam   sU    JJ!!((*qqt$?qqt$?qqt$?	
r;   c                     [         R                  R                  5        n[        UR	                  U5      R                  5       U5        S S S 5        g ! , (       d  f       g = frJ   rK   rO   s       r8   rS   OrderByLabelTest._assert_resultx   rU   rV   c                     U R                   R                  nUR                  R                  R	                  S5      nU R                  [        U5      R                  U5      / SQ5        g )Nlxr=   r   r   )rC   r.   r[   rn   labelrS   r   rZ   rP   r   r   s      r8   
test_plainOrderByLabelTest.test_plain|   sG    &&WWYY__T"F2J//35GHr;   c                     U R                   R                  nUR                  R                  UR                  R                  -   R                  S5      nU R                  [        U5      R                  U5      / SQ5        g )Nr   )r         )	rC   r.   r[   rn   ro   r   rS   r   rZ   r   s      r8   test_composed_int"OrderByLabelTest.test_composed_int   sV    &&ggii%''))#**40F2J//35GHr;   c           	      B   U R                   R                  nUR                  R                  UR                  R                  -   R                  S5      n[        R                  " UR                  R                  5      UR                  R                  -   R                  S5      nU R                  [        X#5      R                  X#R                  5       5      S[        R                  " S5      4S[        R                  " S5      4S[        R                  " S5      4/5        g )	Nr   lyr   q1p3r   q2p2r   q3p1)rC   r.   r[   rn   ro   r   r   lowerrp   rr   rS   r   rZ   descr%   u)rP   r   r   r   s       r8   test_composed_multiple'OrderByLabelTest.test_composed_multiple   s    &&ggii%''))#**40jj#eggii/66t<2N##B	2 1dffVn"5466&>7JK	
r;   c                     U R                   R                  nUR                  R                  R	                  S5      nU R                  [        U5      R                  UR                  5       5      / SQ5        g )Nr   )r   r   r   )	rC   r.   r[   rn   r   rS   r   rZ   r   r   s      r8   test_plain_desc OrderByLabelTest.test_plain_desc   sM    &&WWYY__T"F2J//	:<NOr;   c                    U R                   R                  nUR                  R                  UR                  R                  -   R                  S5      nU R                  [        U5      R                  UR                  5       5      / SQ5        g )Nr   )r   r   r   )
rC   r.   r[   rn   ro   r   rS   r   rZ   r   r   s      r8   test_composed_int_desc'OrderByLabelTest.test_composed_int_desc   s\    &&ggii%''))#**40F2J//	:<NOr;   c                 t   U R                   R                  nUR                  R                  UR                  R                  -   R                  S5      n[        [        R                  " UR                  R                  5      U5      R                  U5      R                  U5      nU R                  U/ SQ5        g )Nr   ))r=   r   )r=   r   )r=   r   )rC   r.   r[   rn   ro   r   r   r   countr/   group_byrZ   rS   )rP   r   exprstmts       r8   test_group_by_composed'OrderByLabelTest.test_group_by_composed   s    &&		EGGII%,,T24::eggjj)4099$?HHN 	 	D":;r;   ra   N)rb   rc   rd   re   __doc__rf   rg   r9   rG   rS   r   r   r   r   r   r   rX   group_by_complex_expressionr   ri   ra   r;   r8   rk   rk   V   sv     K	
 	
 
 
9I
I

P
P
 11< 2<r;   rk   c                   "    \ rS rSrSrSrS rSrg)ValuesExpressionTest   )table_value_constructorTc                     [        [        S[        5      [        S[        5      SS9R	                  / SQ5      n[        UR                  [        U5      5      R                  5       / SQ5        g )Nr/   name	my_values)r   ))r=   name1)r   name2)r   name3)	r&   r   r   r   r2   r	   rB   r   all)rP   rF   
value_exprs      r8   test_tuples ValuesExpressionTest.test_tuples   sX    4!6&&#9

$9
: 	 	vj126686	
r;   ra   N)rb   rc   rd   re   __requires__rf   r   ri   ra   r;   r8   r   r      s    /LK
r;   r   c                   h   \ rS rSrSr\S 5       r\S 5       r S)S jrS*S jr	S r
S	 r\R                  R                  S
 5       r\R                  R                   S 5       r\R$                  " / SQ/ SQ/ SQSS9\R                  R                   S 5       5       r\R                  R                  S 5       r\R                  R*                  S 5       r\R                  R                   S 5       r\R                  R                   S 5       r\R                  R                  S 5       r\R                  R4                  S 5       r\R                  R4                  S 5       r\R                  R4                  S 5       r\R                  R                  S 5       r\R                  R>                  S 5       r \R                  R>                  S 5       r!\R                  R>                  S 5       r"\R                  R                  \R                  RF                  S 5       5       r$\R                  R>                  S 5       r%\R                  R>                  S  5       r&\R                  RN                  S! 5       r(\R                  RN                  \R                  RR                  S" 5       5       r*\R                  RN                  \R                  RR                  S# 5       5       r+\R                  RX                  S$ 5       r-\R                  RX                  \R                  RR                  S% 5       5       r.\R                  RN                  \R                  RX                  S& 5       5       r/\R                  RN                  \R                  RX                  \R                  RR                  S' 5       5       5       r0Sr1g()+FetchLimitOffsetTest   Tc           
      t    [        SU[        S[        SS9[        S[        5      [        S[        5      5        g Nr.   r/   Tr0   rn   ro   r   r   r   r5   s     r8   r9   "FetchLimitOffsetTest.define_tables   0    4d33 3 	
r;   c                     UR                  U R                  R                  R                  5       SSSS.SSSS.SSSS.SSSS.SSSS./5        g )Nr=   r   r/   rn   ro   r   ry   r      rA   rE   s     r8   rG    FetchLimitOffsetTest.insert_data   s]    JJ!!((*qq)qq)qq)qq)qq)		
r;   ra   c                    U(       a\  UR                  X$5      R                  5       n[        [        U5      [        U5      5        [        [	        U5      [	        U5      5        g [        UR                  X$5      R                  5       U5        g rJ   )rB   rN   r	   lenset)rP   rF   r   rQ   paramsset_	query_ress          r8   rS   #FetchLimitOffsetTest._assert_result   sd     "**6:CCEIIF,IF, 
""62;;=vFr;   c                     [         R                  R                  SS9n[        UR	                  X5      R                  5       U5        g )NT)close_with_result)r   rL   rM   r	   exec_driver_sqlrN   rP   r   rQ   r   rR   s        r8   _assert_result_str'FetchLimitOffsetTest._assert_result_str   s7    yy  4 8D  099;VDr;   c                    U R                   R                  n[        U5      R                  UR                  R
                  5      nU R                  UUR                  S5      SS/5        U R                  UUR                  S5      / SQ5        g Nr   r=   r=   r   r   r   r   r   r   r   r   r   ry   )rC   r.   r   rZ   r[   r/   rS   limit)rP   rF   r   r   s       r8   test_simple_limit&FetchLimitOffsetTest.test_simple_limit   sr    &&e}%%eggjj1JJqM	"	

 	JJqM-	
r;   c                 D   U R                   R                  n[        UR                  R                  5      R                  S5      R                  5       n[        [        U5      [        U5      5      R                  5       R                  5       nU R                  UUS/5        g )Nr=   r   )
rC   r.   r   r[   r/   r   scalar_subqueryr$   subqueryrS   )rP   rF   r   r   r   s        r8    test_limit_render_multiple_times5FetchLimitOffsetTest.test_limit_render_multiple_times   sy    &&eggjj!''*::<&,t-668??A	
r;   c                 p   U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  S5      SS/5        U R                  U[        U5      R	                  UR
                  R                  5      R                  S5      / SQ5        g r   rC   r.   rS   r   rZ   r[   r/   fetchrP   rF   r   s      r8   test_simple_fetch&FetchLimitOffsetTest.test_simple_fetch   s    &&5M""577::.44Q7	"	

 	5M""577::.44Q7-	
r;   c                 p   U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  S5      / SQ5        U R                  U[        U5      R	                  UR
                  R                  5      R                  S5      SS/5        g )Nr   r   ry   ry   r   r   ry   r   r   r   r   rC   r.   rS   r   rZ   r[   r/   offsetr   s      r8   test_simple_offset'FetchLimitOffsetTest.test_simple_offset  s    &&5M""577::.55a8-	

 	5M""577::.55a8	"	
r;   )r   r   r   r=   r   r   )r   r   r   )r   r=   r   r   cases)argnamesc                 2   U R                   R                  nUR                  0 S9n/ SQnU Hh  u  pVXFXe-    nU R                  U[	        U5      R                  UR                  R                  5      R                  U5      R                  U5      U5        Mj     g )N)compiled_cacher   r   r   r   r   )
rC   r.   execution_optionsrS   r   rZ   r[   r/   r   r   )rP   rF   r   r   assert_datar   r   expecteds           r8   test_simple_limit_offset-FetchLimitOffsetTest.test_simple_limit_offset  s     &&111D
M"ME"FN;Hu&&uwwzz288?FFvN #r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  S5      R                  S5      SS/5        U R                  U[        U5      R	                  UR
                  R                  5      R                  S5      R                  S5      / SQ5        g )Nr   r=   r   r   r   r   	rC   r.   rS   r   rZ   r[   r/   r   r   r   s      r8   test_simple_fetch_offset-FetchLimitOffsetTest.test_simple_fetch_offset)  s    &&5M""577::.44Q7>>qA	"	
 	5M""577::.44Q7>>qA-	
r;   c                     U R                   R                  nU R                  U[        U5      R	                  S5      / SQSS9  g )N
   r   Tr   )rC   r.   rS   r   r   r   s      r8   test_fetch_offset_no_order/FetchLimitOffsetTest.test_fetch_offset_no_order8  s?    &&5M#C	 	 	
r;   c                 p   U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  S5      / SQ5        U R                  U[        U5      R	                  UR
                  R                  5      R                  S5      / SQ5        g )Nr   r   r=   r   r   r   r   r   r   s      r8   test_simple_offset_zero,FetchLimitOffsetTest.test_simple_offset_zeroB  s    &&5M""577::.55a8C	
 	5M""577::.55a88	
r;   c                 Z   U R                   R                  n[        U5      R                  UR                  R
                  5      R                  S5      R                  S5      nUR                  [        R                  R                  SS0S9n[        U5      nU R                  USS/5        g	z7test that 'literal binds' mode works - no bound params.r   r=   literal_bindsT)dialectcompile_kwargsr   r   N)rC   r.   r   rZ   r[   r/   r   r   compiler   rL   r  strr   rP   r   r   sqls       r8   test_limit_offset_nobinds.FetchLimitOffsetTest.test_limit_offset_nobindsQ       &&e}%%eggjj177:AA!DllII%%6M  
 #hi%;<r;   c                 Z   U R                   R                  n[        U5      R                  UR                  R
                  5      R                  S5      R                  S5      nUR                  [        R                  R                  SS0S9n[        U5      nU R                  USS/5        gr	  )rC   r.   r   rZ   r[   r/   r   r   r  r   rL   r  r  r   r  s       r8   test_fetch_offset_nobinds.FetchLimitOffsetTest.test_fetch_offset_nobinds^  r  r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      SS/SS0S9  U R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      / SQSS0S9  g )Nlr   r   r   r   r   r   )	rC   r.   rS   r   rZ   r[   r/   r   r   r   s      r8   test_bound_limit%FetchLimitOffsetTest.test_bound_limitk  s    &&5M""577::.44Ys^D	"8	 	 	
 	5M""577::.44Ys^D-8	 	 	
r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      / SQSS0S9  U R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      / SQSS0S9  g )Nor   r   r  r  r=   )	rC   r.   rS   r   rZ   r[   r/   r   r   r   s      r8   test_bound_offset&FetchLimitOffsetTest.test_bound_offset|  s    &&5M""577::.55inE-8	 	 	
 	5M""577::.55inE88	 	 	
r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      R                  [        S5      5      SS/SSS.S9  U R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      R                  [        S5      5      / S	QS
SS.S9  g )Nr  r  r   r   r   r=   )r  r  r  r   r   )
rC   r.   rS   r   rZ   r[   r/   r   r   r   r   s      r8   test_bound_limit_offset,FetchLimitOffsetTest.test_bound_limit_offset      &&5MXeggjj!U9S>"VIcN#	"# 	 	
 	5MXeggjj!U9S>"VIcN#-# 	 	
r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      R                  [        S5      5      SS/SSS.S9  U R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      5      R                  [        S5      5      / S	QS
SS.S9  g )Nfr  r   r   r   r=   )r%  r  r  r   r   )
rC   r.   rS   r   rZ   r[   r/   r   r   r   r   s      r8   test_bound_fetch_offset,FetchLimitOffsetTest.test_bound_fetch_offset  r#  r;   c           	          U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      SS/5        g )N12r   r   )	rC   r.   rS   r   rZ   r[   r/   r   r   r   s      r8   test_expr_offset%FetchLimitOffsetTest.test_expr_offset  s\    &&5MXeggjj!VN3'.*==>	"	
r;   c           	          U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      / SQ5        g )Nr)  r*  r   )	rC   r.   rS   r   rZ   r[   r/   r   r   r   s      r8   test_expr_limit$FetchLimitOffsetTest.test_expr_limit  sW    &&5MXeggjj!U>#&)<<=-	
r;   c           	      B   U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      R                  [        S5      [        S5      -   5      SS/5        g Nr)  r   r   
rC   r.   rS   r   rZ   r[   r/   r   r   r   r   s      r8   test_expr_limit_offset+FetchLimitOffsetTest.test_expr_limit_offset  su    &&5MXeggjj!U>#&)<<=VN3'.*==>	"	
r;   c           	      B   U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      R                  [        S5      [        S5      -   5      SS/5        g r1  )
rC   r.   rS   r   rZ   r[   r/   r   r   r   r   s      r8   test_expr_fetch_offset+FetchLimitOffsetTest.test_expr_fetch_offset  sw     &&5MXeggjj!U>#&)<<=VN3'.*==>	"	
r;   c           	          U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  S5      R                  [        S5      [        S5      -   5      SS/5        U R                  U[        U5      R	                  UR
                  R                  5      R                  S5      R                  [        S5      [        S5      -   5      / SQ5        g )Nr   r)  r   r   r   r   )
rC   r.   rS   r   rZ   r[   r/   r   r   r   r   s      r8   test_simple_limit_expr_offset2FetchLimitOffsetTest.test_simple_limit_expr_offset  s    &&5MXeggjj!U1XVN3'.*==>	"	
 	5MXeggjj!U1XVN3'.*==>-	
r;   c           	          U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      R                  S5      SS/5        U R                  U[        U5      R	                  UR
                  R                  5      R                  [        S5      [        S5      -   5      R                  S5      SS/5        g )Nr)  r   r   r   r=   r   r2  r   s      r8   test_expr_limit_simple_offset2FetchLimitOffsetTest.test_expr_limit_simple_offset  s    &&5MXeggjj!U>#&)<<=VAY	"	
 	5MXeggjj!U>#&)<<=VAY	"	
r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  R                  5       5      R                  SSS9SS/SS9  U R                  U[        U5      R	                  UR
                  R                  R                  5       5      R                  SSS9/ SQSS9  g )	Nr=   T	with_tiesr   r   r  r   r   	rC   r.   rS   r   rZ   r[   rn   r   r   r   s      r8   test_simple_fetch_ties+FetchLimitOffsetTest.test_simple_fetch_ties  s    &&5M""57799>>#34::1:M	"	 	 	
 	5M""57799>>#34::1:M-	 	 	
r;   c                 ^   U R                   R                  nUR                  [        U5      R	                  UR
                  R                  5      R                  SSS9R                  S5      5      R                  5       n[        US   S5        [        [        U5      [        / SQ5      5        g )Nr   Tr?  r   r   r   rC   r.   rB   r   rZ   r[   rn   r   r   rN   r	   r   rP   rF   r   fas       r8   test_fetch_offset_ties+FetchLimitOffsetTest.test_fetch_offset_ties%  s     &&5MXeggii U1U%VAY	

 (* 	 	BqE9CGS:;<r;   c                    U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  SSS9R                  S5      SS/5        U R                  U[        U5      R	                  UR
                  R                  5      R                  SSS9R                  S5      SS	/5        g )
Nr   Tr?  r=   r   r   r   r   r   )	rC   r.   rS   r   rZ   r[   rn   r   r   r   s      r8   #test_fetch_offset_ties_exact_number8FetchLimitOffsetTest.test_fetch_offset_ties_exact_number2  s     &&5MXeggii U1U%VAY	"	
 	5MXeggii U1U%VAY	"	
r;   c                     U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  SSS9S/5        g )N   Tpercentr   r   r   s      r8   test_simple_fetch_percent.FetchLimitOffsetTest.test_simple_fetch_percentH  sQ    &&5M""577::.44R4FK	
r;   c                     U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  5      R                  SSS9R                  S5      SS/5        g )N(   TrO  r=   r   r   r   r   s      r8   test_fetch_offset_percent.FetchLimitOffsetTest.test_fetch_offset_percentQ  s\     &&5MXeggjj!U2tU$VAY	"	
r;   c           	          U R                   R                  nU R                  U[        U5      R	                  UR
                  R                  R                  5       5      R                  SSSS9SS/SS9  g )NrN  TrP  r@  r   r   r  rA  r   s      r8   test_simple_fetch_percent_ties3FetchLimitOffsetTest.test_simple_fetch_percent_ties^  sd     &&5MXeggiinn&'U2ttU4	" 	 	
r;   c                 `   U R                   R                  nUR                  [        U5      R	                  UR
                  R                  5      R                  SSSS9R                  S5      5      R                  5       n[        US   S5        [        [        U5      [        / SQ5      5        g )NrT  TrX  r   r   r   r   rE  rF  s       r8   test_fetch_offset_percent_ties3FetchLimitOffsetTest.test_fetch_offset_percent_tiesk  s     &&5MXeggii U2ttU4VAY	

 (* 	 	BqE9CGS:;<r;   N)ra   Fra   )2rb   rc   rd   re   rf   rg   r9   rG   rS   r   r   r   r   rX   fetch_firstr   r   r   combinationsr   r   fetch_no_order_byr  r  r  r  bound_limit_offsetr  r  r!  r&  sql_expression_limit_offsetr+  r.  r3  fetch_expressionr6  r9  r<  
fetch_tiesrB  fetch_offset_with_optionsrH  rK  fetch_percentrQ  rU  rY  r\  ri   ra   r;   r8   r   r      s   K
 
 

 

 ;@	GE

 !!
 "
 
 
 	!	!	!	   !!
 "
 ''
 (
 
 
 
= 
= !!
= "
= ((
 )
  ((
 )
  ((
 )
, !!
 "
, 11
 2
 11
 2
 11	
 2	
 !!&&	
 ' "	
 11
 2
( 11
 2
(   
 !
    //	= 0 !	=   //
 0 !
( ##
 $
 ##//	
 0 $	
   ##	
 $ !	
   ##//	= 0 $ !	=r;   r   c                   `    \ rS rSrSrSS jr\S 5       r\S 5       rS r	S r
S	 rS
 rS rSrg)JoinTestiz  Tra   c                     [         R                  R                  5        n[        UR	                  X5      R                  5       U5        S S S 5        g ! , (       d  f       g = frJ   rK   r   s        r8   rS   JoinTest._assert_result}  <    YY DV,557@ !  rV   c                     [        SU[        S[        SS95        [        SU[        S[        SS9[        S[        S5      SS	95        g )
Nar/   Tr0   ba_idza.idFnullable)r   r   r   r   r5   s     r8   r9   JoinTest.define_tables  sB    c8VD'tDE4d36:f->		
r;   c           	         UR                  U R                  R                  R                  5       SS0SS0SS0SS0SS0/5        UR                  U R                  R                  R                  5       SSS.SSS.SSS.SSS./5        g )Nr/   r=   r   r   ry   r   )r/   rp  )rB   rC   rn  rD   ro  rE   s     r8   rG   JoinTest.insert_data  s    JJLL!AYq	D!9tQi$C	

 	JJLL!!$!$!$!$		
r;   c                    U R                  SS5      u  p[        X5      R                  UR                  U5      5      R	                  UR
                  R                  UR
                  R                  5      nU R                  U/ SQ5        g Nrn  ro  ))r=   r=   r=   )r=   r   r=   )r   ry   r   )r   r   r   rC   r   select_fromjoinrZ   r[   r/   rS   rP   rn  ro  r   s       r8   test_inner_join_fkJoinTest.test_inner_join_fk  ^    {{3$a|''q	2;;ACCFFACCFFKD"NOr;   c                    U R                  SS5      u  p[        X5      R                  UR                  U[	        5       5      5      R                  UR                  R                  UR                  R                  5      nU R                  U[        R                  " / SQ/ SQ5       VVVs/ s H  u  u  nu  p$XU4PM     snnn5        g s  snnnf )Nrn  ro  )r   r   r   ry   r   ))r=   r=   r   )ry   r   )r   r   )rC   r   ry  rz  r!   rZ   r[   r/   rS   	itertoolsproduct)rP   rn  ro  r   r[   s        r8   test_inner_join_trueJoinTest.test_inner_join_true  s    {{3$ 1L[46*+Xaccffaccff% 	 	 %.$5$524%%LDQ&1 q	%		
s   *C	c                 $   U R                  SS5      u  p[        X5      R                  UR                  U[	        5       5      5      R                  UR                  R                  UR                  R                  5      nU R                  U/ 5        g )Nrn  ro  )	rC   r   ry  rz  r   rZ   r[   r/   rS   r{  s       r8   test_inner_join_falseJoinTest.test_inner_join_false  sg    {{3$ 1L[57+,Xaccffaccff% 	 	D"%r;   c                 (   U R                  SS5      u  p[        X5      R                  UR                  U[	        5       5      5      R                  UR                  R                  UR                  R                  5      nU R                  U/ SQ5        g )Nrn  ro  ))r=   NN)r   NN)r   NN)ry   NN)r   NN)	rC   r   ry  	outerjoinr   rZ   r[   r/   rS   r{  s       r8   test_outer_join_falseJoinTest.test_outer_join_false  sm    {{3$ 1L[Q01Xaccffaccff% 	 			
r;   c                    U R                  SS5      u  p[        X5      R                  UR                  U5      5      R	                  UR
                  R                  UR
                  R                  5      nU R                  U/ SQ5        g rw  rx  r{  s       r8   test_outer_join_fkJoinTest.test_outer_join_fk  r~  r;   Nr^  )rb   rc   rd   re   rf   rS   rg   r9   rG   r|  r  r  r  r  ri   ra   r;   r8   ri  ri  z  sP    KA 
 
 
 
 P
(	&
(Pr;   ri  c                   4   \ rS rSrSr\S 5       r\S 5       rSS jrS r	S r
\R                  R                  \R                  R                  S	 5       5       r\R                  R                   S
 5       rS r\R                  R                  S 5       rS rSrg)CompoundSelectTesti  Tc           
      t    [        SU[        S[        SS9[        S[        5      [        S[        5      5        g r   r   r5   s     r8   r9    CompoundSelectTest.define_tables  r   r;   c           
          UR                  U R                  R                  R                  5       SSSS.SSSS.SSSS.SSSS./5        g )Nr=   r   r   r   ry   r   rA   rE   s     r8   rG   CompoundSelectTest.insert_data  sS    JJ!!((*qq)qq)qq)qq)		
r;   ra   c                     [         R                  R                  5        n[        UR	                  X5      R                  5       U5        S S S 5        g ! , (       d  f       g = frJ   rK   r   s        r8   rS   !CompoundSelectTest._assert_result  rl  rV   c                 x   U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      n[        U5      R                  UR                  R
                  S:H  5      n[        X#5      nU R                  UR                  UR                  R
                  5      SS/5        g Nr   r   r   r   )
rC   r.   r   wherer[   r/   r$   rS   rZ   selected_columnsrP   r   s1s2u1s        r8   test_plain_union#CompoundSelectTest.test_plain_union  s    &&E]  q1E]  q12]KK++../)Y1G	
r;   c                    U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      n[        U5      R                  UR                  R
                  S:H  5      n[        X#5      R                  5       R                  5       nU R                  UR                  UR                  R
                  5      SS/5        g r  )rC   r.   r   r  r[   r/   r$   aliasrS   rZ   r  r  s        r8   test_select_from_plain_union/CompoundSelectTest.test_select_from_plain_union  s    &&E]  q1E]  q12]  "))+KK++../)Y1G	
r;   c                 ^   U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      n[        X#5      R                  S5      nU R                  UR                  UR                  R
                  5      SS/5        g Nr   r=   r   r   r   )rC   r.   r   r  r[   r/   r   rZ   r$   rS   r  r  s        r8   &test_limit_offset_selectable_in_unions9CompoundSelectTest.test_limit_offset_selectable_in_unions  s     &&E]  q177:CCEGGJJOE]  q177:CCEGGJJO2]  #KK++../)Y1G	
r;   c                 "   U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      R                  UR                  R
                  5      n[        U5      R                  UR                  R
                  S:H  5      R                  UR                  R
                  5      n[        X#5      R                  S5      nU R                  UR                  UR                  R
                  5      SS/5        g r  )rC   r.   r   r  r[   r/   rZ   r$   r   rS   r  r  s        r8   "test_order_by_selectable_in_unions5CompoundSelectTest.test_order_by_selectable_in_unions  s    &&E]  q1::577::FE]  q1::577::F2]  #KK++../)Y1G	
r;   c                    U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      R                  5       n[        U5      R                  UR                  R
                  S:H  5      R                  5       n[        X#5      R                  S5      nU R                  UR                  UR                  R
                  5      SS/5        g r  )rC   r.   r   r  r[   r/   distinctr$   r   rS   rZ   r  r  s        r8   "test_distinct_selectable_in_unions5CompoundSelectTest.test_distinct_selectable_in_unions&  s    &&E]  q1::<E]  q1::<2]  #KK++../)Y1G	
r;   c                    U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      n[        X#5      R                  5       nU R                  UR                  5       R                  S5      R                  UR                  R
                  5      SS/5        g r  )rC   r.   r   r  r[   r/   r   rZ   r$   r  rS   r  s        r8   &test_limit_offset_in_unions_from_alias9CompoundSelectTest.test_limit_offset_in_unions_from_alias0  s    &&E]  q177:CCEGGJJOE]  q177:CCEGGJJO 2]  "IIKa ))"$$''2Y	4J	
r;   c                    U R                   R                  n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      R                  5       R                  5       n[        U5      R                  UR                  R
                  S:H  5      R                  S5      R                  UR                  R
                  5      R                  5       R                  5       n[        X#5      R                  S5      nU R                  UR                  UR                  R
                  5      SS/5        g r  )rC   r.   r   r  r[   r/   r   rZ   r  r$   rS   r  r  s        r8   .test_limit_offset_aliased_selectable_in_unionsACompoundSelectTest.test_limit_offset_aliased_selectable_in_unions<  s    &&5MU577::?#U1XXeggjj!UWVX 	 5MU577::?#U1XXeggjj!UWVX 	 2]  #KK++../)Y1G	
r;   Nr^  )rb   rc   rd   re   rf   rg   r9   rG   rS   r  r  r   rX   order_by_col_from_union/parens_in_union_contained_select_w_limit_offsetr  0parens_in_union_contained_select_wo_limit_offsetr  r  r  r  ri   ra   r;   r8   r  r    s    K
 
 	
 	
A

 --EE
 F .
 FF
 G

 EE	
 F	

r;   r  c                       \ rS rSrSrSr\S 5       r\S 5       rS r	S r
S rS	 r\R                  R                  S
 5       r\R                  R                  S 5       rSrg)PostCompileParamsTestiU  T)standard_cursor_sqlc                     [        SU[        S[        SS9[        S[        5      [        S[        5      [        S[        S5      5      5        g 	Nr.   r/   Tr0   rn   ro   zrq   r4   r5   s     r8   r9   #PostCompileParamsTest.define_tables\  >    4d33 3 3r
#	
r;   c                     UR                  U R                  R                  R                  5       SSSSS.SSSSS.SSSSS.SSS	S
S./5        g Nr=   r   z1)r/   rn   ro   r  r   z2ry   z3r   z4rA   rE   s     r8   rG   !PostCompileParamsTest.insert_datag  [    JJ!!((*qqt4qqt4qqt4qqt4		
r;   c                     U R                   R                  n[        UR                  R                  5      R                  UR                  R                  [        SSS9:H  5      nU R                  US0 5        g )Nrp   Tliteral_executezKSELECT some_table.id FROM some_table WHERE some_table.x = __[POSTCOMPILE_q]	rC   r.   r   r[   r/   r  rn   r   assert_compilerP   r   r   s      r8   test_compile"PostCompileParamsTest.test_compiles  s`    &&eggjj!''GGII3==
 	5		
r;   c           	          U R                   R                  n[        UR                  R                  5      R                  UR                  R                  [        SSSS9:H  5      nU R                  US0 SS9  g )Nrp   r   Tr  z<SELECT some_table.id FROM some_table WHERE some_table.x = 10)r
  r  r  s      r8   test_compile_literal_binds0PostCompileParamsTest.test_compile_literal_binds  sh    &&eggjj!''GGII3DAA
 	J	 	 	
r;   c           	      L   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  [        SSS9:H  5      nU R                  5        n[        R                  R                  5        nUR                  U[        SS95        S S S 5        S S S 5        WR                  [        S[        R                  R                   R"                  (       a  SO0 5      5        g ! , (       d  f       N]= f! , (       d  f       Nf= f)Nrp   Tr  r   rp   z>SELECT some_table.id 
FROM some_table 
WHERE some_table.x = 10ra   )rC   r.   r   r[   r/   r  rn   r   sql_execution_asserterr   rL   rM   rB   dictassert_r   r  
positionalrP   r   r   asserterrR   s        r8   test_execute"PostCompileParamsTest.test_execute  s    &&eggjj!''GGII3==
 ((*h""$T4":. % + 	,ii''22	
 %$ +*s$   4DD-D
D	D
D#c           
      j   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        SSSS95      5      nU R                  5        n[        R                  R                  5        nUR                  U[        / SQS95        S S S 5        S S S 5        WR                  [!        S[        R                  R"                  R$                  (       a  SO0 5      5        g ! , (       d  f       N]= f! , (       d  f       Nf= f)Nrp   T	expandingr  )r   r   r   r  zFSELECT some_table.id 
FROM some_table 
WHERE some_table.x IN (5, 6, 7)ra   )rC   r.   r   r[   r/   r  rn   r
   r   r  r   rL   rM   rB   r  r  r   r  r  r  s        r8   +test_execute_expanding_plus_literal_executeAPostCompileParamsTest.test_execute_expanding_plus_literal_execute  s    &&eggjj!''GGIIMM)C4NO
 ((*h""$T4)#45 % + 	4ii''22	
 %$ +*s$   D$ D<D$
D!	D$$
D2c           
         U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        SSSS95      5      nU R                  5        n[        R                  R                  5        nUR                  U[!        SS/S95        S S S 5        S S S 5        WR#                  [%        S[        R                  R&                  R(                  (       a  SOS	-  [        R                  R&                  R*                  (       a  S
O0 5      5        g ! , (       d  f       N= f! , (       d  f       N= f)Nrp   Tr  )r   r   )      r  zbSELECT some_table.id 
FROM some_table 
WHERE (some_table.x, some_table.y) IN (%s(5, 10), (12, 18))VALUES  ra   )rC   r.   r   r[   r/   r  r"   rn   ro   r
   r   r  r   rL   rM   rB   r  r  r   r  tuple_in_valuesr  r  s        r8   1test_execute_tuple_expanding_plus_literal_executeGPostCompileParamsTest.test_execute_tuple_expanding_plus_literal_execute  s
   &&eggjj!''57799eggii(,,#tD
 ((*h""$T47H*=#>? % + 	+ !'		 1 1 A A9rK ii''22	
 %$ +*$   E0>EE0
E-	)E00
E>c           
         U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        SSSS95      5      nU R                  5        n[        R                  R                  5        nUR                  U[!        SS/S95        S S S 5        S S S 5        WR#                  [%        S[        R                  R&                  R(                  (       a  SOS	-  [        R                  R&                  R*                  (       a  S
O0 5      5        g ! , (       d  f       N= f! , (       d  f       N= f)Nrp   Tr  )r   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  ra   )rC   r.   r   r[   r/   r  r"   rn   r  r
   r   r  r   rL   rM   rB   r  r  r   r  r  r  r  s        r8   ?test_execute_tuple_expanding_plus_literal_heterogeneous_executeUPostCompileParamsTest.test_execute_tuple_expanding_plus_literal_heterogeneous_execute  s
   &&eggjj!''57799eggii(,,#tD
 ((*h""$T49j*A#BC % + 	/ !'		 1 1 A A9rK ii''22	
 %$ +*r  ra   N)rb   rc   rd   re   rf   r   rg   r9   rG   r  r  r  r  r   rX   tuple_inr  r  ri   ra   r;   r8   r  r  U  s     K+L
 
 	
 	



&
& 
 
. 
 
r;   r  c                      \ rS rSrSr\S 5       r\S 5       rS%S jrS r	S r
\R                  R                  S	 5       r\R                  R                  S
 5       r\R                  R                  S 5       r\R                  R                  S 5       rS rS rS rS rS rS r\R                  R0                  S 5       r\R                  R0                  S 5       r\R                  R0                  S 5       r\R                  R0                  S 5       r\R                  R0                  S 5       r\R                  R0                  S 5       r\R                  R0                  S 5       rS r S r!S r"S r#S r$S r%S  r&S! r'S" r(S# r)Sr*g$)&ExpandingBoundInTesti  Tc                     [        SU[        S[        SS9[        S[        5      [        S[        5      [        S[        S5      5      5        g r  r4   r5   s     r8   r9   "ExpandingBoundInTest.define_tables  r  r;   c                     UR                  U R                  R                  R                  5       SSSSS.SSSSS.SSSSS.SSS	S
S./5        g r  rA   rE   s     r8   rG    ExpandingBoundInTest.insert_data  r  r;   ra   c                     [         R                  R                  5        n[        UR	                  X5      R                  5       U5        S S S 5        g ! , (       d  f       g = frJ   rK   r   s        r8   rS   #ExpandingBoundInTest._assert_result   rl  rV   c                    U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ / / S.S9  g )Nrp   rr   )rp   rr   r  )rC   r.   r   r[   r/   r  rn   r
   r   ro   rZ   rS   r  s      r8   "test_multiple_empty_sets_bindparam7ExpandingBoundInTest.test_multiple_empty_sets_bindparam  s     &&577::U57799==301U57799==301Xeggjj!	 	 	D"2B-?@r;   c                    U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  U/ 5        g rJ   )rC   r.   r   r[   r/   r  rn   r
   ro   rZ   rS   r  s      r8   test_multiple_empty_sets_direct4ExpandingBoundInTest.test_multiple_empty_sets_direct  s     &&577::U57799==$%U57799==$%Xeggjj!	 	 	D"%r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ S/ 0S9  g Nrp   r  rC   r.   r   r[   r/   r  r"   rn   r  r
   r   rZ   rS   r  s      r8   )test_empty_heterogeneous_tuples_bindparam>ExpandingBoundInTest.test_empty_heterogeneous_tuples_bindparam      &&577::U6%''))UWWYY/33IcNCDXeggjj! 	
 	D"c2Y7r;   c                    ^ ^ T R                   R                  mU U4S jnU" / / 5        U" / SQ/ SQ5        U" / / 5        g )Nc                 L  > [        TR                  R                  5      R                  [	        TR                  R
                  TR                  R                  5      R                  U 5      5      R                  TR                  R                  5      nTR                  X!5        g rJ   )
r   r[   r/   r  r"   rn   r  r
   rZ   rS   valr   r   rP   r   s      r8   goGExpandingBoundInTest.test_empty_heterogeneous_tuples_direct.<locals>.go*  f    uwwzz"veggii377<=%''**% 
 /r;   )r   r  )r   r  )ry   r  r   r   r  rC   r.   rP   r  r   s   ` @r8   &test_empty_heterogeneous_tuples_direct;ExpandingBoundInTest.test_empty_heterogeneous_tuples_direct&  s7    &&	0 	2r

,.@A
2r
r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ S/ 0S9  g r  rC   r.   r   r[   r/   r  r"   rn   ro   r
   r   rZ   rS   r  s      r8   'test_empty_homogeneous_tuples_bindparam<ExpandingBoundInTest.test_empty_homogeneous_tuples_bindparam6  r  r;   c                    ^ ^ T R                   R                  mU U4S jnU" / / 5        U" / SQ/ SQ5        U" / / 5        g )Nc                 L  > [        TR                  R                  5      R                  [	        TR                  R
                  TR                  R                  5      R                  U 5      5      R                  TR                  R                  5      nTR                  X!5        g rJ   )
r   r[   r/   r  r"   rn   ro   r
   rZ   rS   r  s      r8   r  EExpandingBoundInTest.test_empty_homogeneous_tuples_direct.<locals>.goD  r
  r;   ))r=   r   r   r   r   ry   r   r  r  s   ` @r8   $test_empty_homogeneous_tuples_direct9ExpandingBoundInTest.test_empty_homogeneous_tuples_direct@  s7    &&	0 	2r

#%78
2r
r;   c                 X   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ SQS/ SQ0S9  g )Nrp   r  r   r   ry   r  rC   r.   r   r[   r/   r  rn   r
   r   rZ   rS   r  s      r8   test_bound_in_scalar_bindparam3ExpandingBoundInTest.test_bound_in_scalar_bindparamP  st    &&577::U57799==301Xeggjj! 	
 	D"4c9=MNr;   c                 D   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / SQ5      5      R                  UR                  R                  5      nU R                  U/ SQ5        g )Nr  r  
rC   r.   r   r[   r/   r  rn   r
   rZ   rS   r  s      r8   test_bound_in_scalar_direct0ExpandingBoundInTest.test_bound_in_scalar_directY  sf    &&577::U57799==+,Xeggjj! 	
 	D"45r;   c                    U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  SS/5      5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  USS/5        g )Nr   r   r   r   rC   r.   r   r[   r/   r  rn   r
   not_inrZ   rS   r  s      r8   !test_nonempty_in_plus_empty_notin6ExpandingBoundInTest.test_nonempty_in_plus_empty_notinb  s    &&577::U57799==!Q()U577::$$R()Xeggjj!	 	 	D4,/r;   c                    U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  R                  SS/5      5      R                  UR                  R                  5      nU R                  U/ 5        g )Nr   r   r&  r  s      r8   !test_empty_in_plus_notempty_notin6ExpandingBoundInTest.test_empty_in_plus_notempty_notinl  s    &&577::U57799==$%U577::$$aV,-Xeggjj!	 	 	D"%r;   c                     [        S5      R                  [        S[        SS95      nU R	                  U/ SQS/ SQ0S9  g)	zntest 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 idrp   Ttype_r  r  r  r  r  r  N)r    
bindparamsr   r   rS   rP   r   s     r8   test_typed_str_in&ExpandingBoundInTest.test_typed_str_inv  sK     A

*Ys&DA
B 	 	+, 	 	
r;   c                 v    [        S5      R                  [        SSS95      nU R                  U/ SQS/ SQ0S9  g)	ztest 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....

r.  rp   Tr  r  r1  r  Nr    r2  r   rS   r3  s     r8   test_untyped_str_in(ExpandingBoundInTest.test_untyped_str_in  sI     A

*Ysd3
4 	 	+, 	 	
r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ SQS/ SQ0S9  g )Nrp   r  r  r  )ry   r   r  r  r  s      r8   !test_bound_in_two_tuple_bindparam6ExpandingBoundInTest.test_bound_in_two_tuple_bindparam  s    &&577::U6%''))UWWYY/33IcNCDXeggjj! 	
 	$c3K-L 	 	
r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  / SQ5      5      R                  UR                  R                  5      nU R                  U/ SQ5        g )Nr<  r  )rC   r.   r   r[   r/   r  r"   rn   ro   r
   rZ   rS   r  s      r8   test_bound_in_two_tuple_direct3ExpandingBoundInTest.test_bound_in_two_tuple_direct  sx    &&577::U6%''))UWWYY/334LMNXeggjj! 	
 	D"45r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ SQS/ SQ0S9  g )Nrp   r  r  r  r   r  s      r8   /test_bound_in_heterogeneous_two_tuple_bindparamDExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_bindparam  s    &&577::U6%''))UWWYY/33IcNCDXeggjj! 	
 	:; 	 	
r;   c                    U R                   R                  n[        UR                  R                  5      R                  [        UR                  R                  UR                  R                  5      R                  / SQ5      5      R                  UR                  R                  5      nU R                  U/ SQ5        g )Nr  r  )rC   r.   r   r[   r/   r  r"   rn   r  r
   rZ   rS   r  s      r8   ,test_bound_in_heterogeneous_two_tuple_directAExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_direct  s    &&577::Uuwwyy%'')),005
 Xeggjj! 	 		
r;   c                 v    [        S5      R                  [        SSS95      nU R                  U/ SQS/ SQ0S9  g )N8select id FROM some_table WHERE (x, z) IN :q ORDER BY idrp   Tr7  r  r  r  r8  r3  s     r8   4test_bound_in_heterogeneous_two_tuple_text_bindparamIExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam  sI     F

*Ysd3
4 	 	:; 	 	
r;   c                 
    " S S[         R                  5      n[        S5      R                  [	        S[        [        5       [        5       5      SS95      nU R                  U/ SQSU" SS	5      U" S
S5      U" SS5      /0S9  g )Nc                   ,    \ rS rSrS rS rS rS rSrg)hExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuplei  c                     Xl         g rJ   _datarP   r2   s     r8   __init__qExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__init__      !
r;   c                 ,    [        U R                  5      $ rJ   iterrQ  rP   s    r8   __iter__qExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__iter__      DJJ''r;   c                      U R                   U   $ rJ   rP  rP   idxs     r8   __getitem__tExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__getitem__      zz#&r;   c                 ,    [        U R                  5      $ rJ   r   rQ  rY  s    r8   __len__pExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple.<locals>.LikeATuple.__len__      4::&r;   rP  N	rb   rc   rd   re   rS  rZ  r`  re  ri   ra   r;   r8   
LikeATuplerN        "(''r;   ri  rI  rp   Tr/  r  r   r  r   r  ry   r  r  )	r)   Sequencer    r2  r   r#   r   r   rS   rP   ri  r   s      r8   ?test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tupleTExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_typed_bindparam_non_tuple  s    	'11 	' F

*9WY9T
 	 	q$'q$'q$' 	 
	
r;   c                      " S S[         R                  5      n[        S5      R                  [	        SSS95      nU R                  U/ SQSU" SS	5      U" S
S5      U" SS5      /0S9  g )Nc                   ,    \ rS rSrS rS rS rS rSrg)gExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuplei  c                     Xl         g rJ   rP  rR  s     r8   rS  pExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__init__  rU  r;   c                 ,    [        U R                  5      $ rJ   rW  rY  s    r8   rZ  pExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__iter__  r\  r;   c                      U R                   U   $ rJ   rP  r^  s     r8   r`  sExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__getitem__	  rb  r;   c                 ,    [        U R                  5      $ rJ   rd  rY  s    r8   re  oExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple.<locals>.LikeATuple.__len__  rg  r;   rP  Nrh  ra   r;   r8   ri  rq    rj  r;   ri  rI  rp   Tr7  r  r   r  r   r  ry   r  r  )r)   rk  r    r2  r   rS   rl  s      r8   >test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tupleSExpandingBoundInTest.test_bound_in_heterogeneous_two_tuple_text_bindparam_non_tuple  s}    
	'11 	' F

*Ysd3
4 	 	q$'q$'q$' 	 
	
r;   c                 P   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ S/ 0S9  g r  r  r  s      r8   (test_empty_set_against_integer_bindparam=ExpandingBoundInTest.test_empty_set_against_integer_bindparam  r    &&577::U57799==301Xeggjj! 	
 	D"c2Y7r;   c                 <   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  U/ 5        g rJ   r"  r  s      r8   %test_empty_set_against_integer_direct:ExpandingBoundInTest.test_empty_set_against_integer_direct'  b    &&eggjj!''		b(9:CCEGGJJOD"%r;   c                 T   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ SQS/ 0S9  g Nrp   r   r   r   r  r  )rC   r.   r   r[   r/   r  rn   r'  r   rZ   rS   r  s      r8   1test_empty_set_against_integer_negation_bindparamFExpandingBoundInTest.test_empty_set_against_integer_negation_bindparam,  u    &&577::U57799##IcN34Xeggjj! 	
 	D":C9Mr;   c                 @   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  U/ SQ5        g Nr  )
rC   r.   r   r[   r/   r  rn   r'  rZ   rS   r  s      r8   .test_empty_set_against_integer_negation_directCExpandingBoundInTest.test_empty_set_against_integer_negation_direct5  j    &&577::$$UWWYY%5%5b%9:CCEGGJJO 	 	D":;r;   c                 P   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ S/ 0S9  g r  )rC   r.   r   r[   r/   r  r  r
   r   rZ   rS   r  s      r8   'test_empty_set_against_string_bindparam<ExpandingBoundInTest.test_empty_set_against_string_bindparam<  r  r;   c                 <   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  U/ 5        g rJ   )
rC   r.   r   r[   r/   r  r  r
   rZ   rS   r  s      r8   $test_empty_set_against_string_direct9ExpandingBoundInTest.test_empty_set_against_string_directE  r  r;   c                 T   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  [        S5      5      5      R                  UR                  R                  5      nU R                  U/ SQS/ 0S9  g r  )rC   r.   r   r[   r/   r  r  r'  r   rZ   rS   r  s      r8   0test_empty_set_against_string_negation_bindparamEExpandingBoundInTest.test_empty_set_against_string_negation_bindparamJ  r  r;   c                 @   U R                   R                  n[        UR                  R                  5      R                  UR                  R                  R                  / 5      5      R                  UR                  R                  5      nU R                  U/ SQ5        g r  )
rC   r.   r   r[   r/   r  r  r'  rZ   rS   r  s      r8   -test_empty_set_against_string_negation_directBExpandingBoundInTest.test_empty_set_against_string_negation_directS  r  r;   c                     [        [        [        5       R                  [	        SSS95      [        5       4[        5       S95      n[        UR                  U5      R                  5       S   S5        g )Nfoora   )valueelse_r   Fr   )	r   r   r   r
   r   r!   r   rB   fetchonerP   rF   r   s      r8   )test_null_in_empty_set_is_false_bindparam>ExpandingBoundInTest.test_null_in_empty_set_is_false_bindparamZ  s_    FJJyb9:F g
 	Jt$--/2J?r;   c                     [        [        [        5       R                  / 5      [	        5       4[        5       S95      n[        UR                  U5      R                  5       S   S5        g )Nr  r   r  )r   r   r   r
   r!   r   rB   r  r  s      r8   &test_null_in_empty_set_is_false_direct;ExpandingBoundInTest.test_null_in_empty_set_is_false_directf  sW    FJJrNF g
 	Jt$--/2J?r;   Nr^  )+rb   rc   rd   re   rf   rg   r9   rG   rS   r  r  r   rX   tuple_in_w_emptyr  r  r  r  r  r#  r(  r+  r4  r9  r  r=  r@  rC  rF  rJ  rm  rz  r}  r  r  r  r  r  r  r  r  r  ri   ra   r;   r8   r  r    s   K
 
 	
 	
A
A
& &&8 '8 && ' &&8 '8 && 'O60&
"
$ 	
 	
 6 6 
 
 
 
  

 

 
 
B 
 
@8&
N<8&
N<
@
@r;   r  c                      \ rS rSrSrSrSr\S 5       r\S 5       r	S r
S rS	 rS
 rS rS rS rS rS rS rS rS rS rS rS r\R4                  R6                  S 5       r\R4                  R:                  S 5       r\R4                  R6                  \R>                  " S1 Sk4S1 Sk4S1 Sk4SS14S\ " \!" S S!5      5      4S"\ " \!" S S!5      5      4S#\ " 5       45      S$ 5       5       r"S%r#g)&LikeFunctionsTestis  TonceNc                 `    [        SU[        S[        SS9[        S[        S5      5      5        g )Nr.   r/   Tr0   r2   rq   r4   r5   s     r8   r9   LikeFunctionsTest.define_tablesy  s*    4d366":&		
r;   c                     UR                  U R                  R                  R                  5       SSS.SSS.SSS.SS	S.S
SS.SSS.SSS.SSS.SSS.SSS.SS S./5        g )Nr=   abcdefgr?   r   zab/cdefgr   zab%cdefgry   ab_cdefgr   zabcde/fgr   zabcde%fgr   zab#cdefg   ab9cdefg	   zabcde#fgr   abcd9fg   rA   rE   s     r8   rG   LikeFunctionsTest.insert_data  s    JJ!!((*),*-*-*-*-*-*-*-*-9-4(	
r;   c                 `   U R                   R                  n[        R                  R	                  5        nUR                  [        UR                  R                  5      R                  U5      5       Vs1 s H  u  nUiM	     nnS S S 5        [        WU5        g s  snf ! , (       d  f       N = frJ   )rC   r.   r   rL   rM   rB   r   r[   r/   r  r	   )rP   r   r   r.   rR   r  rowss          r8   _testLikeFunctionsTest._test  s    [[++
YY D #ll6*,,//+B+H+H+NOOFE O   ! 	D( ! s   A B5BBB
B-c                     U R                   R                  R                  R                  nU R	                  UR                  S5      1 Sk5        g )Nab%c
   r=   r   r   ry   r   r   r   r  r  r   rC   r.   r[   r2   r  
startswithrP   cols     r8   test_startswith_unescaped+LikeFunctionsTest.test_startswith_unescaped  s5    kk$$&&++

3>>&)+JKr;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nr  T
autoescaper   r  r  s     r8   test_startswith_autoescape,LikeFunctionsTest.test_startswith_autoescape  s:    kk$$&&++

3>>&T>:QC@r;   c                     U R                   R                  R                  R                  nU R	                  UR                  [        S5      5      1 Sk5        g )Nz'ab%c'r  )rC   r.   r[   r2   r  r  r   r  s     r8   test_startswith_sqlexpr)LikeFunctionsTest.test_startswith_sqlexpr  s=    kk$$&&++

NN>(34+	
r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nzab##c#escaper   r  r  s     r8   test_startswith_escape(LikeFunctionsTest.test_startswith_escape  s:    kk$$&&++

3>>'#>6<r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSSS9S15        U R	                  UR                  SSSS9S15        g )Nr  Tr  r  r  r   zab#cr   r  r  s     r8   !test_startswith_autoescape_escape3LikeFunctionsTest.test_startswith_autoescape_escape  s[    kk$$&&++

3>>&T#>FL

3>>&T#>FLr;   c                     U R                   R                  R                  R                  nU R	                  UR                  S5      1 Sk5        g )Ne%fg	   r=   r   r   ry   r   r   r   r  r  rC   r.   r[   r2   r  endswithr  s     r8   test_endswith_unescaped)LikeFunctionsTest.test_endswith_unescaped  s5    kk$$&&++

3<<')DEr;   c                     U R                   R                  R                  R                  nU R	                  UR                  [        S5      5      1 Sk5        g )Nz'e%fg'r  )rC   r.   r[   r2   r  r  r   r  s     r8   test_endswith_sqlexpr'LikeFunctionsTest.test_endswith_sqlexpr  s=    kk$$&&++

LL124O	
r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nr  Tr  r   r  r  s     r8   test_endswith_autoescape*LikeFunctionsTest.test_endswith_autoescape  s:    kk$$&&++

3<<4<81#>r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nze##fgr  r  r  r  r  s     r8   test_endswith_escape&LikeFunctionsTest.test_endswith_escape  s:    kk$$&&++

3<<<4qc:r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSSS9S15        U R	                  UR                  SSSS9S15        g )Nr  Tr  r  r   ze#fgr  r  r  s     r8   test_endswith_autoescape_escape1LikeFunctionsTest.test_endswith_autoescape_escape  [    kk$$&&++

3<<4<DqcJ

3<<4<DqcJr;   c                     U R                   R                  R                  R                  nU R	                  UR                  S5      1 Sk5        g )Nb%cder  rC   r.   r[   r2   r  containsr  s     r8   test_contains_unescaped)LikeFunctionsTest.test_contains_unescaped  s5    kk$$&&++

3<<(*EFr;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nr  Tr  r   r  r  s     r8   test_contains_autoescape*LikeFunctionsTest.test_contains_autoescape  s:    kk$$&&++

3<<D<9A3?r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSS9S15        g )Nzb##cder  r  r   r  r  s     r8   test_contains_escape&LikeFunctionsTest.test_contains_escape  s:    kk$$&&++

3<<<5s;r;   c                     U R                   R                  R                  R                  nU R	                  UR                  SSSS9S15        U R	                  UR                  SSSS9S15        g )Nzb%cdTr  r  r   zb#cdr   r  r  s     r8   test_contains_autoescape_escape1LikeFunctionsTest.test_contains_autoescape_escape  r  r;   c                     U R                   R                  R                  R                  nU R	                  UR                  S5      ) 1 Sk5        g )Na.cde>   r   r   ry   r   r  r   rC   r.   r[   r2   r  regexp_matchr  s     r8   test_not_regexp_match'LikeFunctionsTest.test_not_regexp_match  s:    kk$$&&++

C$$W--/BCr;   c                     U R                   R                  R                  R                  nU R	                  UR                  SS5      R                  S5      1 Sk5        g )Nr  FOO   r=   r   r   r  )rC   r.   r[   r2   r  regexp_replacer  r  s     r8   test_regexp_replace%LikeFunctionsTest.test_regexp_replace  sF    kk$$&&++

w.77>	
r;   r  r  abc>   r=   r   r   r  r   z^abc9cder  z^ar=   r  z(b|c)z^(b|c)c                     U R                   R                  R                  R                  nU R	                  UR                  U5      U5        g rJ   r  )rP   r    r   r  s       r8   test_regexp_match#LikeFunctionsTest.test_regexp_match  s8     kk$$&&++

3##D)84r;   ra   )$rb   rc   rd   re   rf   run_insertsrun_deletesrg   r9   rG   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rX   r  r  r  r  r`  r   ranger  ri   ra   r;   r8   r  r  s  sR   KKK
 
 
 
$	LA
=M
F
?;K
G@<K
 ""D #D $$
 %
 ""	,	 !	!"	!	s5B< !	#eArl#$	355 #5r;   r  c                   H    \ rS rSrSrSr\S 5       r\S 5       rS r	S r
Srg	)
ComputedColumnTesti  T)computed_columnsc                     [        SU[        S[        SS9[        S[        5      [        S[        [        S5      5      [        S[        [        S	5      5      5        g )
Nsquarer/   Tr0   sideareazside * side	perimeterz4 * side)r   r   r   r   r5   s     r8   r9    ComputedColumnTest.define_tables  sH    4d367#67H]$;<;*)=>	
r;   c                 |    UR                  U R                  R                  R                  5       SSS.SSS./5        g )Nr=   r   )r/   r  *   )rB   rC   r  rD   rE   s     r8   rG   ComputedColumnTest.insert_data
  s8    JJ$$&r"2r$:;	
r;   c                    [         R                  R                  5        nUR                  [	        [        S5      5      R                  U R                  R                  5      R                  U R                  R                  R                  R                  5      5      R                  5       n[        USS/5        S S S 5        g ! , (       d  f       g = f)N*)r=   r   r3   rT  )r   r       )r   rL   rM   rB   r   r    ry  rC   r  rZ   r[   r/   rN   r	   rP   rR   ress      r8   test_select_all"ComputedColumnTest.test_select_all  s    YY D,,tCy!T[[//0$++,,..112 hj	 
 &(;<= !  s   BC
Cc                 6   [         R                  R                  5        nUR                  [	        U R
                  R                  R                  R                  U R
                  R                  R                  R                  5      R                  U R
                  R                  5      R                  U R
                  R                  R                  R                  5      5      R                  5       n[        USS/5        S S S 5        g ! , (       d  f       g = f)N)r3   rT  )r  r  )r   rL   rM   rB   r   rC   r  r[   r  r  ry  rZ   r/   rN   r	   r  s      r8   test_select_columns&ComputedColumnTest.test_select_columns  s    YY D,,KK&&((--t{{/A/A/C/C/M/M T[[//0$++,,..112 hj  i-. !  s   C"D


Dra   N)rb   rc   rd   re   rf   r   rg   r9   rG   r  r"  ri   ra   r;   r8   r  r    s<    K(L
 
 
 
>	/r;   r  c                       \ rS rSrSrSrSrSr\S 5       r	\S 5       r
S rS r\R                  R                  S	 5       rS
rg)IdentityColumnTesti&  T)identity_columnsr  c                     [        SU[        S[        [        SSSSS9SS9[        S[	        S5      5      5        [        S	U[        S[        [        S
SSSS9SS9[        S[	        S5      5      5        g )Ntbl_ar/   Tr  )alwaysstart
nominvalue
nomaxvaluer0   r   r3   tbl_br   i)	incrementr*  minvaluemaxvaluer   r   r   r   r   r5   s     r8   r9    IdentityColumnTest.define_tables,  s    rdt ! 66#;'	
 	2QK 	 66#;'
	
r;   c                 \   UR                  U R                  R                  R                  5       SS0SS0/5        UR                  U R                  R                  R                  5       SS0SS0/5        UR                  U R                  R                  R                  5       SSS./5        g )Nr   rn  ro  r  r[   r/   r   )rB   rC   r(  rD   r-  rE   s     r8   rG   IdentityColumnTest.insert_dataG  s    JJ##%c]VSM*	
 	JJ##%c]VSM*	
 	JJ##%$%	
r;   c                 h   UR                  [        [        S5      5      R                  U R                  R
                  5      R                  U R                  R
                  R                  R                  5      5      R                  5       n[        USS/5        UR                  [        [        S5      5      R                  U R                  R                  5      R                  U R                  R                  R                  R                  5      5      R                  5       n[        U/ SQ5        g )Nr  )r  rn  )+   ro  ))r.  ro  )r   rn  )r  r[   )rB   r   r    ry  rC   r(  rZ   r[   r/   rN   r	   r-  rP   rF   r  s      r8   r  "IdentityColumnTest.test_select_allV  s      49[**+Xdkk'')),,-
 (*	 	
 	C)Y'(  49[**+Xdkk'')),,-
 (*	 	
 	C12r;   c                 .   UR                  [        U R                  R                  R                  R
                  5      R                  U R                  R                  R                  R
                  5      5      R                  5       n[        USS/5        g )N)r  )r8  )	rB   r   rC   r(  r[   r/   rZ   rN   r	   r9  s      r8   r"  &IdentityColumnTest.test_select_columnse  sk      4;;$$&&))*33DKK4E4E4G4G4J4JK

(* 	 	C% r;   c                 B   ^ ^ UU 4S jn[        [        [        4U5        g )Nc                  v   > T R                  TR                  R                  R                  5       SSS./5        g )N   rn  r5  )rB   rC   r(  rD   )rF   rP   s   r8   fn7IdentityColumnTest.test_insert_always_error.<locals>.fnn  s2    !!((*S)*r;   )r   r'   r(   )rP   rF   r@  s   `` r8   test_insert_always_error+IdentityColumnTest.test_insert_always_errorl  s    	 	}&67<r;   ra   N)rb   rc   rd   re   rf   r   r
  r  rg   r9   rG   r  r"  r   rX   identity_columns_standardrB  ri   ra   r;   r8   r%  r%  &  sf    K(LKK
 
4 
 
3! //= 0=r;   r%  c                   2    \ rS rSrSrSr\S 5       rS rSr	g)IdentityAutoincrementTestiw  T)autoincrement_without_sequencec                 t    [        SU[        S[        [        5       SSS9[        S[	        S5      5      5        g )Ntblr/   T)r1   autoincrementr   r3   r2  r5   s     r8   r9   'IdentityAutoincrementTest.define_tables{  s9    
 " 66#;'	
r;   c                 
   UR                  U R                  R                  R                  5       SS05      nUR                  U R                  R                  R	                  5       5      R                  5       n[        US5        g )Nr   row)r=   rM  )rB   rC   rI  rD   r   firstr	   r9  s      r8    test_autoincrement_with_identity:IdentityAutoincrementTest.test_autoincrement_with_identity  s]      !7!7!9FE?K  !7!7!9:@@BCr;   ra   N)
rb   rc   rd   re   rf   r   rg   r9   rO  ri   ra   r;   r8   rF  rF  w  s#    K6L
 
r;   rF  c                   D    \ rS rSrSr\S 5       r\S 5       rS rS r	Sr
g)	
ExistsTesti  Tc                 `    [        SU[        S[        SS9[        S[        S5      5      5        g )Nstuffr/   Tr0   r2   rq   r4   r5   s     r8   r9   ExistsTest.define_tables  s*    4d366":&		
r;   c           	          UR                  U R                  R                  R                  5       SSS.SSS.SSS.SSS./5        g )Nr=   	some datar?   r   r   ry   zsome other data)rB   rC   rT  rD   rE   s     r8   rG   ExistsTest.insert_data  sL    JJ##%+.+.+."34		
r;   c           
      "   U R                   R                  n[        UR                  [	        [        S5      5      R                  [        5       R                  UR                  R                  S:H  5      5      5      R                  5       S/5        g )Nr=   rW  r   rC   rT  r	   rB   r   r   r  r   r[   r2   rN   rP   rF   rT  s      r8   test_select_existsExistsTest.test_select_exists  sg    !!wqz"((HNN577<<;#>? hjF	
r;   c           
          U R                   R                  n[        UR                  [	        [        S5      5      R                  [        5       R                  UR                  R                  S:H  5      5      5      R                  5       / 5        g )Nr=   zno datarZ  r[  s      r8   test_select_exists_false#ExistsTest.test_select_exists_false  se    !!wqz"((HNN577<<9#<= hj	
r;   ra   N)rb   rc   rd   re   rf   rg   r9   rG   r\  r_  ri   ra   r;   r8   rR  rR    s7    K
 
 	
 	
	
	
r;   rR  c                   p    \ rS rSrSr\R                  " \R                  R                  5      S 5       r	Sr
g)DistinctOnTesti  Tc                     [        S5      R                  [        S5      5      R                  [	        S5      5      n[
        R                  " S5         U R                  US5        S S S 5        g ! , (       d  f       g = f)Nr  rp   r  z:DISTINCT ON is currently supported only by the PostgreSQL zSELECT DISTINCT * FROM foo)r   r  r   ry  r   r   expect_deprecatedr  )rP   stms     r8   test_distinct_onDistinctOnTest.test_distinct_on  s]    Sk""6#;/;;E%LI&&H
 %AB
 
 
s   A..
A<ra   N)rb   rc   rd   re   rf   r   fails_ifrX   supports_distinct_onrf  ri   ra   r;   r8   rb  rb    s2    Kg&&;;<C =Cr;   rb  c            
       d    \ rS rSrSrSr\S 5       r\R                  " SSSSS	S
SS9S 5       r
Srg)IsOrIsNotDistinctFromTesti  T)supports_is_distinct_fromc                 p    [        SU[        S[        SS9[        S[        SS9[        S[        SS95        g )Nis_distinct_testr/   Tr0   col_arq  col_br   r5   s     r8   r9   'IsOrIsNotDistinctFromTest.define_tables  s4    4d37Gd37Gd3	
r;   )both_int_differentr   r=   r=   )both_int_samer=   r=   r   )one_null_firstNr=   r=   )one_null_secondr   Nr=   )	both_nullNNr   iaaaz3col_a_value, col_b_value, expected_row_count_for_is)id_r   c                    U R                   R                  nUR                  UR                  5       SXS./5        UR                  UR	                  5       R                  UR                  R                  R                  UR                  R                  5      5      5      R                  5       n[        [        U5      U5        US:X  a  SOSnUR                  UR	                  5       R                  UR                  R                  R                  UR                  R                  5      5      5      R                  5       n[        [        U5      U5        g )Nr=   )r/   ro  rp  r   )rC   rn  rB   rD   r   r  r[   ro  is_distinct_fromrp  rN   r	   r   is_not_distinct_from)rP   col_a_valuecol_b_valueexpected_row_count_for_isrF   rI  rQ   expected_row_count_for_is_nots           r8   test_is_or_is_not_distinct_from9IsOrIsNotDistinctFromTest.test_is_or_is_not_distinct_from  s    kk**JJLBC	

 ##JJLsuu{{;;CEEKKHI

(* 	 	K%	
 +a/AQ 	& ##JJLsuu{{??LM

(* 	 	K)	
r;   ra   N)rb   rc   rd   re   rf   r   rg   r9   r   r`  r  ri   ra   r;   r8   rk  rk    sR    K1L
 
 '"&'$F

r;   rk  c                   H    \ rS rSrSrSr\S 5       r\S 5       rS r	S r
Srg	)
WindowFunctionTesti   )window_functionsTc           
      t    [        SU[        S[        SS9[        S[        5      [        S[        5      5        g )Nr.   r/   Tr0   col1col2r   r5   s     r8   r9    WindowFunctionTest.define_tables  s0    4d367#67#	
r;   c           
          UR                  U R                  R                  R                  5       [	        SS5       Vs/ s H
  o"X"S-  S.PM     sn5        g s  snf )Nr=   rq   r   )r/   r  r  )rB   rC   r.   rD   r  )r6   rF   is      r8   rG   WindowFunctionTest.insert_data  sH    JJ!!((*:?2,G,Qqa%0,G	
Gs   A
c                    U R                   R                  nUR                  [        [        R
                  " UR                  R                  5      R                  UR                  R                  R                  5       /S95      R                  UR                  R                  S:  5      5      R                  5       n[        U[        S5       Vs/ s H  nSPM     sn5        g s  snf )N)rZ   rN     )_   )rC   r.   rB   r   r   maxr[   r  overr  r   r  r   r	   r  rP   rF   r.   r  r  s        r8   test_windowWindowFunctionTest.test_window  s    [[++
!!**+00(ll//4467 1  eJLL%%*+
 #% 	 	D%),)Q5),-,s   C$
c           	      p   U R                   R                  nUR                  [        [        R
                  " UR                  R                  5      R                  UR                  R                  /SS95      5      R                  5       n[        U[        SSS5       Vs/ s H  oD4PM     sn5        g s  snf )N)r.  r   )rZ   r  r      )rC   r.   rB   r   r   r  r[   r  r  r  r   r	   r  r  s        r8   test_window_rows_between+WindowFunctionTest.test_window_rows_between"  s    [[++
 !!**+00(ll//0  1 
 #% 	 	Dq#q!12!1A4!1232s   B3
ra   N)rb   rc   rd   re   r   rf   rg   r9   rG   r  r  ri   ra   r;   r8   r  r     s<    (LK
 
 
 

.4r;   r  )=r  r  r   r   r   r   
assertionsr   r	   r
   	assertsqlr   schemar   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(   r)   
TablesTestr+   rk   TestBaser   r   ri  r  r  r  r  r  r%  rF  rR  rb  rk  r  ra   r;   r8   <module>r     s    ! &   &   !                             # ##
(%% #
LJ<x** J<Z
8,, 
 D=8.. D=NaPx"" aPHt
,, t
nN
/1D1DN
bJ@8.. J@ZE5++ E5P(/,, (/VN=,, N=b 3 3 2,
$$ ,
^	C')<)< 	C2
 3 3 2
j04,, 04r;   