
    XeIi                       d dl Z d dlZd dlZd dlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z! ddl"m#Z# ddl"m$Z$ ddl"m%Z% dd l&m'Z' dd!l&m(Z( dd"lm)Z) dd#lm*Z* dd$l+m,Z, dd%l-m.Z. dd&lm/Z/ dd'lm0Z0 dd(lm1Z1 dd)lm2Z2 dd*lm3Z3 dd+lm4Z4 d,\  Z5Z6 G d- d.ej7                  Z8 G d/ d0e8          Z9 G d1 d2ej7                  Z: G d3 d4ej;                  Z< G d5 d6ej;                  Z= G d7 d8ej7                  Z>d9 Z? G d: d;e0e8          Z@ G d< d=ej;                  ZA G d> d?e/ej;                  ZB G d@ dAej7                  ZC G dB dCejD                  ZE G dD dEej7                  ZF G dF dGej7                  ZGdHZHdS )I    N   )config)engines)eq_)eq_regex)expect_raises)expect_raises_message)expect_warnings)fixtures)is_)get_temp_table_name)temp_table_keyword_argsColumn)Table   )Boolean)DateTime)event)
ForeignKey)func)Identity)inspect)Integer)MetaData)String)testing)types)	Inspector)
ObjectKind)ObjectScope)NoSuchTableError)UnreflectableTableError)DDL)Index)quoted_name)BLANK_SCHEMA)ComparesIndexes)ComparesTables)is_false)is_none)is_true)mockNNc                   $    e Zd Zed             ZdS )OneConnectionTablesTestc                     t           j        j        j        r/ddlm} t          j        t          |j	        d                    S t           j
        S )Nr   )poolclass)	poolclassscope)options)r   requirementsindependent_connectionsenabled
sqlalchemyr2   r   testing_enginedict
StaticPooldb)clsr2   s     m/var/www/html/MCyber-Diagnostic/venv/lib/python3.11/site-packages/sqlalchemy/testing/suite/test_reflection.py
setup_bindz"OneConnectionTablesTest.setup_bind<   s]    
 6> 	'''''')tgFFF    9    N)__name__
__module____qualname__classmethodrA    rB   r@   r0   r0   ;   s-          [  rB   r0   c                      e Zd ZdZdZed             Zed             Zed             Zed             Z	d Z
d Zej        j        d	             Zej        j        d
             Zej        j        d             Zej        j        d             Zej        j        ej        j        ej        j        d                                     Zej        j        ej        j        d                         ZdS )HasTableTestTNc                    t          d|t          dt          d          t          dt          d                               t          j        j        j        rNt          d|t          dt          d          t          dt          d                    t          j	                   t          j        j
        r|                     |           t          j        j        j        r|                     |           d S d S )	N
test_tableidTprimary_keydata2   test_table_sschema)r   r   r   r   r   requiresschemasr9   r   test_schemaview_reflectiondefine_viewshas_temp_tabledefine_temp_tablesr?   metadatas     r@   define_tableszHasTableTest.define_tablesP   s    4d33366"::&&		
 	
 	
 #+ 	tW$777vvbzz**)    + 	'X&&&*2 	-""8,,,,,	- 	-rB   c                    d}t          j        |dt          |                     t          j        |dt          d                     t          j        j        j        rrdt          j        dt          j        d}t          j        |dt          |                     t          j        |dt          dt          j        z                       d S d S )	Nz1CREATE VIEW vv AS SELECT id, data FROM test_tableafter_createbefore_dropzDROP VIEW vvCREATE VIEW z.vv AS SELECT id, data FROM z.test_table_szDROP VIEW %s.vv)	r   listenr$   r   rT   rU   r9   r   rV   )r?   r\   querys      r@   rX   zHasTableTest.define_viewsf   s    CX~s5zz:::X}c..A.ABBB#+ 	 	 &&&&&&  L>3u::>>>L%);<==    	 	rB   c                 \    t          t          t          j        dt          j                   S N	user_tmp_r   r   r>   identr?   s    r@   temp_table_namezHasTableTest.temp_table_name|   (    "FI96<99
 
 	
rB   c                    t          t          t          j                  }|                                 }t	          ||t          dt          j        d          t          dt          j        d                    fi |}t          j
        j        j        rkt          j
        j        j        rWt          j        |dt!          dt          j        z                       t          j        |dt!          d	                     d S d S d S )
NrL   TrM   namerP   r_   =create temporary view user_tmp_v as select * from user_tmp_%sr`   drop view user_tmp_v)r   r   r>   rj   r   r   saINTVARCHARr   rT   rW   r9   temporary_viewsr   rb   r$   rh   r?   r\   kw
table_nameuser_tmps        r@   rZ   zHasTableTest.define_temp_tables   s   $VVY77((**
4T22262:b>>**	
 

 
 
 ,4	O 08	O L028,?    L=#6L2M2MNNNNN	O 	O 	O 	OrB   c                    t           j                                        5 }t          t           j        j                            |d                     t          t           j        j                            |d                     t          t           j        j                            |d                     d d d            d S # 1 swxY w Y   d S )NrK   rQ   nonexistent_table)r   r>   beginr,   dialect	has_tabler*   selfconns     r@   test_has_tablezHasTableTest.test_has_table   s    Y__ 	M$FI%//lCCDDDVY&00~FFGGGVY&007JKKLLL	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	M 	Ms   BCC
Cc                 ~   t          t          j                  }t          |                    d                     t          d|t          dt                              }t          |                    d                     |	                    t          j                   	 t          |                    d                     |
                                 t          |                    d                     |                    t          j                   d S # |                    t          j                   w xY w)NrK   	new_tablecol)r   r   r>   r,   r|   r   r   r   r*   createclear_cachedrop)r~   r\   inspnts       r@   test_has_table_cachez!HasTableTest.test_has_table_cache   s    vy!!|,,---;&*@*@AA,,---
		&)	T^^K00111DNN;//000GGFIBGGFIs   "AD !D<c                    t           j                                        5 }t          t           j        j                            |dt           j                             t          t           j        j                            |dt           j                             t          t           j        j                            |dt           j                             d d d            d S # 1 swxY w Y   d S )NrK   rR   rQ   ry   )r   r>   rz   r*   r{   r|   rV   r,   r}   s     r@   test_has_table_schemaz"HasTableTest.test_has_table_schema   s%   Y__ 	$	!++,v/A ,    
 	!++.1C ,    
 	!++-f6H ,    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   B;C''C+.C+c                     t           j                                        5 }t          t           j        j                            |dd                     d d d            d S # 1 swxY w Y   d S )NrK   nonexistent_schemarR   )r   r>   rz   r*   r{   r|   r}   s     r@   !test_has_table_nonexistent_schemaz.HasTableTest.test_has_table_nonexistent_schema   s    Y__ 	$	!++,/C ,    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   5A!!A%(A%c                 h    t          |          }t          |                    d                     d S Nvvr   r,   r|   r~   
connectionr   s      r@   test_has_table_viewz HasTableTest.test_has_table_view   s/    z""t$$%%%%%rB   c                     t          |          }|                                 }t          |                    |                     d S N)r   rj   r,   r|   )r~   r   r   rj   s       r@   test_has_table_temp_tablez&HasTableTest.test_has_table_temp_table   s@    z""..00//00000rB   c                 h    t          |          }t          |                    d                     d S N
user_tmp_vr   r   s      r@   test_has_table_temp_viewz%HasTableTest.test_has_table_temp_view   s1     z""|,,-----rB   c                 ~    t          |          }t          |                    dt          j                             d S r   )r   r,   r|   r   rV   r   s      r@   test_has_table_view_schemaz'HasTableTest.test_has_table_view_schema   s6     z""tV%78899999rB   )rC   rD   rE   __sparse_driver_backend__run_deletesrF   r]   rX   rj   rZ   r   r   r   rT   rU   r   r   viewsr   rY   r   rW   rs   r   r   rG   rB   r@   rI   rI   K   s        $K- - [-*   [* 
 
 [

 O O [O0M M M     $    & & & $1 1 %$1
 $%%. . &% &% %$. : :  : : :rB   rI   c                       e Zd ZdZdZed             Z ej        ddd          Z	d Z
e	d	             Zej        j        e	d
                         ZdS )HasIndexTestT)index_reflectionc                    t          d|t          dt          d          t          dt          d                    t          dt          d                              }t	          d|j        j                   t          j        j	        j
        rjt          d|t          dt          d          t          dt          d                    t          j        	          }t	          d
|j        j                   d S d S )NrK   rL   TrM   rO   rP   data2my_idxrR   my_idx_s)r   r   r   r   r%   crO   r   rT   rU   r9   r   rV   )r?   r\   tts      r@   r]   zHasIndexTest.define_tables   s    4d33366"::&&7F2JJ''
 
 	h	"""#+ 	)tW$777vvbzz**)  B *bdi(((((	) 	)rB   r{   	inspectorkindargnamesc                 B    |dk    rfdS t                    j        S )Nr{   c                  B    t          j        j        j        g| R i |S r   )r   r>   r{   	has_index)akr   s     r@   <lambda>z)HasIndexTest._has_index.<locals>.<lambda>   s'    69#4#>t#Ma#M#M#M1#M#M rB   )r   r   )r~   r   r   s     `r@   
_has_indexzHasIndexTest._has_index   s,    9MMMMM4==**rB   c           	      H   |                      ||          } |dd          sJ  |dd          rJ  |dd          rJ  |dd          rJ  |dd          rJ  |dd          rJ t          d| j        j        j        j                  }t          d|t          d	t                    t          dd	                    }|	                    |           |	                    |           	 |d
k    r5 |dd          rJ  |dd          rJ |j
                                          |dd          du sJ  |dd          du sJ 	 |                    |           |                    |           d S # |                    |           |                    |           w xY w)NrK   r   r   ry   nonexistent_idxmy_idx_2test_table_2my_idx_3foor   T)r   r%   tablesrK   r   r   r   r   r   r   __self__r   r   )r~   r   r   r\   methidxtbls          r@   test_has_indexzHasIndexTest.test_has_index  s   tZ00tL(+++++4j111114+X666664&7888884j111114
33333J 6 8 >??5'""*e$$	
 
 	

:

:		!{""4j999994
;;;;;))+++4j11T99994
33t;;;;;HHZ   HHZ      HHZ   HHZ    s   -AE5 5,F!c                    |                      ||          } |ddt          j                  sJ  |ddt          j                  rJ  |ddt          j                  rJ  |ddt          j                  rJ d S )NrK   r   rR   r   ry   nonexistent_idx_s)r   r   rV   )r~   r   r   r   s       r@   test_has_index_schemaz"HasIndexTest.test_has_index_schema"  s     tZ00tL*V5GHHHHHH4hv7IJJJJJJ4F4F
 
 
 	
 	
 	
 4-f6H
 
 
 	
 	
 	
 	
 	
rB   N)rC   rD   rE   r   __requires__rF   r]   r   combinationsr   r   r   rT   rU   r   rG   rB   r@   r   r      s         $(L) ) [)(  7	;HHHD+ + + 
! ! 
T!: 		
 	
 
T 	
 	
 	
rB   r   c                      e Zd ZdZd Zd Z ej        dddg           e             e            ej        j	        d                                                 Z
 e             e            ej        j        d                                     Z e             e            ej        j        d                                     Zd	S )
BizarroCharacterTestTc                  4    t          j        ddddd          S )N)	plainname)z(3))zcol%p)z[brack]
columnnamer   r   r   rG   rB   r@   column_namesz!BizarroCharacterTest.column_names4  s+    #!
 
 
 	
rB   c                  4    t          j        ddddd          S )N)plain)z(2))z
per % cent)z
[brackets]	tablenamer   r   rG   rB   r@   table_namesz BizarroCharacterTest.table_names=  s+    # 
 
 
 	
rB   use_compositeFc                    t          ||t          |t          dd          d          }|r*|                    t          dt          d                     |r}t          d|t          dt          d          t          dt                    t          d	t                    t	          j        dd	g|j        j        |j        j        g          d           nNt          d|t          dt          d          t          dt          |j        j                            d           |
                    |           t                      }t          d||
          }|j        |         }	|j        j                            |	j        d                   sJ |r,|j        j                            |	j        d                   sJ dS dS )ztests for #10275rL   T)keyrN   test_needs_fkid2rM   otherrefref2autoload_withr      N)r   r   r   append_columnrp   ForeignKeyConstraintr   rL   r   r   
create_allr   r   r   
referencesr   )
r~   r   r\   r   r   r   r   m2o2t1s
             r@   test_fk_refz BizarroCharacterTest.test_fk_refF  s    :wDdCCC	
 
 
  	GVE7EEEFFF 	tW$777ug&&vw'''"$'2489LMM"     tW$777uj1122"    	J'''ZZ7Bj999Yy!tx""247+++++ 	149''Q00000	1 	100rB   c           
         t          ||t          |t          t                      d                     |                    |           t          |          }t          |                    |          d         d         d         d           d S )NTrM   r   identitystartr   r   r   r   r   r   r   r   get_columnsr~   r   r   r   r\   r   s         r@   test_reflect_identityz*BizarroCharacterTest.test_reflect_identityu  s     	:w

EEE	
 	
 	

 	J'''z""DY''*:6w?CCCCCrB   c           
      $   t          ||t          dt          d          t          |t          d                     |                    |           t	          |          }t          |                    |          d         d         d           d S )NrL   TrM   some commentcommentr   r   r   r   r   r   r   r   r   r   s         r@   test_reflect_commentsz*BizarroCharacterTest.test_reflect_comments  s     	4d333:w???		
 	
 	
 	J'''z""DY''*95~FFFFFrB   N)rC   rD   rE   r   r   r   r   	variationrT   !foreign_key_constraint_reflectionr   identity_columnsr   comment_reflectionr   rG   rB   r@   r   r   0  s%        $
 
 

 
 
 Wu66\^^[]]7)1 )1 87 ] ^ 76)1V \^^[]]&D D '& ] ^D \^^[]](G G )( ] ^G G GrB   r   c                       e Zd ZdZdZej        d             Zej        j	        d             Z
ej        j        d             ZdS )TempTableElementsTestT)temp_table_reflectionc                 \    t          t          t          j        dt          j                   S )N
ident_tmp_rg   r~   s    r@   r   zTempTableElementsTest.tablename  s(    "FI:FL::
 
 	
rB   c           
         t          ||t          dt          t                      d                     |                    |           t          |          }t          |                    |          d         d         d         d           d S )NrL   TrM   r   r   r   r   r   r~   r   r   r\   r   s        r@   r   z+TempTableElementsTest.test_reflect_identity  s    4(**$???	
 	
 	

 	J'''z""DY''*:6w?CCCCCrB   c           
      $   t          ||t          dt          d          t          dt          d                     |                    |           t	          |          }t          |                    |          d         d         d           d S )	NrL   TrM   foobarr   r   r   r   r   r   s        r@   r   z+TempTableElementsTest.test_reflect_comments  s    4d3338Wn===		
 	
 	
 	J'''z""DY''*95~FFFFFrB   N)rC   rD   rE   r   r   r   fixturer   rT   r   r   temp_table_comment_reflectionr   rG   rB   r@   r   r     s         $-L_
 
 _

 &	D 	D '&	D 3
G 
G 43
G 
G 
GrB   r   c                      e Zd ZdZdZed             Zd Zed             Zee	j
        j        d                         Zed             Zed             Zee	j
        j        d	                         Zee	j
        j        d
                         Zee	j
        j        d                         Zee	j
        j        d                         Zee	j
        j        d                         ZdS )QuotedNameArgumentTestonceTc                 0   t          d|t          dt                    t          dt          d                    t          dt          d                    t          dt                    t	          j        dd          t	          j        d	d          t	          j        dd
          t	          j        dgdgd          t	          j	        dd          dd           t          j        j        j        rt          d|t          dt                    t          dt          d                    t          dt          d                    t          dt                    t	          j        dd          t	          j        dd          t	          j        dd          t	          j        dgdgd          t	          j	        dd          dd           t          d|t          dt          d          t          dt                    d           t          j        j        j        rt          j        j        j        rddg}ndg}|D ]}dt          j        j        j                            d|z            dt          j        j        j                            |          }t)          j        |dt-          |                     t)          j        |d t-          d!t          j        j        j                            d|z            z                       d S d S )"Nquote ' onerL   rm   rP   rO   
related_idzpk quote ' onerm   zix quote ' onezuq quote' onez
related.idzfk quote ' onezname != 'foo'zck quote ' onezquote ' one commentT)r   r   quote " twozpk quote " twozix quote " twozuq quote" twozfk quote " twozck quote " two zquote " two commentrelatedrM   r   ra   view %s AS SELECT * FROM r_   r`   zDROP VIEW %s)r   r   r   r   rp   PrimaryKeyConstraintr%   UniqueConstraintr   CheckConstraintr   rT   symbol_names_w_double_quoter9   view_column_reflectionr   r>   r{   identifier_preparerquoter   rb   r$   )r?   r\   namesrm   rc   s        r@   r]   z$QuotedNameArgumentTest.define_tables  s7   4!!66"::&&66"::&&<))#D/?@@@H%v..$   #-=   5EFFF.%	
 	
 	
 	
* 7? 	tW%%vvbzz**vvbzz**|W--'3CDDD)622#(   'F\N1A   "?9JKKK2"%   * 	4d3339g&&	
 	
 	
 	
 2: 	;C !! "   I%9??!D(    I%9??EEE	 X~s5zzBBB!& )+?EE%,  	 	 	 	'	 	 rB   c                 `     t          j        ddt           j        j        f          |           S )N)r  r
  )r   r   rT   r  )fns    r@   quote_fixturesz%QuotedNameArgumentTest.quote_fixtures  s;    
w#G,HI
 
   	rB   c                 Z   t          t          j                  }t          j        j        j        r9|                    |          }t          t          |t                               d S t          t                    5  |                    |           d d d            d S # 1 swxY w Y   d S r   )r   r   r>   r   rT   reflect_table_optionsr9   get_table_optionsr,   
isinstancer<   r   NotImplementedError)r~   rm   r   ress       r@   test_get_table_optionsz-QuotedNameArgumentTest.test_get_table_options  s    vy!!19 	-((..CJsD))*****233 - -&&t,,,- - - - - - - - - - - - - - - - - -s   =B  B$'B$c                 l    t          t          j                  }|                    d|z            sJ d S )Nr  )r   r   r>   get_view_definitionr~   rm   r   s      r@   test_get_view_definitionz/QuotedNameArgumentTest.test_get_view_definition%  s8     vy!!''	D(89999999rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   r   r"  s      r@   test_get_columnsz'QuotedNameArgumentTest.test_get_columns+  s1    vy!!%%%%%%%rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_pk_constraintr"  s      r@   test_get_pk_constraintz-QuotedNameArgumentTest.test_get_pk_constraint0  s1    vy!!%%d+++++++rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_foreign_keysr"  s      r@   test_get_foreign_keysz,QuotedNameArgumentTest.test_get_foreign_keys5  s3     vy!!$$T*******rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_indexesr"  s      r@   test_get_indexesz'QuotedNameArgumentTest.test_get_indexes;  s3     vy!!%%%%%%%rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_unique_constraintsr"  s      r@   test_get_unique_constraintsz2QuotedNameArgumentTest.test_get_unique_constraintsA  s3     vy!!**40000000rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_table_commentr"  s      r@   test_get_table_commentz-QuotedNameArgumentTest.test_get_table_commentG  s3     vy!!%%d+++++++rB   c                 f    t          t          j                  }|                    |          sJ d S r   )r   r   r>   get_check_constraintsr"  s      r@   test_get_check_constraintsz1QuotedNameArgumentTest.test_get_check_constraintsM  s3     vy!!))$///////rB   N)rC   rD   rE   run_create_tablesr   rF   r]   r  r  r   rT   r  r#  r%  r(  r   r+  r   r.  unique_constraint_reflectionr1  r   r4  check_constraint_reflectionr7  rG   rB   r@   r  r    s        $P P [Pd   - - ^- ,: : -, ^: & & ^& , , ^, 7+ + 87 ^+ && & '& ^& 21 1 32 ^1 (, , )( ^, 10 0 21 ^0 0 0rB   r  c           
      2   t          j        d d t           j        j        fd          }t          j        t          j        t          j        t          j        d          }t          j        t          j	        t          j
        t          j        t          j        t          j        t          j	        t          j
        z  t          j	        t          j        z  d          }t          j        ddd          } | | | ||                                         S )	Nc                      t           j        S r   )r   rV   rG   rB   r@   r   z$_multi_combination.<locals>.<lambda>X  s	    F& rB   rS   r   r5   r   TF
use_filter)r   r   rT   rU   r!   DEFAULT	TEMPORARYANYr    TABLEVIEWMATERIALIZED_VIEWANY_VIEW)r  rS   r5   r   filter_namess        r@   _multi_combinationrF  T  s    !&&$	
   F  	  E $:?*:77	 	 	D 'elKKKL6%%\\"--..//000rB   c                      e Zd ZdxZZdZed             Zed             Zed             Z	ed             Z
ed             Zd Zd	 Zd
 Zdej        ej        dfdZdej        ej        dfdZdej        ej        dfdZed             Zdej        ej        dfdZed             Zdej        ej        dfdZed             Zdej        ej        dfdZed             Zdej        ej        ddfdZed             Zdej        ej        dfdZed             Z e!j"        j#        d             Z$e!j"        j#        d             Z%e!j"        j#        d             Z&e!j"        j#        d             Z'e!j"        j#        e!j"        j(        d                         Z)e!j"        j#        d             Z*e!j"        j#        d              Z+ e!j,        dd!e!j"        j-        fd"#           e!j,        de!j"        j.        fdd$#          d%                         Z/ e!j,        de!j"        j.        fdd$#          d&             Z0e!j"        j1        d'             Z2e!j"        j3        e!j"        j4        d(                         Z5e!j"        j6        d)             Z7e!j"        j6        e!j"        j.        d*                         Z8dxd+Z9 e!j,        d,dde!j"        j.        fdde!j"        j3        fdde!j"        j.        e!j"        j3        z   fd-#          d.             Z:e!j"        j;        d/             Z<e!j"        j;        d0             Z=e!j"        j;        e!j"        j>        e!j"        j4        d1                                     Z? e!j,        d2de!j"        j.        fd$#          e!j"        j@        d3                         ZA e!j,        d4d5d6d7d8#          e!j"        j@        e!j"        jB        d9                                     ZC e!j,        d2de!j"        j.        fd$#          e!j"        j-        d:                         ZD e!j,        d;d<d=d>d?#          e!j"        j-        d@                         ZEe!j"        jF        e!j"        j.        dA                         ZG e!j,        d2de!j"        j.        fd$#          e!j"        jH        dB                         ZI e!j,        dCdDdE#          e!j"        jH        e!j"        jJ        e!j"        jK        dF                                                 ZL e!j,        dGdHdIdJdK#          e!j"        jH        dL                         ZMe!j"        j;        e!j"        jN        dM                         ZOe!j"        jP        dN             ZQ e!j,        de!j"        j.        fd2d$#          e!j"        jN        dO                         ZR e!j,        dPdQdRdSdT#          e!j"        jN        dU                         ZSe!j"        j3         e!j,        d2de!j"        j.        fd$#          dV                         ZTe!j"        j3        dW             ZUe!j"        jV        dX             ZW e!j,        de!j"        j.        fd2d$#          dY             ZX e!j,        de!j"        j.        fd          dZ             ZYe!jZ        d[             Z[e!j"        j\        e]d\                         Z^e!j"        j6        e]d]                         Z_d^ Z`dyd_Zadzd`Zbe]da             Zce!j"        j@        e]db                         Zddc Zee!j"        j-        e]dd                         Zfe!j"        jH        e]de                         Zge!j"        jN        e]df                         Zhe!j"        ji        e]dg                         Zj e!j,        dhe!j"        j\        fdidje!j"        j@        fdke!j"        j-        fdle!j"        jH        fdme!j"        jN        fdne!j"        ji        fdoe!j"        j6        fdp#	  	        dq             Zkdr Zl e!j,        ddd$#           e!j,        de!j"        jm        fdds#          dt                         Zne!j"        j6        du             Zoe!j"        jp        dv             Zqe!j"        jr        e!j"        js        dw                         ZtdS ){ComponentReflectionTestNTc                     |                      |d            t          j        j        j        r'|                      |t          j        j                   d S d S r   )define_reflected_tablesr   rT   rU   r9   r   rV   r[   s     r@   r]   z%ComponentReflectionTest.define_tablesw  sW    ##Hd333#+ 	N'''.2LMMMMM	N 	NrB   c                    |r|dz   }nd}t           j        j        j        rt	          d|z  d          f}nd}t          d|t          dt          j        d	
          t          dt          j	        d          d          t          dt          j
                    d          t          dt          j        g|R  t          j        ddd          t          j        d          |d	
  
        }t          d|t          dt          j        d	
          t          dt          j        t	          d|z  dd                    t          dt          j        t	          d|z                      t          dt          j        d          d	           t          j        d!d"          t          j        ddd#d$          |d	
  
         t          d%|t          dt          j                  t          d&t          j        t	          |j        j                            t          d't          j        d(          d	)          t          j        dd*d+          |d	           t          d,|t          d-t          j        d	d./          t          dt          j        d(          d01          t          d2t          j        d(          d31          t          d4t          j        d5          d61          |d78           t          d9|t          dt          j        d(                    |d:8           t           j        j        j        re|t          d;|t          d-t          j        d	
          t          dt          j        d(                    t          d<t	          d=t           j        j        z                      d	t&          j        j        j        >           nt          d?|t          d-t          j        d	
          t          d@t	          dAt&          j        j        j        z                      t          dt          j        d(                    |d	           t          dB|t          d-t          j        d	
          t          dt          j        d(                    |d	           t           j        j        j        r_t3          dC|j        j        |j        j        d	            t3          dD|j        j        |j        j        |j        j                   |st          dE|t          dFt          j        d                    d	G          }t          dH|t          d-t          j        d	
          t          dFt          j        d                    d	G          }t           j        j        j        rnt           j        j        j        rXt3          dI|j        j                                                   t3          dJ|j        j                                                   t           j        j         j        r| !                    ||           |s-t           j        j"        j        r| #                    |           d S d S d S )KN. z%susers.user_id
user_id_fkr	  rG   usersuser_idTrM   test1   Fnullabletest2parent_user_id	test2 > 0zz_test2_gt_zerousers check constraintrm   r   test2 <= 1000rS   r   
dingalingsdingaling_id
address_idz%semail_addresses.address_idzz_email_add_id_fgdi fk commentid_userrO      )uniquez$address_id > 0 AND address_id < 1000address_id_gt_zerozz_dingalings_multipledi unique commentemail_addressesremote_user_idemail_address   )indexemail_ad_pkea pk commentcomment_testrL   
id comment)rN   r   data % commentr   d2)Comment types type speedily ' " \ '' Fun!d3*   Comment
withescapesthe test % ' " \ table comment)rS   r   no_constraints"no
constraintshasescapedcommentlocal_table	remote_idz%s.remote_table_2.id)r   rS   remote_tablelocal_idz%s.local_table.idremote_table_2users_t_idxusers_all_idxnoncol_idx_test_nopkqr   noncol_idx_test_pknoncol_idx_nopknoncol_idx_pk)$r   rT   self_referential_foreign_keysr9   r   r   r   rp   rq   CHARFloatr   r  r   r  r   rP  r  cross_schema_fk_reflectionr   rV   r>   r{   default_schema_namer   r%   rQ  rU  indexes_with_ascdescreflect_indexes_with_ascdescr  descr  rX   r   rZ   )r?   r\   rS   schema_prefixparent_id_argsrO  r  r  s           r@   rJ  z/ComponentReflectionTest.define_reflected_tables}  sy    	"SLMMM9A 	 %5L  NN  N9bf$7777BGAJJ7777BHJJ777#RZA.AAA'0  
 //
 
 
" 	>2:4@@@
2]B-+    
,}<== 
 629R==6666)   -+	   =	
 	
 	
 	
@ 	<,,#RZEGO1L1LMM?BIbMM>>>#=/   	
 	
 	
 	
 	4|LLL629R==2BCCC	"H  
 420HIII9	
 	
 	
 	
 	629R==))<	
 	
 	
 	
 6> '	~!4>>>629R==11#"2W^5OO   #'!9,@     "4>>>""/$i/CD   629R==11!"&    $4>>>629R==11!"&    ,4 	J-dKKKK%'-    J',*3	!--"&	( ( ($ &+(4>>>3	!--"&& & &" $9AJ(EMJ +-A-C-E-J-J-L-LMMM/+=+?+A+F+F+H+HIII2: 	/Xv... 	-'*@H 	-""8,,,,,	- 	- 	- 	-rB   c                 \    t          t          t          j        dt          j                   S re   rg   ri   s    r@   rj   z'ComponentReflectionTest.temp_table_name+  rk   rB   c                    t          t          t          j                  }|                                 }t	          ||t          dt          j        d          t          dt          j        d                    t          dt          j                  t          j	        ddt          j
                   t          j        d	d          fi |}t          j        j        j        rkt          j        j        j        rWt#          j        |d
t'          dt          j
        z                       t#          j        |dt'          d                     d S d S d S )NrL   TrM   rm   rP   r   user_tmp_uq_r	  user_tmp_ixr_   rn   r`   ro   )r   r   r>   rj   r   r   rp   rq   rr   r  rh   r%   r   rT   rW   r9   rs   r   rb   r$   rt   s        r@   rZ   z*ComponentReflectionTest.define_temp_tables1  sJ   $VVY77((**
4T22262:b>>**5"&!! -JFL-J-JKKKH]E**
 
 
 
" ,4	O 08	O L028,?    L=#6L2M2MNNNNN	O 	O 	O 	OrB   c                    t           j        j        j        rdh}nt	                      }dD ]}|}|r| d| }|dz   }||v rdnd}d| d| d	| }t          j        |d
t          |                     ||v rKd}	|rt          j        d          r| d|	 }	d|	 d| d}
t          j        |d
t          |
                     t          j        |dt          d| d|                      d S )Nr]  rO  rh  r]  rL  _vzMATERIALIZED rM  zCREATE zVIEW r  r_   	mat_indexoraclezCREATE INDEX z ON z(data)r`   zDROP )	r   rT   materialized_viewsr9   setr   rb   r$   against)r?   r\   rS   materializedrv   fullname	view_nameprefixrc   
index_namer   s              r@   rX   z$ComponentReflectionTest.define_viewsS  s]   .6 	!(>LL55LD 	 	J!H 4$33z33 4I(2l(B(B__FN&NNyNNHNN  L>3u::>>>\))(
 :goh77 :$*!9!9Z!9!9JGjGGiGGGX~s3xx@@@L--MV-M-M)-M-M)N)N   #	 	rB   c                     i }t           j        |v r|                    |           t           j        |v r|                    |           t           j        |v r|                    |           |S r   )r    rA  updaterB  rC  )r~   r   r   r   r  r  s         r@   _resolve_kindz%ComponentReflectionTest._resolve_kindn  sk    t##JJv?d""JJu'4//JJ|$$$
rB   c                    t           j        j        j        s*|                                 |                                 d S t           j        j        j        s+|                    |           |                                 d S d S r   )r   rT   r  r9   clearr  r  )r~   r   r  s      r@   _resolve_viewsz&ComponentReflectionTest._resolve_viewsx  s{    6> 	!   KKMMMMM!4< 	!LL&&&     	! 	!rB   c           	      4   d |t           j        u rd |t           j        u rd d ddht          j        j        dddd	|                                 hit          j        j        j	        sGd          
                    d           t          j        j                                     ddg           t          j        j        j	        sd                              ddg           t          j        j        j	        rt          j        j        j	        s/d                              d	|                                 g           t          j        j        j	        sd                              d	g           fd
|                                D             }|S )Nc                     dS )NTrG   )_s    r@   r   z8ComponentReflectionTest._resolve_names.<locals>.<lambda>  s     rB   c                     d| d         vS Ntmpr   rG   r   s    r@   r   z8ComponentReflectionTest._resolve_names.<locals>.<lambda>  s    U!A$%6 rB   c                     d| d         v S r  rG   r  s    r@   r   z8ComponentReflectionTest._resolve_names.<locals>.<lambda>  s    Uad] rB   r|  r~  rz  r  r  r   c                 j    i | ]/\  }} |          r|d                   vrr
|d          v ,||0S )r   rG   ).0r   vrE  removedrS   scope_filters      r@   
<dictcomp>z:ComponentReflectionTest._resolve_names.<locals>.<dictcomp>  sg     
 
 
1|A
 !GFO++! ,%&qT\%9%9	 q &:%9%9rB   )r!   r>  r?  r   r   rV   rj   rT   r  r9   addr  r   r   temp_table_namesrs   items)r~   rS   r5   rE  valuesr  r  r  s    ` `  @@r@   _resolve_namesz&ComponentReflectionTest._resolve_names  s   %~K'''66LK)))22L >#34N&&$$$&&)	
 :B 	DMm,,,GN./66!12   08 	DM  ')=>    6>	I#4<	I DM  ,0D0D0F0F!GHHH/7 	1DM  ,000
 
 
 
 
 
 

 
 
 
rB   c                 f   |dft           j        i}|dft           j        |dft           j        |dft           j        i}|                     ||           |dft           j        |dft           j        |dft           j        |dft           j        |d	ft           j        |d
ft           j        |dft           j        |dft           j        |dft           j        |dft           j        ||                                 ft           j        i}|                     ||||          }|                     ||||          }|S )Ndingalings_vemail_addresses_vusers_vr   rO  r]  rh  ro  rx  rz  r|  r~  r  r  r-   r@  r  rj   r  r  )	r~   rS   r5   r   rE  r  r   r   r  s	            r@   exp_optionsz#ComponentReflectionTest.exp_options  s.     0$(;()48Y\"DH

 	E<000Wtx\"DH&'^$dh%&]#TX^$dh%&+,dh)*DHT))++,dh
   vulCC!!&%sCC
rB   c                 J   dd i}|df|i}|df||df||df|i}|                      ||           |df||df||df||d	fdd
i|dfddi|df||df||df||df||df|||                                 f|i}|                     ||||          }	|                     ||||	          }	|	S )Ntextr  r  r  r   rO  r]  rh  ro  rw  rx  ry  rz  r|  r~  r  r  )r  rj   r  r  )
r~   rS   r5   r   rE  emptyr  r   r   r  s
             r@   exp_commentsz$ComponentReflectionTest.exp_comments  s/    0%8()5Y\"E

 	E<000Wu\"E&'^$=' %&@) ]#U^$e%&+,e)*ET))++,e
"   vulCC!!&%sCC
rB   c                   
 dt           j        d dfd

fd}|df 
ddt           j                   
d	           
d
           
d          gi}|df 
d	dt           j                   
d           
d          g|df 
ddt           j                   
dt           j                   
dt           j                   
d          g|df 
ddt           j                   
d           
d          gi}|                     ||           |df |d           
dd           
dd           
d          g|df |d           
d	           
d
           
d          g|df |d	           
d           
d          g|df |dd           
dd           
d d!           
d"d#          g|d$f 
d          g|d%f |d           
d           
d&          g|d'f |d           
d(           
d          g|d)f |d           
d          g|d*f 
d+          g|d,f |d           
d+          g||                                 f |d           
d           
d          gi}|                     ||||          }	|                     ||||	          }	|	S )-NFTc                 b    | |t           j        |||d}|dk    r|                    d           |S )N)rm   autoincrementtypedefaultr   rT  omitr  )r-   r@  pop)rm   autor  r   rT  r  s         r@   r   z0ComponentReflectionTest.exp_columns.<locals>.col  sF     !%""$ C v~~(((JrB   c                 :    dt           j        dd|} | fi |S )NTF)r  r  rT  r-   r@  )rm   ru   r   s     r@   pkz/ComponentReflectionTest.exp_columns.<locals>.pk  s-    48MM"MB3t??r??"rB   r  r^  r  )r  rT  r_  rb  rO   r  ri  rj  r  rP  rQ  rS  rU  rV  r   rL   rm   r   rO  r]  rh  ro  rp  r   rq  rr  rs  rt  rv  rx  rz  r{  r|  r}  r~  r  r  r  r  )r~   rS   r5   r   rE  r  r  r   r   r  r   s             @r@   exp_columnsz#ComponentReflectionTest.exp_columns  s    dht	 	 	 		# 	# 	# 	# 	#
 ^$N$(CCCL!!IF	'
 ()LvAAA$%%O$$,
 YIFTX>>>Gdh///Gdh///$%%	" \"Dv999FE

%
$ 	E<000W9Ge,,,Ge,,,$%%	  \">""L!!IF	% &'<  $%%O$$*
 ^$4...F$4555L   D":;;;' %&V]#bbhhFSS=M=M%N^$rr$xxZ##f++&N%&D33v;;(?+,ss3xxj)*RRXXss3xx,@T))++,4FE

/C&
N   vulCC!!&%sCC
rB   c                 
    h dS )N>   rm   r  r  rT  rG   r   s    r@   _required_column_keysz-ComponentReflectionTest._required_column_keysN  s    6666rB   c                    t           j        d dd} |d           }t          j        j        j        r|df |d          i}n|df|i}|df||df||df|i}|                     ||           |d	f |d
          |df |d          |df |ddd          |df |d          |df||df |d          |df |d          |df |d          |df||df |d          ||                                 f |d          i}	t          j        j        j        s.|		                                D ]}
|
d         t           j        |
d<   | 
                    ||	||          }|                     ||||          }|S )NrZ  c                 (    t          |          | |dS )N)constrained_columnsrm   r   )list)rm   r   colss      r@   r  z+ComponentReflectionTest.exp_pks.<locals>.pkY  s     '+Dzz"  rB   r	  r  r^  r  r  r   rO  rP  r]  rh  r_  rm  rn  ro  rL   rx  rz  r|  r~  r  r  rm   )r-   r@  r   rT   materialized_views_reflect_pkr9   r  rj   reflects_pk_namesr  r  r  )r~   rS   r5   r   rE  r  r  r  r   r   valr  s               r@   exp_pkszComponentReflectionTest.exp_pksR  s     8T 	 	 	 	 	 9A 	=#^4bb6H6HILL#^4e<L()5Y\"E

 	E<000Wrr)}}\"BB~$6$6&'=/* * * ^$bbhh%&]#RRXX^$bbhh%&4+,e)*BBtHHT))++,bbhh
 19 	+}} + +v;*"&(CK  vulCC!!&%sCC
rB   c                 
    ddhS )Nrm   r  rG   r   s    r@   _required_pk_keysz)ComponentReflectionTest._required_pk_keys  s    -..rB   c                 X    G d d          |t           j        d ffd	}|dfg i}|dfg |dfg |dfg i}|                     ||           |df |d	gd
gdd          g|df |dgd
gd           |dgdgddd          g|df |dgd
gd          g|dfg |dfg |df |dgdgdt          j                  g|df |dgdgdd           g|dfg |dfg |dfg ||                                 fg i}t          j        j        j	        s||df         
                                 t          j        j        j	        s?|                                D ]*}	|	D ]%}
|
d          t           j        urt           j        |
d <   &+|                     ||||          }|                     ||||          }|S )!Nc                       e Zd Zd ZdS )+ComponentReflectionTest.exp_fks.<locals>.ttc                 >    |d u pt           j        j        j        |k    S r   )r   r>   r{   r  )r~   r   s     r@   __eq__z2ComponentReflectionTest.exp_fks.<locals>.tt.__eq__  s$    TM Fy(<ErB   NrC   rD   rE   r  rG   rB   r@   r   r    s#            rB   r   c                 D    | ||t           j        ||n	             ||dS )N)r  referred_columnsrm   r6   referred_schemareferred_tabler   r  )r  ref_col	ref_table
ref_schemarm   r   r   s         r@   fkz+ComponentReflectionTest.exp_fks.<locals>.fk  s:     (,$+8","8JJbbdd"+"
 
 
rB   r  r  r  r   rO  rV  rP  rN  r	  r]  rb  r_  rh  r`  ra  rZ  ri  ro  rx  rz  r{  rL   r~  )r  r|  r}  r  r  rm   )r-   r@  r  r   rV   rj   r   rT   r  r9   r  named_constraintsr  r  r  )r~   rS   r5   r   rE  r  r  r   r   valsr  r  r   s               @r@   exp_fkszComponentReflectionTest.exp_fks  s   	 	 	 	 	 	 	 	 	 	 	 	 	 	(  0"5()2Y\"B

 	E<000W$%	{G,OOO  \"I;W55!N!N%-+  	% &'$%	{G<<* ^$b%&]# MF$%1	  & ^$J<$4HHH' %&+,b)*BT))++,bC"
F =E 	.FG$%++---19 	/ / / / /C6{$(22&*hF/   vulCC!!&%sCC
rB   c                 
    h dS )N>   rm   r  r  r  r  rG   r   s    r@   _required_fk_keysz)ComponentReflectionTest._required_fk_keys  s    
 
 
 	
rB   c                    dd dddd}|dfg i}|dfg |dfg |dfg i}|                      ||           |r(||df                              |dd	
                     |dfg  |ddd           |dddd
           |dddd          |dfg  |dt          j        dd           |dt          j        d           |ddddd          |dfg  |dt          j        
           |dt          j        d          |dfg |d fg |d!fg  |d"t          j        d          |d#fg  |d$t          j        d          |d%fg |d&fg  |d'd(d'd)i*          |d+fg  |d'd,d'd)i*          ||                                 fg  |d-d.
           |d/d0t
          j         dd1          i}t          j        j	        j
        rt          j        j        j
        s8||d&f                                          ||d+f                                          |                     ||||          }	|                     ||||	          }	|	S )2NF)rd  column_sorting
duplicatesr  c                 <   t           j        j        }t           j        j        }t           j        j        }|r|j        r	|r	|j        sdS |t          |          | t          j        g d}	r*|	d<   |j        r|	d         x|	d<   }
fd|
D             |	d<   |r| |	d<   |	gS )NrG   )rd  r   rm   dialect_optionsinclude_columnsr  r   expressionsc                      g | ]
}|v rd n|S r   rG   )r  r   r  s     r@   
<listcomp>zDComponentReflectionTest.exp_indexes.<locals>.idx.<locals>.<listcomp>  s4     + + +?@^ 3 3+ + +rB   duplicates_constraint)	r   rT   foreign_keys_reflect_as_index#unique_constraints_reflect_as_index*reflect_indexes_with_ascdesc_as_expressionr9   r  r-   r@  )rm   rd  r  r  r  r  fk_reqdup_reqsorting_expressionr  origs     `        r@   r   z0ComponentReflectionTest.exp_indexes.<locals>.idx  s     %CF&JG K   6> #*? r  $T

#'8#% C  (6$%%- 03N0CCC&+ + + +DH+ + +C'  4/3+,5LrB   r  r  r  r   rO   r  r	  rO  rV  rN  T)rm   r  rP  rU  rQ  r  r  )rm   rd  r]  )rm   rd  r  rb  r_  r^  rf  rh  rj  ri  ro  rx  rz  r{  r|  r}  r~  r  r  r  )r  )rm   r  r  r  r   r  rm   r  )rm   r  rd  )r  extendr-   r@  rj   r   rh   r   rT   r  r9   r  r  r  r  )
r~   rS   r5   r   rE  r   r  r   r   r  s
             r@   exp_indexesz#ComponentReflectionTest.exp_indexes  s    #	 #	 #	 #	 #	J  0"5()2Y\"B

 	E<000 	&.1299F---   W  %LTBBB YGGG  WgM$GGG 
 \" 
%V$(4DIII
%YTX$777
%  "1#  
% &' *_48444*%DH>>>* ^$b%&]# &[txD999& ^$ 'Zdh4888' %&+, /*$'#3  / )* -osI>N  -
 T))++, /U////666#	  /U3
j  5=	;#@H	; F234::<<<F01288:::  vulCC!!&%sCC
rB   c                 
    h dS )N>   rm   rd  r   rG   r   s    r@   _required_index_keysz,ComponentReflectionTest._required_index_keys]  s    1111rB   Fc                    d dd dd}|dfg i}|dfg |dfg |dfg i}|                      ||           |dfg  |d	d
ddd          |dfg  |dt          j        t          j                   |ddddd          |dfg |dfg |dfg |dfg |dfg |dfg |dfg |dfg ||                                 fg  |ddt          j                    i}	|ri |||	S |                     ||	||          }
|                     ||||
          }
|
S )!NF)duplicates_indexis_indexr   c                 t    t           j        j        }|r	|j        sdS t	          |          | |d}|r||d<   |gS )NrG   )r   rm   r   r  )r   rT   *unique_index_reflect_as_unique_constraintsr9   r  )rm   r  r  r   r  reqr  s          r@   ucz+ComponentReflectionTest.exp_ucs.<locals>.uci  s\     "MC  r $T

" C
   ;*:&'5LrB   r  r  r  r   rO  rQ  rU  r  T)rm   r  r  r]  rO   )rm   r  r_  r^  rf  rg  )rm   r  r   rh  ro  rx  rz  r|  r~  r  r  rm   r  r	  )r  r-   r@  rj   r   rh   r  r  )r~   rS   r5   r   rE  all_r  r  r   r   r  s              r@   exp_ucszComponentReflectionTest.exp_ucsa  s    +/	 	 	 	 	  0"5()2Y\"B

 	E<000W  &%2!    \" 	%FDHEEE	% "1%=/  	% &'^$b%&]#R^$b%&+,b)*BT))++, /F!>!>!>???/9
@  	6l6e6v66$$T65,GGC%%fe\3GGCJrB   c                 
    ddhS )Nrm   r   rG   r   s    r@   _required_unique_cst_keysz1ComponentReflectionTest._required_unique_cst_keys  s    ''rB   c                   
  G d dt                     
d
fd	}|dfg i}|dfg |dfg |dfg i}|                     ||           |df |d	t          j                   |d
dd          g|df |dd          g|dfg |dfg |dfg |dfg |dfg |dfg |dfg |dfg ||                                 fg i}|                     ||||          }	|                     ||||	          }	|	S )Nc                       e Zd Zd ZdS )+ComponentReflectionTest.exp_ccs.<locals>.ttc                     |                                                     dd                              dd                              dd          }| |v S )N(rM  )`)lowerreplace)r~   r   r  s      r@   r  z2ComponentReflectionTest.exp_ccs.<locals>.tt.__eq__  sK    KKMMWS"%%WS"%%WS"%%	  s{"rB   Nr  rG   rB   r@   r   r    s#        # # # # #rB   r   c                 "     |           ||dS )N)sqltextrm   r   rG   )r  rm   r   r   s      r@   ccz+ComponentReflectionTest.exp_ccs.<locals>.cc  s    !r$xx'JJJrB   r  r  r  r   rO  r[  rW  rX  rY  r   r]  z$address_id > 0 and address_id < 1000re  r	  rh  ro  rx  rz  r|  r~  r  r  r   )strr  r-   r@  rj   r  r  )r~   rS   r5   r   rE  r  r  r   r   r  r   s             @r@   exp_ccszComponentReflectionTest.exp_ccs  s   	# 	# 	# 	# 	# 	# 	# 	#	K 	K 	K 	K 	K 	K
  0"5()2Y\"B

 	E<000W?DH--&4    \":-  % &'^$b%&]#R^$b%&+,b)*BT))++,b/
2   vulCC!!&%sCC
rB   c                 
    ddhS )Nrm   r  rG   r   s    r@   _required_cc_keysz)ComponentReflectionTest._required_cc_keys  s    	""rB   c                     t          |          }t          t          j        j        |                                v            d S r   )r   r,   r   r   rV   get_schema_namesr   s      r@   test_get_schema_namesz-ComponentReflectionTest.test_get_schema_names  s9    z""*d.C.C.E.EEFFFFFrB   c                     t          |          }t          |                    t          j        j                             t          |                    d                     d S )Nsa_fake_schema_foo)r   r,   
has_schemar   r   rV   r*   r   s      r@   test_has_schemaz'ComponentReflectionTest.test_has_schema  sO    z"" :;;<<<!56677777rB   c                     |                     ddt          t          j        j        i          }t          |          }t          t          j        j        |                                v            dS )z
test #7300r   barschema_translate_mapN)execution_optionsr'   r   r   rV   r   r,   r!  r   s      r@   %test_get_schema_names_w_translate_mapz=ComponentReflectionTest.test_get_schema_names_w_translate_map  sk      11ugn8" 2 
 

 z""*d.C.C.E.EEFFFFFrB   c                 &   |                     ddt          t          j        j        i          }t          |          }t          |                    t          j        j                             t          |                    d                     d S )Nr   r(  r)  r$  )	r+  r'   r   r   rV   r   r,   r%  r*   r   s      r@   test_has_schema_w_translate_mapz7ComponentReflectionTest.test_has_schema_w_translate_map  s    11ugn8" 2 
 

 z"" :;;<<<!56677777rB   c                    t          |          }t          d|                                v            t          |                    d                     |                    t          d                     	 t          d|                                v            t          |                    d                     |                                 t          d|                                v            t          |                    d                     |                    t          d                     d S # |                    t          d                     w xY w)Nfoo_barzCREATE SCHEMA foo_barzDROP SCHEMA foo_bar)r   r*   r!  r%  executer$   r   r,   r   s      r@   test_schema_cachez)ComponentReflectionTest.test_schema_cache  s6    z""d33555666++,,,3677888	;Y$"7"7"9"99:::T__Y//000I!6!6!8!88999DOOI..///s#899:::::Js#899::::s   8BD: :$Ec                 x    t          j                    }t          |           t          |j        d          sJ d S )Nr  )r   r;   r   hasattrr{   )r~   engines     r@   test_dialect_initializez/ComponentReflectionTest.test_dialect_initialize!  s:    '))v~'<=======rB   c                 b    t          |          }t          |j        |j        j                   d S r   )r   r   r  r{   r   s      r@   test_get_default_schema_namez4ComponentReflectionTest.test_get_default_schema_name'  s.    z""D$j&8&LMMMMMrB   foreign_keyorder_byr   
use_schemac                 T  	 |rt           j        }nd }h d	t          |          }|r d |                    |          D             }n|                    |          }	fd|D             }|dk    rg d}t          ||           d S g d}t          t          |          |           d S )N>   rz  ro  r|  rx  r~  r  r  c                 .    g | ]}|d          
|d          S )r   rG   )r  recs     r@   r  z@ComponentReflectionTest.test_get_table_names.<locals>.<listcomp>G  s6       q6A  rB   c                     g | ]}|v|	S rG   rG   )r  t_ignore_tabless     r@   r  z@ComponentReflectionTest.test_get_table_names.<locals>.<listcomp>N  s#    DDDQA^,C,Cq,C,C,CrB   r9  r  )r]  rh  rO  )r   rV   r   get_sorted_table_and_fkc_namesget_table_namesr   sorted)
r~   r   r:  r;  rS   r   r   r   answerrA  s
            @r@   test_get_table_namesz,ComponentReflectionTest.test_get_table_names,  s      	'FFF
 
 
 z"" 	2 >>vFF  FF ))&11FDDDD&DDD}$$???FV$$$$$???F{##V,,,,,rB   c                 h   t          |          }|rt          j        }nd }|                    |          }t          j        j        j        rEt          t          |          ddg           t          |
                    |          dg           d S g d}t          t          |          |           d S )Nr  r  r  )r  r  r  )r   r   rV   get_view_namesr   rT   r  r9   r   rD  get_materialized_view_names)r~   r   r;  r   rS   r   rE  s          r@   test_get_view_namesz+ComponentReflectionTest.test_get_view_namesW  s     z"" 	'FFF))&11.6 	-{##&99%EFFF0088>:JKKKKKEEEF{##V,,,,,rB   c                     t          |          }|                                }t          t          |          dt          j         g           d S re   )r   get_temp_table_namesr   rD  r   rh   r~   r   r   r  s       r@   test_get_temp_table_namesz1ComponentReflectionTest.test_get_temp_table_namesh  sN    z""4466F#$$'A6<'A'A&BCCCCCrB   c                     t          |          }|                                }t          t          |          dg           d S r   )r   get_temp_view_namesr   rD  rM  s       r@   test_get_temp_view_namesz0ComponentReflectionTest.test_get_temp_view_namesn  sD     z""3355F#$$|n55555rB   c                 0    |                      |           d S r   )_test_get_commentsr~   r   s     r@   test_get_commentsz)ComponentReflectionTest.test_get_commentsu  s    
+++++rB   c                 P    |                      |t          j        j                   d S r   )rS  r   r   rV   rT  s     r@   test_get_comments_with_schemaz5ComponentReflectionTest.test_get_comments_with_schemay  s%     	
GN,FGGGGGrB   c                    t          |          }|                     |          }t          |                    d|          ||df                    t          |                    d|          ||df                    t          |                    d|          ||df                    | j        j        j        }t          |                    ||          |||f                    d S )NrR   ro  rO  )r   r  r   r3  r   rx  rm   )r~   r   rS   r   expno_csts         r@   rS  z*ComponentReflectionTest._test_get_comments~  s   z""v.."">&"AA()	
 	
 	

 	""76"::!"	
 	
 	

 	"">&"AA()	
 	
 	

 +0""6&"99 !	
 	
 	
 	
 	
rB   )FFzuse_views,use_schemac                    |rt           j        }nd }| j        j        | j        j        }}|rg d}nddg}t          |          }t          |||f          D ]\  }	}
|}|                    |	|          }t          t          |          dk    t          |                     t          |
j                  D ]\  }}t          |j        ||         d                    ||         d         j        }|j        }t!          |t"          j        j                  r|j        }t)          j        d          r&|t,          j        t,          j        fv rt,          j        }t          t          t3          |j                                      |j                                      t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j         g                    dk    |j        d	|j        d
||         d         d	|d           |j!        s||         d         J d S )Nr  r  r  rO  rh  rR   r   rm   r  r  r  z), r  r  )"r   rV   r   rO  rh  r   zipr   r,   len	enumeratecolumnsr   rm   	__class__r  r  rp   r   
TypeEnginer   r  	sql_typesDater   r  __mro__intersectionr   NumericTimer   _BinaryrN   )r~   r   	use_viewsr;  rS   rO  	addressesr   r   rv   tableschema_namer  ir   ctype	ctype_defs                    r@   r%  z(ComponentReflectionTest.test_get_columns  sF     	'FFF K-t{/Jy 	7JJJKK"$56Kz""!$[5)2D!E!E /	6 /	6J K##J{#CCDCIIM3t99--- $EM22 (6 (63CHd1gfo...Q1H	i)<== 4 ) 3I ?8,, /N&? 2 2 !*I
 EM**%i&788% ) 1 ) 1 ) 2 ) ) ) 0 ) 1
 
  " xxx476???EEEC#  *  679-555Q(6/	6 /	6rB   c                     |                                  }| j        |         }t          |t                      |          }|                     ||d           d S )Nr   F)strict_constraints)rj   r   r   r   assert_tables_equal)r~   r   rv   rw   reflected_user_tmps        r@   test_reflect_table_temp_tablez5ComponentReflectionTest.test_reflect_table_temp_table  sp    ))++
;z*"

*
 
 
 	  (U 	! 	
 	
 	
 	
 	
rB   c                 b   |                                  }| j        |         }t          |          }|                    |          }t	          t          |          dk    t          |                     t          |j                  D ]&\  }}t          |j	        ||         d                    'd S )Nr   rm   )
rj   r   r   r   r,   r^  r_  r`  r   rm   )r~   r   rv   rw   r   r  rn  r   s           r@   test_get_temp_table_columnsz3ComponentReflectionTest.test_get_temp_table_columns  s    ))++
;z*z""
++D		As4yy))) 011 	+ 	+FAs$q'&/****	+ 	+rB   c                     t          |          }|                    d          }t          d |D             g d           d S )Nr   c                     g | ]
}|d          S r	  rG   r  r   s     r@   r  zFComponentReflectionTest.test_get_temp_view_columns.<locals>.<listcomp>  s    )))SS[)))rB   )rL   rm   r   )r   r   r   )r~   r   r   r  s       r@   test_get_temp_view_columnsz2ComponentReflectionTest.test_get_temp_view_columns  sP     z""--))D)))+@+@+@AAAAArB   )Fc                    |rt           j        j        }nd }| j        j        | j        j        }}t          |          }|                     |          }|                    |j	        |          }| 
                    |g|||j	        f         g| j                   |                    |j	        |          }	|||j	        f         d         }
t          |	d         |
           t           j        j                                        5  t          |	d         d           d d d            n# 1 swxY w Y   | j        j        j	        }| 
                    |                    ||          g|||f         g| j                   d S )NrR   r  rm   rm  )r   r   rV   r   rO  rh  r   r  r'  rm   _check_listr  r   rT   r  fail_ifrx  )r~   r   r;  rS   rO  rk  r   rY  
users_cons	addr_consexp_colsrZ  s               r@   r(  z.ComponentReflectionTest.test_get_pk_constraint  s   
  	^/FFF;,dk.Iyz""ll&l))++EJv+FF
L3
345t7M	
 	
 	
 **9>&*II		/01FGI+,h777/7799 	2 	2	&!=111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 +0##F6#::;&&!"#"	
 	
 	
 	
 	
s   D((D,/D,PK_test_tablepk_test_tablemixedCasePKzpk.with.dotspk_namec                 |   t          d|t          dt                    t          dt          d                    t	          j        d|                     |                    |           t          |          }|                    d          }t          |d         |           t          |d         dg           dS )	zZTest that primary key constraint names with various casing are
        properly reflected.rK   rL   rO   rP   r	  rm   r  N)
r   r   r   r   rp   r  r   r   r'  r   )r~   r   r\   r  r   pk_conss         r@   "test_get_pk_constraint_quoted_namez:ComponentReflectionTest.test_get_pk_constraint_quoted_name"  s     	4!!66"::&&#Dw777	
 	
 	
 	J'''z""((66GFOW%%%G)*TF33333rB   c                 d   |rt           j        }nd }| j        j        | j        j        }}t          |          }|}t          j        j        j	        r|
                    |j        |          }|d         }	t          j        j                                        5  t          |	d         d           d d d            n# 1 swxY w Y   t          |	d         |           t          |	d         |j                   t          |	d         dg           t          |	d	         d
g           |
                    |j        |          }
|
d         }	t          j        j                                        5  t!          |	d         d u           d d d            n# 1 swxY w Y   t          |	d         |           t          |	d         |j                   t          |	d         dg           t          |	d	         dg           | j        j        j        }t          |
                    ||          g            d S )NrR   r   rm   rN  r  r  r  rP  r  rV  ri  )r   rV   r   rO  rh  r   r   rT   r  r9   r*  rm   r  r~  r   implicitly_named_constraintsr,   rx  )r~   r   r;  rS   rO  rk  r   expected_schemausers_fkeysfkey1
addr_fkeysrZ  s               r@   r+  z-ComponentReflectionTest.test_get_foreign_keysA  s   
  	'FFF K-t{/Jyz""  9A 
	B//
6/JJKNE!3;;== 1 1E&M<0001 1 1 1 1 1 1 1 1 1 1 1 1 1 1 '(/:::&'444()I;777+,/?.@AAA **9>&*II
1:BBDD 	/ 	/E&M-...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	E#$o666E"#UZ000E$%	{333E'(+;*<===+0D!!&!88"=====s$   B;;B?B?,FFFFK_users_idfk_users_idmixedCaseNamezfk.with.dotsfk_namec                    t          d|t          dt          d          d           t          d|t          dt          d          t          dt                    t          j        dgdg|	          d           |                    |           t          |          }|                    d          }t          t          |          d
           |d         }t          j        j                                        5  t          |d         |           ddd           n# 1 swxY w Y   t          |d         d           t          |d         dg           t          |d         dg           dS )zZTest that foreign key constraint names with various casing are
        properly reflected.	users_refrP  TrM   r   user_ordersorder_idzusers_ref.user_idr	  r   r   rm   Nr  r  r  )r   r   r   rp   r   r   r   r*  r   r^  r   rT   r  r~  )r~   r   r\   r  r   fkeysfkeys          r@   !test_get_foreign_keys_quoted_namez9ComponentReflectionTest.test_get_foreign_keys_quoted_namek  s    	9g4888		
 	
 	
 	
 	:wD9999g&&#$%  
 	
 	
 	
 	
 	J'''z""%%m44CJJQx/7799 	' 	'Vg&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	D!"K000D#$yk222D&')55555s   >D!!D%(D%c                    |                      d|j        j        z  dt          j        j        z  dt          j        j        z            \  }}}t          |          }|                    |j                  }t          t          |          d           |d         }t          |d         t          j        j                   t          |d         |j                   t          |d         d	g           t          |d
         dg           |                    |j        t          j        j                  }t          t          |          d           |d         }	t          |	d         d |j        j        fv            t          |	d         |j                   t          |	d         d	g           t          |	d
         dg           d S )Nz%s.local_tablez%s.remote_tablez%s.remote_table_2r   r   r  r  r  rL   r  r{  rR   r}  )r   r{   r  r   r   rV   r   r*  rm   r   r^  r,   )
r~   r   rz  r|  r~  r   local_fkeysr  remote_fkeysfkey2s
             r@   "test_get_inter_schema_foreign_keysz:ComponentReflectionTest.test_get_inter_schema_foreign_keys  s    59KKz1EE ::'."<<5
 5
1\> z""++K,<==Ca   AE#$gn&@AAAE"#^%8999E$%v...E'(;-888,,gn&@ - 
 
 	Cq!!!Q#$"6	
 	
 	
 	E"#[%5666E$%v...E'(:,77777rB   c                 |   |rt           j        }nd }t          |          }|                    d|          }|                     |          }|                     |||df         | j                   | j        j        j	        }|                     |                    ||          |||f         | j                   d S )NrO  rR   )
r   rV   r   r-  r  r}  r  r   rx  rm   )r~   r   r;  rS   r   indexesrY  rZ  s           r@   r.  z(ComponentReflectionTest.test_get_indexes  s    
  	'FFF z""""76"::f--S&'*+T-F	
 	
 	
 +0VF33 !%	
 	
 	
 	
 	
rB   )r  r  )r  r  ztname,ixnamec                    t          |          }|                    |          }|                                 d |f         }|                     ||| j                   t          |t                      |          }t          t          |j	                  d           t          t          |j	                  d         j        |           t          t          |j	                  d         j        |           d S )Nr   r   r   )r   r-  r  r}  r  r   r   r   r^  r  r   r  rl  rm   )r~   r   tnameixnamer   r  expected_indexesr@  s           r@   test_get_noncol_indexz-ComponentReflectionTest.test_get_noncol_index  s     z""""5))  ++--tUm<"2D4MNNN%:>>>C	NNADOOA$a(((DOOA#V,,,,,rB   IX_test_dataix_test_datamixedCaseIndexzix.with.dotsidx_namec                    t          d|t          dt          d          t          dt          d                              }t	          |j        j                   |                    |           t          |          }|	                    d          }d |D             }|v sJ d d	|             fd
|D             }t          t          |          d           t          |d         d         dg           dS )zATest that index names with various casing are properly reflected.rK   rL   TrM   rO   rP   c                     g | ]
}|d          S r	  rG   r  r   s     r@   r  zHComponentReflectionTest.test_get_indexes_quoted_name.<locals>.<listcomp>  s    666ss6{666rB   z	Expected z in c                 ,    g | ]}|d          k    |S r	  rG   )r  r   r  s     r@   r  zHComponentReflectionTest.test_get_indexes_quoted_name.<locals>.<listcomp>  s'    JJJ#f+2I2I2I2I2IrB   r   r   r   N)r   r   r   r   r%   r   rO   r   r   r-  r   r^  )	r~   r   r\   r  r@  r   r  index_namesmatching_idxs	      `     r@   test_get_indexes_quoted_namez4ComponentReflectionTest.test_get_indexes_quoted_name  s    4d33366"::&&	
 
 	h!!!J'''z""""<0066g666;&&&(OH(O(O+(O(O&&& KJJJwJJJCq!!!LON+fX66666rB   c                     t          |          }|                                 }|                    |          }|                     d          d |f         }|                     ||| j                   d S )NT)r  )r   rj   r0  r  r}  r  )r~   r   r   rm   	reflectedrY  s         r@   &test_get_temp_table_unique_constraintsz>ComponentReflectionTest.test_get_temp_table_unique_constraints  sr     z""##%%//55	lll%%tTl3C)BCCCCCrB   c                 2   t          |          }|                                 }|                    |          }|D ]}|                    dd            ddgddg}t          j        j        j        rg |d         d<   t          d |D             |           d S )	Nr  Fr   r  )rd  r   rm   r   r  c                 *    g | ]}|d          dk    |S )rm   r  rG   r  s     r@   r  zGComponentReflectionTest.test_get_temp_table_indexes.<locals>.<listcomp>&  s&    DDDSs6{m'C'CS'C'C'CrB   )	r   rj   r-  r  r   rT   index_reflects_included_columnsr9   r   )r~   r   r   rv   r  indexpecteds          r@   test_get_temp_table_indexesz3ComponentReflectionTest.test_get_temp_table_indexes  s    z""))++
"":.. 	- 	-CGG%t,,,,ug}MM
 ;C 	0-/HQK)*DDGDDD	
 	
 	
 	
 	
rB   c                 ^   |rt           j        }nd }t          ddgddg dddg dddd	d
gdddgdddgdgt          j        d                    }t          d|t          dt          j        d                    t          dt          j        d                    t          dt          j	                  t          d	t          j        d                    t          d
t          j        d                    |          }|D ]2}|
                    t          j        |d         d|d         i           3|                    |           t          |          }t          |                    d|          t          j        d                    }	t                      }
t!          t#          |          t#          |	                     t%          ||	          D ]|\  }}|                    dd           }|r|
                    |           t!          |                    dd           d            |                    dd            t!          ||           }t+                      }t          d|||          }	d |	j        D             }d |	j        D                                 dg          }|                    |          rJ |
r,t!          |
|           t!          |t                                 | j        j        j        }t!          |                    ||          g            d S )Nunique_ar   )rm   r   unique_a_b_c)r   br   unique_c_a_b)r   r   r  unique_asc_keyascr   zi.have.dotsr  zi have spacesr   rm   r   testtblrk  rc  rR   r   r  r   r  )r   rS   c                     h | ]	}|j         
S rG   r	  r  s     r@   	<setcomp>zFComponentReflectionTest.test_get_unique_constraints.<locals>.<setcomp>w  s    ;;;#SX;;;rB   c                 P    h | ]#}t          |t          j                  |j        $S rG   )r  rp   r  rm   )r  uqs     r@   r  zFComponentReflectionTest.test_get_unique_constraints.<locals>.<setcomp>x  s=     
 
 
"b122
G
 
 
rB   )r   rV   rD  operator
itemgetterr   r   rp   r   r   append_constraintr  r   r   r0  r  r   r^  r]  r  r  r   r  constraints
differencerf  r   rx  rm   )r~   r\   r   r;  rS   uniquesrl  r  r   r  names_that_duplicate_indexr   refldupereflected_metadata	idx_namesuq_namesrZ  s                     r@   r1  z3ComponentReflectionTest.test_get_unique_constraints*  sm     	'FFF#cU;;'II'II)E5>JJ&>>(3%@@ #F++

 

 

 3	"&&3	"&&3
##5")B--((5")B--((

 

 

  	 	B###R%7IbjII    	Z   z""''	&'AA#F++
 
 
	
 &)UU"CLL#i..)))gy11 		 		JD$ 88.55D 5*..t444D))4000HH&---dOOOO%ZZ$	
 
 
	 <;):;;;	
 
+
 
 
 *n%
&
&	 	 ))(33333% 	!*I666#%%   +0D''v'>>CCCCCrB   UQ_emailuq_emailmixedCaseUQzuq.with.dotsuq_namec                    t          d|t          dt          d          t          dt          d                    t	          j        d|                     |                    |           t          |          }|                    d          }t          t          |          d           t          |d	         d
         |           t          |d	         d         dg           dS )zUTest that unique constraint names with various casing are
        properly reflected.rK   rL   TrM   emailrP   r	  r   r   rm   r   N)r   r   r   r   rp   r  r   r   r0  r   r^  )r~   r   r\   r  r   uq_conss         r@   'test_get_unique_constraints_quoted_namez?ComponentReflectionTest.test_get_unique_constraints_quoted_name  s     	4d3337F2JJ''g666	
 	
 	
 	J'''z""--l;;CLL!GAJv(((GAJ~&	22222rB   c                     |rt           j        }nd }t          |          }dD ]5}|                    ||          }t	          t          |                     6d S )Nr\  rR   )r   rV   r   r!  r,   bool)r~   r   r;  rS   r   viewr  s          r@   r#  z0ComponentReflectionTest.test_get_view_definition  sp    
  	'FFFz""D 	 	D((f(==ADGG	 	rB   c                 *   t          |          }t          t                    5  |                    d           d d d            n# 1 swxY w Y   t          t                    5  |                    d           d d d            d S # 1 swxY w Y   d S )Nview_does_not_existrO  )r   r   r"   r!  r   s      r@   'test_get_view_definition_does_not_existz?ComponentReflectionTest.test_get_view_definition_does_not_exist  s   z""+,, 	< 	<$$%:;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<+,, 	. 	.$$W---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.s#   AA
A
%BBBc                     t          |          }dD ]D\  }}|                    |          }d |D             |         }|                    dd          sJ EdS )a  test that 'autoincrement' is reflected according to sqla's policy.

        Don't mark this test as unsupported for any backend !

        (technically it fails with MySQL InnoDB since "id" comes before "id2")

        A backend is better off not returning "autoincrement" at all,
        instead of potentially returning "False" for an auto-incrementing
        primary key column.

        ))rO  rP  )rh  r_  )r]  r^  c                      i | ]}|d          |S r	  rG   r  r   s     r@   r  zBComponentReflectionTest.test_autoincrement_col.<locals>.<dictcomp>  s    ...A1V9a...rB   r  TN)r   r   get)r~   r   r   r  cnamer  id_s          r@   test_autoincrement_colz.ComponentReflectionTest.test_autoincrement_col  sz     z""
 	2 	2LE5
 ##E**D.....u5C77?D111111	2 	2rB   c                    t          t          j                  }|rt          j        nd }t          j        j        j        rt|                    d|          }t          t          |t                               |                    d|          }t          t          |t                               d S t          t                    5  |                    d|           d d d            d S # 1 swxY w Y   d S )NrO  rR   rx  )r   r   r>   rV   r   rT   r  r9   r  r,   r  r<   r   r  )r~   r;  r   rS   r  s        r@   r  z.ComponentReflectionTest.test_get_table_options  s)    vy!!'1;##t19 	?(((@@CJsD))***(()9&(IICJsD))*****233 ? ?&&wv&>>>? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s   C--C14C1c                    t          t          j                  t          j        j        j        r[|rt          j        nd                               }fd	                              D             }t          ||           d S t          t                    5                                   d d d            d S # 1 swxY w Y   d S )NrR   c                 D    i | ]}|f                     |           S )rR   )r  )r  rl  r   rS   s     r@   r  zHComponentReflectionTest.test_multi_get_table_options.<locals>.<dictcomp>  sB        !7!7f!7!M!M  rB   )r   r   r>   r   rT   r  r9   rV   get_multi_table_optionsrC  r   r   r  )r~   r;  r  rY  r   rS   s       @@r@   test_multi_get_table_optionsz4ComponentReflectionTest.test_multi_get_table_options  s"   vy!!19 	/+5?V''4F..f.==C    !111@@  C SMMMMM233 / /,,.../ / / / / / / / / / / / / / / / / /s   !CC
Cc                     fd}|S )Nc                     t                    } ||d           ||d}| r
 |             } g }t          j        |v r|                    g d           t          j        |v r|                    ddg           t          j        |v r|                    ddg           | r| |d<   |r||d<    || |||                    d          	          }	|g}
|t          j        k    r>|	                                }|
                    d
           |
                    |           |t          j        k    r>|	                                }|
                    d           |
                    |           t                    |
|	fS )Nrh  )r5   r   )ro  rO  does-not-existr  r  r  rS   rE  )rS   r5   r   rE  r5   r   )r   r    rA  r  rB  rC  r  r!   r>  copyr  append)rS   r5   r   r=  single_reflect_fn
exp_methodr   ru   rE  rY  kwsnkwr   s               r@   provide_fixturez>ComponentReflectionTest.get_multi_exp.<locals>.provide_fixture  s    :&&D d$5666 $//B "L4''##???   $&&##%8:J$KLLL+t33##^5E$FGGG &%8 2%1>"*VVN33	  C $C+++ggii   

3z'''ggii

3:&&S00rB   rG   )r~   r   r  s    ` r@   get_multi_expz%ComponentReflectionTest.get_multi_exp  s%    ,	1 ,	1 ,	1 ,	1 ,	1\ rB   c                      |||||t           j        | j                  \  }}}|D ]3}	|                                  |j        di |	}
t          |
|           4d S NrG   )r   r  r  r   r  r   r~   r  rS   r5   r   r=  r   r  rY  ru   results              r@   #test_multi_get_table_options_tablesz;ComponentReflectionTest.test_multi_get_table_options_tables'	  s    
 ''
 
c3  	 	B1T177B77F	 	rB   c                      |||||t           j        | j                  \  }}}|D ]1}	|                                 t	           |j        di |	|           2d S r  )r   r3  r  r   r   get_multi_table_comment)
r~   r  rS   r5   r   r=  r   r  rY  ru   s
             r@   test_get_multi_table_commentz4ComponentReflectionTest.test_get_multi_table_comment9	  s    
 ''
 
c3  	9 	9B,,22r22C8888	9 	9rB   c                     dt           fdt          |t                    r1t          fd|                                D             ||           d S t          fd|D             ||           d S )Nr  c                 R    t          j        dd|                                           S )Nz['\" ]rM  )resubr  )r  s    r@   _cleanz:ComponentReflectionTest._check_expressions.<locals>._cleanK	  s"    6)R..44666rB   c                 .    i | ]\  }} |          |S rG   rG   )r  er  r  s      r@   r  z>ComponentReflectionTest._check_expressions.<locals>.<dictcomp>O	  s'    999$!QA999rB   c                 &    g | ]} |          S rG   rG   )r  r  r  s     r@   r  z>ComponentReflectionTest._check_expressions.<locals>.<listcomp>Q	  s!    +++q+++rB   )r  r  r<   r   r  )r~   r  rY  err_msgr  s       @r@   _check_expressionsz*ComponentReflectionTest._check_expressionsJ	  s    	7 	7 	7 	7 	7 c4   	;9999&,,..9993HHHHH++++F+++S':::::rB   c                    |t          |||           d S t          t          |          t          |          |           t          ||          D ]\  }}t          |          t          |          z  D ]]}||v s||v rS||v rO| d| d| }|dv r$|                     ||         ||         |           @t          ||         ||         |           ^d S )Nz - )r  r  )r   r^  r]  r  r	  )	r~   r  rY  req_keysmsgrr  r   r  s	            r@   r}  z#ComponentReflectionTest._check_listS	  s   S!!!!!FSXXs+++FC(( 5 51Q#a&& 5 5AH}}aAFF%("6"6Q"6"61"6"6 AAA 33AaD!A$HHHH!adG44455 5rB   c                    t          t          |                                          t          |                                                     |D ]2}||         ||         }}|r|g|g}}|                     ||||           3d S r   )r   r  keysr}  )r~   r  rY  r  
make_listsr   r  r  s           r@   _check_table_dictz)ComponentReflectionTest._check_table_dicta	  s    CCHHJJ000 	0 	0A!9c!fqA  sQC1Q8Q////		0 	0rB   c                      |||||t           j        | j                  \  }}}|D ]?}	|                                  |j        di |	}
|                     |
|| j                   @d S r  )r   r   r  r   get_multi_columnsr  r  r  s              r@   test_get_multi_columnsz.ComponentReflectionTest.test_get_multi_columnsi	  s     '!
 
c3  	L 	LB+T+11b11F""630JKKKK	L 	LrB   c                      |||||t           j        | j                  \  }}}|D ]A}	|                                  |j        di |	}
|                     |
|| j        d           Bd S )NT)r  rG   )r   r'  r  r   get_multi_pk_constraintr  r  r  s              r@   test_get_multi_pk_constraintz4ComponentReflectionTest.test_get_multi_pk_constraint{	  s    
 ''L
 
c3  	 	B1T177B77F""T3 #    	 	rB   c                     t           j        j        j        s`||fD ]]}|                                D ]D}t          |          dk    r/t          d |D                       r|                    |           E\d S d S )Nr   c              3   \   K   | ]'}|                     d           dt          j        fv V  (dS )rm   N)r  r-   r@  )r  r  s     r@   	<genexpr>z7ComponentReflectionTest._adjust_sort.<locals>.<genexpr>	  sI       , ,>?f$)99, , , , , ,rB   r  )r   rT   r  r9   r  r^  anysort)r~   r  r  r   objr  s         r@   _adjust_sortz$ComponentReflectionTest._adjust_sort	  s    <D 	*) * *::<< * *C3xx!|| , ,CF, , , ) )| S)))	*	* 	** *rB   c                      |||||t           j        | j                  \  }}}|D ]W}	|                                  |j        di |	}
|                     |
|d            |                     |
|| j                   Xd S )Nc                 ,    t          | d                   S )Nr  tupleds    r@   r   zEComponentReflectionTest.test_get_multi_foreign_keys.<locals>.<lambda>	  s    uQ/D-E'F'F rB   rG   )r   r*  r  r   get_multi_foreign_keysr  r  r  r  s              r@   test_get_multi_foreign_keysz3ComponentReflectionTest.test_get_multi_foreign_keys	  s    
 '&L
 
c3  	H 	HB0T066266FFF   ""630FGGGG	H 	HrB   c                      |||||t           j        | j                  \  }}}|D ]?}	|                                  |j        di |	}
|                     |
|| j                   @d S r  )r   r-  r  r   get_multi_indexesr  r  r  s              r@   test_get_multi_indexesz.ComponentReflectionTest.test_get_multi_indexes	  s    
 '!
 
c3  	K 	KB+T+11b11F""630IJJJJ	K 	KrB   c                      |||||t           j        | j                  \  }}}|D ]W}	|                                  |j        di |	}
|                     |
|d            |                     |
|| j                   Xd S )Nc                 ,    t          | d                   S )Nr   r!  r#  s    r@   r   zKComponentReflectionTest.test_get_multi_unique_constraints.<locals>.<lambda>	  s    U1^;L5M5M rB   rG   )r   r0  r  r   get_multi_unique_constraintsr  r  r  r  s              r@   !test_get_multi_unique_constraintsz9ComponentReflectionTest.test_get_multi_unique_constraints	  s    
 ',L
 
c3  	P 	PB6T6<<<<Ffc+M+MNNN""630NOOOO		P 	PrB   c                      |||||t           j        | j                  \  }}}|D ]W}	|                                  |j        di |	}
|                     |
|d            |                     |
|| j                   Xd S )Nc                 ,    t          | d                   S Nr  r!  r#  s    r@   r   zJComponentReflectionTest.test_get_multi_check_constraints.<locals>.<lambda>	  s    U1Y<5H5H rB   rG   )r   r6  r  r   get_multi_check_constraintsr  r  r  r  s              r@    test_get_multi_check_constraintsz8ComponentReflectionTest.test_get_multi_check_constraints	  s    
 '+L
 
c3  	H 	HB5T5;;;;Ffc+H+HIII""630FGGGG		H 	HrB   r  r   r'  r*  r-  r0  r6  r3  methodc                     t          |          }t          ||          }t          t                    5   |d           d d d            d S # 1 swxY w Y   d S )Ntable_does_not_exists)r   getattrr   r"   )r~   r3  r   r   r   s        r@   test_not_existing_tablez/ComponentReflectionTest.test_not_existing_table	  s    0 z""tV$$+,, 	* 	*D()))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   AAAc           	      |   t           j        fd}t          j                            t           d|          5  t          t          d          5  t          |                              t          dt                                d            d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc                  d    |                     di           }t          d          |d<    | i |S )Nunreflectableerr)N
some_table)
setdefaultr#   )r   r   urmcs      r@   patchedz;ComponentReflectionTest.test_unreflectable.<locals>.patched
  s;    or22B'>u'E'EB#$2q;A;;rB   r  r;  r<  )r   r  r-   patchobjectr	   r#   r   reflect_tabler   r   )r~   r   r@  r?  s      @r@   test_unreflectablez*ComponentReflectionTest.test_unreflectable
  s>   (	 	 	 	 	
 Zy*=wGG 	 	&'>FF  
##11,

33T                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s5   B1>BB1B	B1 B	!B11B58B5r   c                    t                      }|rt          j        nd |                    ||d           t	          |          }|                              }|rB||                              z  }	 ||                              z  }n# t          $ r Y nw xY wrfd|D             }t          t          |j                  t          |                     d S )NF)rS   r   resolve_fksc                     g | ]	} d | 
S )rL  rG   )r  r@  rS   s     r@   r  z9ComponentReflectionTest.test_metadata.<locals>.<listcomp>"
  s#    666!oo!oo666rB   )r   r   rV   reflectr   rC  rH  rI  r  r   rD  r   )r~   r   r;  r   mr   r   rS   s          @r@   test_metadataz%ComponentReflectionTest.test_metadata
  s    
 JJ'1;##t			*V5e	LLLz""%%f-- 	d))&111F$::6BBB&    	76666v666FF18fVnn-----s   8B 
BBc           
         t          d|t          dt          d          t          dt          d          d           |                    |           t	          |          }|                    d          }t          |ddi           |                    d          }d	 |D             }ddd
}t          ||           d S )Nunicode_commentsunicodeu   é試蛇ẟΩr   emojiu	   ☁️✨u   試蛇ẟΩ✨r  c                 ,    i | ]}|d          |d         S rZ  rG   r  s     r@   r  zAComponentReflectionTest.test_comments_unicode.<locals>.<dictcomp>6
  s"    777Q6AiL777rB   )rM  rN  r   r   r   r   r   r3  r   r   )r~   r   r\   r   tcr  valuerY  s           r@   test_comments_unicodez-ComponentReflectionTest.test_comments_unicode%
  s    9g???7G[999$	
 	
 	
 	
 	J'''z""##$677B)*+++ 23377$777)K@@E3rB   c           	      b   t          d|t          dt          d          d           |                    |           t	          |          }|                    d          }t          |ddi           |                    d          d         }t          |d         |d	         iddi           d S )
NrL  rN  u&   🐍🧙🝝🧙‍♂️🧙‍♀️r   u&   🎩🁰🝑🤷‍♀️🤷‍♂️r  r   rm   r   rP  )r~   r   r\   r   rQ  r   s         r@   test_comments_unicode_fullz2ComponentReflectionTest.test_comments_unicode_full:
  s    7G-UVVV<		
 	
 	
 	
 	J'''z""##$677BABCCC/003QvY)%1Y'Z[[[[[rB   c           
         t           j                            t                    }t	          d|t          dt          j        |                    t          dt          j                                         |                    |           t                      }t	          d||          }t          |j        j        j        j        |           t          |j        j        j        j                   t#          |          }|                    d          \  }}t          |d         j        |           t          |d         j                   d S )Nr@  collated)	collationnot_collatedr   r  )r   rT   get_order_by_collationr   r   r   rp   r   r   r   r   r   rW  r  rX  r+   rY  r   r   )	r~   r   r\   rX  r   t2r   rW  rY  s	            r@    test_column_collation_reflectionz8ComponentReflectionTest.test_column_collation_reflectionK
  s    $;;FCC	:ry9===>>>29;;//		
 	
 	
 	J'''ZZ3*555BDM()444!&0111z""!%!1!1#!6!6,HV&	222V$./////rB   r   r.   )NF)urC   rD   rE   run_insertsr   r   rF   r]   rJ  rj   rZ   rX   r  r  r  r!   r@  r    r  r  r  propertyr  r  r  r  r  r  r  r  r  r  r  r   rT   schema_reflectionr"  r&  r,  r.  schema_create_deleter2  r6  r8  r   r   rU   rF  rJ  r  rN  rW   rs   rQ  r   rU  rW  rS  r%  r   ru  rw  r  r{  !primary_key_constraint_reflectionr(  r  r  r+  r  r  r  r   r.  r  r  r  r  r9  r  temp_table_reflect_indexesr  r1  r  r#  r  table_reflectionr  r  r  r  r  r  rF  r  r  r	  r}  r  r  r  r  r&  r)  r-  r:  r2  r7  rD  r   rJ  rS  comment_reflection_full_unicoderU  column_collation_reflectionorder_by_collationr\  rG   rB   r@   rH  rH  r  s        $$K+ $N N [N
 k- k- [k-Z 
 
 [

 O O [OB   [4  ! ! !) ) )Z o^   B o^" " " "L o^^ ^ ^ ^@ 7 7 X7
 o^. . . .` / / X/
 o^V V V Vp 
 
 X
 o^s s s sj 2 2 X2
 o^C C C CJ ( ( X(
 o^8 8 8 8t # # X# 'G G ('G
 '8 8 ('8 'G G ('G '
8 
8 ('
8 '*; ; +* ('; '> > ('>
 'N N ('N W	(JK  
 W	w'(%,  !- !-  !-F W	w'(%,  - - - &D D '&D
 %%6 6 &% &%6
 (, , )(, (H H  )(H
 
 
 
0 W	g&./	ug&67$w'7'GG	

 (
 
 
<6 <6
 
<6B +	
 	
 ,+	
 ++ + ,++ +,%B B &% -, ,+B
 W4)12\   7
 
 87 
: W   7'4 4 (' 87 4, W4)12\   7$> $> 87 $>L W   7%6 %6 87 %6N 0"8 "8  10"8H W4)12\   &
 
 '& 
, W3/  
 &*2- - 32 +* '& - W   &7 7 '& 70 +2D D 32 ,+D 0
 
 10
  W	w'((\   2VD VD 32 VDp W   23 3 32 3. %W4)12\     &% %. . &%. &2 2 '&20 W	w'((\  ? ? ? W4!1!9:EBB/ / CB/ _/ / _/b +   ,+  (9 9  )(9; ; ;5 5 5 50 0 0 0 L L L" 7   87$* * * 7H H  87H& &K K  '&K  2P P  32P" 1H H  21H" W	g.DE>	

 >	
 
(9:$9	

 $8	
 
g.AB+  .* */ .*   W$===W	w%&  . .  >=." (  )(( 5\ \ 65\  1(0 0 )( 210 0 0rB   rH  c                       e Zd ZdZdZej        d             Zej        d             Zd Z	d Z
d Zej        j        d             Zej        j        d	             Zd
S )TableNoColumnsTest)reflect_tables_no_columnsTc                 P    t          d|           |                    |           d S Nr  )r   r   r~   r   r\   s      r@   table_no_columnsz#TableNoColumnsTest.table_no_columnsg
  s,    gx   J'''''rB   c                     t          d|           t          j        |dt          d                     t          j        |dt          d                     |                    |           d S )Nr  r_   z*CREATE VIEW empty_v AS SELECT * FROM emptyr`   zDROP VIEW IF EXISTS empty_v)r   r   rb   r$   r   rl  s      r@   view_no_columnsz"TableNoColumnsTest.view_no_columnsl
  sz    gx   <==	
 	
 	
 	mS)F%G%G	
 	
 	
 	J'''''rB   c                     t          dt                      |          }t          t          |j                  g            d S )Nr  r   r   r   r   r  r   )r~   r   rm  r[  s       r@   test_reflect_table_no_columnsz0TableNoColumnsTest.test_reflect_table_no_columns|
  s8    7HJJjAAADJJrB   c                     t          |          }t          |                    d          g            |                                }t          |dg i           d S )Nr  rk  )r   r   r   r  )r~   r   rm  r   multis        r@   !test_get_columns_table_no_columnsz4TableNoColumnsTest.test_get_columns_table_no_columns
  sY    z""DW%%r***&&((EOR()))))rB   c                     t                      }|                    |           t          |j                                      dg          sJ d S rk  )r   rH  r  r   rf  )r~   r   rm  rI  s       r@   "test_reflect_incl_table_no_columnsz5TableNoColumnsTest.test_reflect_incl_table_no_columns
  sG    JJ			*18}}))7)4444444rB   c                     t          dt                      |          }t          t          |j                  g            d S )Nempty_vr   rq  )r~   r   ro  r[  s       r@   test_reflect_view_no_columnsz/TableNoColumnsTest.test_reflect_view_no_columns
  s8    9hjj
CCCDJJrB   c                     t          |          }t          |                    d          g            |                    t          j                  }t          |dg i           d S )Nry  )r   )Nry  )r   r   r   r  r    rB  )r~   r   ro  r   rt  s        r@    test_get_columns_view_no_columnsz3TableNoColumnsTest.test_get_columns_view_no_columns
  sa    z""DY'',,,&&JO&<<E%r*+++++rB   N)rC   rD   rE   r   r   r   r  rm  ro  rr  ru  rw  rT   r   rz  r|  rG   rB   r@   rh  rh  c
  s        1L $_( ( _( _( ( _(  * * *5 5 5
    , , , , ,rB   rh  c                      e Zd ZdZ ej        ddg          d             Z ej                    d             Zd Zej	        j
        d             Zej	        j         ej        dd	d
d          d                         Zej	        j
         ej        ddd
d          d                         Zej	        j        d             Zej	        j        d             Zej	        j        d             Zej	        j        d             Zd Zej	        j        d             Zej	        j         ej        ej        ej        ej        ej        ej	        j        fej         ej	        j        fd          d                         Z!ej	        j        d             Z" ej        d
dd
ej	        j#        fd
d
dej	        j$        fi d
dej	        j$        fi dd
ej	        j%        fd
d
dej	        j&        fd
dd
ej	        j'        fd          d             Z( ej        e) e*j+        d           d!fe)d d!fe, e*j-                    d"fe) e*j+        d#          d$ej	        j.        fe) e*j+        d%          d&ej	        j.        fe/ e0j1                    d'fe) e*j2        d(           e*j2        d)          z   d$ej	        j.        fd*          ej	        j3        d+                         Z4d
S ),ComponentReflectionTestExtraTF)paramsc                 ,    |j         rt          j        S d S r   )paramr   rV   )r~   requests     r@   use_schema_fixturez/ComponentReflectionTestExtra.use_schema_fixture
  s    = 	%%4rB   c                 >    t           j        fd            }|S )Nc              3   \   K   t                    fV                                 d S r   )r   r   )r   r   r\   r  s    r@   goz:ComponentReflectionTestExtra.inspect_for_table.<locals>.go
  s:      $gj&9&99999
+++++rB   )
contextlibcontextmanager)r~   r\   r   r  r  s    ``` r@   inspect_for_tablez.ComponentReflectionTestExtra.inspect_for_table
  s=    		"	, 	, 	, 	, 	, 	, 
#	"	,
 	rB   c                     d t          fd|D             d           }t          |d           }t          ||           d S )Nc                     d                     t          j        d|                                 t          j                            S )N zand|\d|=|a|b|c|or|<|>)joinr  findallr  I)r  s    r@   	normalizez5ComponentReflectionTestExtra.ck_eq.<locals>.normalize
  s4    88
3W]]__bdKK  rB   c                 D    g | ]}|d           |d                   dS )rm   r  rm   r  rG   )r  itemr  s     r@   r  z6ComponentReflectionTestExtra.ck_eq.<locals>.<listcomp>
  sC        f))DO2L2LMM  rB   c                     | d         S r0  rG   r  s    r@   r   z4ComponentReflectionTestExtra.ck_eq.<locals>.<lambda>
  
    d9o rB   r  c                     | d         S r0  rG   r  s    r@   r   z4ComponentReflectionTestExtra.ck_eq.<locals>.<lambda>
  r  rB   )rD  r   )r~   r  r  r  s      @r@   ck_eqz"ComponentReflectionTestExtra.ck_eq
  s    	 	 	
    %   /.
 
 
	 ..
 
 
 	Ix     rB   c                     |d          5 \  }}t          d|t          dt          j        d                    |           d d d            n# 1 swxY w Y   |                     |                    d|          g            d S )Nrx  rO   rk  rR   )r   r   rp   r   r  r6  )r~   r\   r  rS   r   s        r@   #test_check_constraint_no_constraintz@ComponentReflectionTestExtra.test_check_constraint_no_constraint
  s    /00 	4GVY vry}}--	   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	

++,<V+LL	
 	
 	
 	
 	
s   7AAA	my_inlineMyInlineNconstraint_namer   c                     |d          5 \  }}t          d|t          dt                      d          t          dt                      t          j        d|                    t          dt          d	                    |
           d d d            n# 1 swxY w Y   |                    d|
          }|                     ||pt          j	        ddg           d S )Nsa_ccrL   TrM   r   a > 1 AND a < 5r	  rO   rP   rR   a > 1 and a < 5r  )
r   r   r   rp   r  r   r6  r  r-   r@  r~   r\   r  r  rS   r   r  s          r@   test_check_constraint_inlinez9ComponentReflectionTestExtra.test_check_constraint_inline
  sC    w'' 	+>FItWYYD999II&)    vvbzz**   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  33GF3KK	

 ,7tx0 	
 	
 	
 	
 	
s   A?BBBmy_ck_const	MyCkConstc           
      P    |d          5 \  }}t          d|t          dt                                t          j        d|          |           d d d            n# 1 swxY w Y   |                    d|          }|                     ||pt          j        ddg           d S )Nr  r   za = 1 OR (a > 2 AND a < 5)r	  rR   za = 1 or a > 2 and a < 5r  )	r   r   r   rp   r  r6  r  r-   r@  r  s          r@    test_check_constraint_standalonez=ComponentReflectionTestExtra.test_check_constraint_standalone
  s    w'' 		+>FIsGII&&"0      		 		 		 		 		 		 		 		 		 		 		 		 		 		 		 33GF3KK	

 ,7tx9 	
 	
 	
 	
 	
s   AAA"%A"c                     |d          5 \  }}t          d|t          dt                      d          t          dt                      t          j        d                    t          dt                      t          j        dd	
                    t          dt                                t          dt          d                    t          j        dd
          t          j        dd
          t          j        dd
          |           d d d            n# 1 swxY w Y   |                    d|          }|                     |dddd	ddt          j
        ddg           d S )Nr  rL   TrM   r   r  r  zb > 1 AND b < 5r  r	  r   rO   rP   some_uqzc > 1 AND c < 5cc1	some_c_uqrR   zc > 1 and c < 5r  zb > 1 and b < 5r  )r   r   r   rp   r  r   r  r6  r  r-   r@  )r~   r\   r  rS   r   r  s         r@   test_check_constraint_mixedz8ComponentReflectionTestExtra.test_check_constraint_mixed  s   w'' 	+>FItWYYD999sGIIr'9:K'L'LMMII&'8{KKK 
 sGII&&vvbzz**#F;;;"#45AAA#Ck:::   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	& 33GF3KK	

+<==$1BCC.?@@	
 	
 	
 	
 	
s   DDD#&D#c                     |d          5 \  }}t          d|t          dt          d          t          dt                    t          dt                              }t          d|j        j        |j        j        |j        j                   ddd           n# 1 swxY w Y   |                    d          }t          |d	         d
         g d           dS )ztest for #12894sa_multi_indexColumn1TrM   Column2Column3Index_ExampleNr   r   )r  r  r  )
r   r   r   r%   r   r  r  r  r-  r   )r~   r\   r  rS   r   rK   r  s          r@   test_index_column_orderz4ComponentReflectionTestExtra.test_index_column_order4  s    /00 	4GVY y't<<<y'**y'** J $$$	  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ''(899GAJ~&(I(I(IJJJJJs   BBB!Bc                    t          d|t          dt          d                    t          dt          d                    t          dt          d                              }t          dt	          j        |j        j                  |j        j        t	          j        |j        j	                             dt          dt	          j
        |j        j                             t          d	|j        j                   |                               t                    }d	dgd
i dg}fd} ||d                     G d dt                    } G fddt                    }t          j        j        j        rdg d |d          d |d          gd
d}	 ||	           |                    d|	           dd g |d d          gd
d}
 ||
           |                    |
           t)          |                    d          |           t-                      }t          d|          }njt/          d          5  t)          |                    d          |           t-                      }t          d|          }d d d            n# 1 swxY w Y   |                     ||j        j                   d S )Nr@  xrc  yzt_idxa  long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string long string 
t_idx_longt_idx_2F)rm   r   rd  r  c                     t           j        j        j        rg | d<   j        j         dg i| d<   d S |                     di            d S )Nr  _includer  )r   rT   r  r9   r5  rm   r=  )entryr   s    r@   completeIndexzYComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.completeIndexd  se    ?G 8+-'(!(-777,'(((   !2B77777rB   r   c                       e Zd Zd ZdS )[ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_strc                 B    |                                 }d|v od|v pd|v S )Nr  r  r  r  )r~   r   ols      r@   r  zbComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.lower_index_str.__eq__p  s+    [[]]"}A#)*@sbyArB   Nr  rG   rB   r@   lower_index_strr  o  s(        B B B B BrB   r  c                       e Zd Z fdZdS )^ComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_strc                 8    d|                                 v o|v S )Ncoalescer  )r~   r   long_strs     r@   r  zeComponentReflectionTestExtra.test_reflect_expression_based_indexes.<locals>.coalesce_index_str.__eq__v  s     !U[[]]2Hx57HHrB   Nr  )r  s   r@   coalesce_index_strr  u  s5        I I I I I I IrB   r  )Nr  Nzlower(x)zlower(y))rm   r   r  rd  zcoalesce(x, 'z')r   z>Skipped unsupported reflection of expression-based index t_idx)r   r   r   r%   r   r  r   r  r  r  r  r   r   r  r   rT    reflect_indexes_with_expressionsr9   insertr  r   r-  r   r
   !compare_table_index_with_expectedr5  rm   )r~   r\   r   r@  r   r  r  r  r  
expr_indexexpr_index_longr   r[  r  s     `          @r@   %test_reflect_expression_based_indexeszBComponentReflectionTestExtra.test_reflect_expression_based_indexesH  s   3r

##3r

##3r

##
 
 	gtz!#%((!#%ACE1B1BCCC'lDM!#%::;;;iJ'''z"" "!$#%	 
	8 	8 	8 	8 	8 	hqk"""	B 	B 	B 	B 	Bc 	B 	B 	B	I 	I 	I 	I 	I 	I 	I 	I 	I 	I
 <D #	> 1 1 1#OJ//#OJ// 
  	 	J M*%%%OOAz*** %!%&&'Cx'C'C'CDD    O M/***OOO,,,  %%x000BsBj999BB   > > D$$S))8444ZZ3*===> > > > > > > > > > > > > > > 	..*+0	
 	
 	
 	
 	
s   AJJ!$J!c                    t          d|t          dt          d                    t          dt          d                              }t          d|j        j                  }dg|j        |j        j                 d<   |	                    |           t          |          }|                    d          }t          |ddgdgdt          j        dg           t          |d	         d
         d|j        j        z           dg           t          dt                      |          }t          t!          |j                  d	         j        |j        j                 d         dg           d S )Nr@  r  rc  r  r  includeF)rm   r   r  rd  r  r   r  z
%s_includer   )r   r   r   r%   r   r  r  r5  rm   r   r   r-  r   r-   r@  r   r  r  )r~   r\   r   r@  r   r   r-  r[  s           r@   test_reflect_covering_indexz8ComponentReflectionTestExtra.test_reflect_covering_index  s{   3r

##3r

##	
 
 GQSU##BEJ-23I>J'''z""&&s++ $%(E(+u#'+x 	
 	
 	
 	N,-z055 E		
 	
 	
 3

*===Q/
0A0FG E		
 	
 	
 	
 	
rB   c                     t          d|gd t          |          D             R  }|                    |           d t          |                              d          D             S )Nr@  c                 :    g | ]\  }}t          d |z  |          S )zt%dr   )r  rn  type_s      r@   r  zAComponentReflectionTestExtra._type_round_trip.<locals>.<listcomp>  s*    HHH81efUQY&&HHHrB   c                     g | ]
}|d          S )r  rG   r  s     r@   r  zAComponentReflectionTestExtra._type_round_trip.<locals>.<listcomp>  s    HHHa&	HHHrB   )r   r_  r   r   r   )r~   r   r\   r   r@  s        r@   _type_round_tripz-ComponentReflectionTestExtra._type_round_trip  s{    
 IHy7G7GHHH
 
 

 	
HH7:#6#6#B#B3#G#GHHHHrB   c                     |                      ||t          j        dd                    D ]H}t          |t          j                  sJ t	          |j        d           t	          |j        d           Id S )N   rR  )r  rc  rg  r  r   	precisionscale)r~   r   r\   typs       r@   test_numeric_reflectionz4ComponentReflectionTestExtra.test_numeric_reflection  s    (()"3B":":
 
 	 	C c9#455555r"""	1	 	rB   r  c                    |                      || |d                    d         }t          |t          j                  rt	          |t          j                  sJ nSt          |t          j                  rt	          |t          j                  sJ nt	          |t          j                  sJ t          |j        d           t	          |j        t                    sJ d S )N4   r   )
r  
issubclassrc  rr   r  r  r   r   lengthint)r~   r   r\   r  r  s        r@   test_string_length_reflectionz:ComponentReflectionTestExtra.test_string_length_reflection  s     ##J%%))DDQGeY.// 	5c9#4555555y~.. 	5c9>222222c9#344444CJ#*c*******rB   c           
      "   t          d|t          dt          d          t          dt          d                    }|                    |           t	          d t          |                              d          D             ddd           d S )	Nr@  r   TrS  r  Fc                 ,    i | ]}|d          |d         S )rm   rT  rG   rz  s     r@   r  zIComponentReflectionTestExtra.test_nullable_reflection.<locals>.<dictcomp>   s2        FS_  rB   )r   r  )r   r   r   r   r   r   r   )r~   r   r\   r@  s       r@   test_nullable_reflectionz5ComponentReflectionTestExtra.test_nullable_reflection  s    3$///3%000	
 
 	
 ":..::3??   U##	
 	
 	
 	
 	
rB   CASCADEzSET NULLz	NO ACTIONRESTRICTzexpected,ondelete,onupdatec                 T   i }|r||d<   |r||d<   ||}t          d|t          dt          d          d           t          d|t          dt          d          t          d	t          t          d
d                    t          dt	          d                    d           t          d|t          dt          d          t          dt	          d          d          t          dt                    t          j        dgdgfddi|d           |                    |           t          |          }|	                    d          d         d         t          fdD             i            |	                    d          d         d         t          |           d S )Nondeleteonupdater  rL   TrM   r   rl  x_idzx.idxidr	  test
   userrm   rP   FrS  tidztable.idmyfkr   r6   c                 2    i | ]}|         
||         S rG   rG   )r  r   optss     r@   r  zMComponentReflectionTestExtra.test_get_foreign_key_options.<locals>.<dictcomp>^  s(    111Aa1QQ111rB   )r   r   r   r   r   rp   r   r   r   r*  r   )	r~   r   r\   r  r  r  r6   r   r  s	           @r@   test_get_foreign_key_optionsz9ComponentReflectionTestExtra.test_get_foreign_key_options  s   T  	+"*GJ 	+"*GJH4d333		
 	
 	
 	
 	4d33367JvE$B$B$BCC66"::&&	
 	
 	
 	
 	4d33366"::6665'""#* ,26=  
	
 
	
 
	
 
	
 	J'''z"" $$W--a0;11111112666$$V,,Q/	:D(rB   10z'?10'?z1|truez3 + 5z3\+5z(3 * 5)z3\*5zcurrent_timestamp|now|getdate35zdatatype, default, expected_regc           
      ^   t          d|t          dt          d          t          d||                    }|                    |           t	          |                              d          d         d         }t          j        d	d
|          }t          ||t          j	                   d S )Nr@  rL   TrM   thecol)server_defaultr   r  z	[\(\) \']rM  )flags)
r   r   r   r   r   r   r  r  r   
IGNORECASE)	r~   r\   r   datatyper  expected_regr@  r  reflected_sanitizeds	            r@   test_server_defaultsz1ComponentReflectionTestExtra.test_server_defaultsd  s    : 4d3338Xg>>>	
 
 	
J''33C88;IF	 f\2yAA$l"-HHHHHHrB   )5rC   rD   rE   r   r   r  r  r  r  rT   r:  r  "inline_check_constraint_reflectionr   r  r  r  indexes_check_column_orderr  indexes_with_expressionsr  r  r  r  rc  r  rc  r   rr   r  NVARCHARnvarchar_typesNCHARr  r  1foreign_key_constraint_option_reflection_ondelete1foreign_key_constraint_option_reflection_onupdate1fk_constraint_option_reflection_ondelete_noaction1fk_constraint_option_reflection_onupdate_restrict1fk_constraint_option_reflection_ondelete_restrictr  r   rp   r  r   trueexpression_server_defaultsr   r   nowliteral_columnserver_defaultsr  rG   rB   r@   r~  r~  
  sz        $W_T5M***  +* W_  ! ! !. 1
 
 21
 8WZ0A  
 
  98
@ 1W{D3D  
 
  21
4 8
 
 98
> 0K K 10K& .X
 X
 /.X
t 5(
 (
 65(
TI I I &  '& &W		W-<=	'*9:  
+ 
+  '&
+ &
 
 '&
  WN		
 N		
 N		
 N		
 N		
 N		
 .K& & &N3 3O& &N3l W	'"'$--+	$	"	'"'))Y'BGG7		
 BGI7		
 
848::?@Bc""%6R%6s%;%;;7		
 3/  2 %I I &%3 4I I IrB   r~  c                   8    e Zd ZdZdZed             Zd Zd ZdS )NormalizedNameTest)denormalized_namesTc                    t          t          dd          |t          dt          d                     t          t          dd          |t          dt          d          t          dt	          d                               d S )	Nr   Tr  rL   rM   r[  t1idzt1.id)r   r&   r   r   r   r[   s     r@   r]   z NormalizedNameTest.define_tables  s    D)))4d333	
 	
 	

 	D)))4d3336:g..//		
 	
 	
 	
 	
rB   c                    t                      }t          t          dd          |t          j                  }|j        d         }|j        j                            |j        j	                  sJ t                      }|
                    t          j        d            |j        d         j        j                            |j        d         j        j	                  sJ d S )Nr[  Tr  r   r   c                 .    |                                  dv S )Nr   r[  r  )rm   rI  s     r@   r   zINormalizedNameTest.test_reflect_lowercase_forced_tables.<locals>.<lambda>  s    DJJLLL,H rB   )only)r   r   r&   r   r>   r   r   r  r   rL   rH  )r~   r   t2_reft1_refm3s        r@   $test_reflect_lowercase_forced_tablesz7NormalizedNameTest.test_reflect_lowercase_forced_tables  s    ZZD)))2VY
 
 
 4x}''44444ZZ


IHH 	 	
 	
 	
 y %0041B1EFFFFFFFrB   c                 p   d t          t          j                                                  D             }t	          |d                                         |d                                                    t	          |d                                         |d                                                    d S )Nc                 >    g | ]}|                                 d v |S )r  r  )r  r@  s     r@   r  z;NormalizedNameTest.test_get_table_names.<locals>.<listcomp>  s5     
 
 
wwyyL(( (((rB   r   r   )r   r   r>   rC  r   upperr  )r~   
tablenamess     r@   rF  z'NormalizedNameTest.test_get_table_names  s    
 
VY''7799
 
 

 	JqM!!:a=#6#6#8#8999JqM!!:a=#6#6#8#899999rB   N)	rC   rD   rE   r   r   rF   r]   r   rF  rG   rB   r@   r  r    sY        *L $
 
 [
G G G: : : : :rB   r  c                   P    e Zd Zd Zd Zd Zd Zej        j	        d             Z
dS )ComputedReflectionTestc                 $   t          t          j                  }|                    d          }d |D             }t	          d|d         d         v            t          |d         d         d            t          |d         d         d            d S )Ncomputed_default_tablec                      i | ]}|d          |S r	  rG   r  s     r@   r  zLComputedReflectionTest.test_computed_col_default_not_set.<locals>.<dictcomp>  s    ///QAfIq///rB   42with_defaultr  normalcomputed_col)r   r   r>   r   r,   r   )r~   r   r  col_datas       r@   !test_computed_col_default_not_setz8ComputedReflectionTest.test_computed_col_default_not_set  s    vy!! 899//$///0;;<<<HXy)4000H^$Y/66666rB   c                 X   t          t          j                  }|                    d          }d |D             }dD ]}t	          d||         v           |d         }t	          d|v            t	          d|d         v            t          |                     |d         d                   d           t          d|d         v t          j        j	        j
                   t          j        j	        j
        r2t          |d         d         t          j        j        j
                   d S d S )	Nr(  c                      i | ]}|d          |S r	  rG   r  s     r@   r  zKComputedReflectionTest.test_get_column_returns_computed.<locals>.<dictcomp>      +++&	1+++rB   )rL   r,  r+  computedr-  r  	normal+42	persisted)r   r   r>   r   r,   r   r  r   rT   "computed_columns_reflect_persistedr9   "computed_columns_default_persisted)r~   r   r  rO   r   compDatas         r@    test_get_column_returns_computedz7ComputedReflectionTest.test_get_column_returns_computed  s9   vy!! 899++d+++3 	1 	1CJd3i/0000'
h&'''	Xj11222DNN8J/	:;;[III8J//?G	
 	
 	
 >F 	$[1 CK    	 	rB   c                     t          d||         v            ||         d         }t          |                     |d                   |           t          j        j        j        r)t          d|v            t          |d         |           d S d S )Nr3  r  r5  )r,   r   r  r   rT   r6  r9   r   )r~   rO   columnr  r5  r8  s         r@   check_columnz#ComputedReflectionTest.check_column  s    
d6l*+++<
+DNN8I.//999>F 	2K8+,,,%y11111	2 	2rB   c                    t          t          j                  }|                    d          }d |D             }|                     |ddt
          j        j        j                   t
          j        j	        j        r|                     |ddd           t
          j        j
        j        r|                     |dd	d
           d S d S )Ncomputed_column_tablec                      i | ]}|d          |S r	  rG   r  s     r@   r  zLComputedReflectionTest.test_get_column_returns_persisted.<locals>.<dictcomp>  r2  rB   computed_no_flagr4  computed_virtualznormal+2Fcomputed_storedz	normal-42T)r   r   r>   r   r<  r   rT   r7  r9   computed_columns_virtualcomputed_columns_storedr~   r   r  rO   s       r@   !test_get_column_returns_persistedz8ComputedReflectionTest.test_get_column_returns_persisted  s    vy!! 788++d+++?G		
 	
 	
 4< 	"	   3; 	!	    	 	rB   c                    t          t          j                  }|                    dt          j                  }d |D             }|                     |ddt          j        j        j	                   t          j        j
        j	        r|                     |ddd           t          j        j        j	        r|                     |d	d
d           d S d S )Nr>  rR   c                      i | ]}|d          |S r	  rG   r  s     r@   r  zXComputedReflectionTest.test_get_column_returns_persisted_with_schema.<locals>.<dictcomp>  r2  rB   r@  z	normal/42rA  znormal/2FrB  z	normal*42T)r   r   r>   r   rV   r<  r   rT   r7  r9   rC  rD  rE  s       r@   -test_get_column_returns_persisted_with_schemazDComputedReflectionTest.test_get_column_returns_persisted_with_schema  s    vy!!#F,>   
 
 ,+d+++?G		
 	
 	
 4< 	"	   3; 	!	    	 	rB   N)rC   rD   rE   r/  r9  r<  rF  r   rT   rU   rI  rG   rB   r@   r&  r&    sr        7 7 7  *2 2 2  6     rB   r&  c                   j    e Zd ZdxZZdZdZed             Zd Z	d Z
ej        j        d             ZdS )IdentityReflectionTestNT)r   rc  c                    t          d|t          dt                    t          dt          t                                           t          d|t          dt          t          dddd	d
dd                               t          j        j        j        rVt          d|t          dt                    t          dt          t          dd                    t          j	                   d S d S )Nr   r,  id1r[  r   Tr   r   ru     alwaysr   	incrementminvaluemaxvaluecyclecacherk  )rQ  r   rR   )
r   r   r   r   r   rT   rU   r9   r   rV   r[   s     r@   r]   z$IdentityReflectionTest.define_tables   s   8W%%5'8::..		
 	
 	
 	   	
 	
 	
" #+ 	x))ugxt2'F'F'FGG)     	 	rB   c                 T   t           j        j        j        rd}t	          |          D ]}||vr|                    |           |rt          t          |          t          |                     |D ]i}|dk    r t          ||         ||         k               (|dv r t          ||         ||         k               Lt          ||         ||         |           jd S t          ||           d S t          |d         |d                    t          |d         |d                    d S )NrP  rS  >   rV  rT  r   rR  )	r   rT   identity_columns_standardr9   r  r  r   r^  r,   )r~   rR  rY  approxcommon_keysr   s         r@   checkzIdentityReflectionTest.checkB  sB   5= 	6K %[[ ! !K''IIaLLL 
 CJJC))) 1 1AJaCF 23333333aCF 23333E!Hc!fa00001 1 E3gG---k"C$455555rB   c                    t          t          j                  }|                    d          |                    d          z   }|D ]}|d         dk    rt	          d|v            !|d         dk    rsd|v rt          |d                    t          |d         d            t          d|v            |                     |d         t          d	d
d
d
dd	d
          d           |d         dk    rrd|v rt          |d                    t          |d         d            t          d|v            |                     |d         t          ddddddd          d	            d S )Nr   r[  rm   r,  r   rM  r  r  Fr   rP  TrY  r   r   r   rN  ru  rO  )	r   r   r>   r   r*   r,   r   r[  r<   r~   r   r  r   s       r@   r   z,IdentityReflectionTest.test_reflect_identity_  s   vy!!%%(8(8(>(>> &	 &	C6{h&&s*++++V%%"c))C0111C	ND)))
c)***


O$"#!"!+#          V%%"c))C0111C	ND)))
c)***


O#"#!#!#"   !    5&	 &	rB   c                    t          t          j                  }|                    dt          j                  }|D ]}|d         dk    rt          d|v             |d         dk    rrd|v rt          |d                    t          |d         d            t          d|v            |                     |d         t          d	d
ddddd          d	           d S )Nr   rR   rm   r,  r   rM  r  r  Trk  r   r]  FrP  r^  )
r   r   r>   r   rV   r*   r,   r   r[  r<   r_  s       r@   test_reflect_identity_schemaz3IdentityReflectionTest.test_reflect_identity_schema  s   vy!!V-?@@ 	 	C6{h&&s*++++V%%"c))C0111C	ND)))
c)***


O# "#!"!+#        	 	rB   )rC   rD   rE   r]  r   r   r   rF   r]   r[  r   r   rT   rU   ra  rG   rB   r@   rK  rK    s         $$K+ $;L  [B6 6 6:* * *X     rB   rK  c                   |    e Zd ZdZed             Zej        j        d             Z	ej        j
        d             ZdS )CompositeKeyReflectionTestTc                 B   t          d|t          dt                    t          dt                    t          dt          j        d                    t          j        dddd          d d	          }t          d
|t          dt          d          t          dt                    t          dt                    t          dt          j        d                    t          j        g d|j        j	        |j        j
        |j        j        gd          d d		  	         d S )Ntb1rL   attrrm   rk  pk_tb1r	  Tr\  tb2rM   pidpattrpnamerk  ri  rj  fk_tb1_name_id_attr)r   r   r   rc  rr   rp   r  r   r   rm   rL   rf  )r?   r\   re  s      r@   r]   z(CompositeKeyReflectionTest.define_tables  s   4!!67##69,R0011#FD&xHHH	
 	
 	
 	4d3335'""7G$$7I-b1122#)))SUXsuz2*  
 	
 	
 	
 	
 	
 	
rB   c                     t          |          }|                    | j        j        j                  }t          |                    d          g d           d S )Nr  rm   rL   rf  )r   r'  r   re  rm   r   r  )r~   r   r   rN   s       r@   test_pk_column_orderz/CompositeKeyReflectionTest.test_pk_column_order  sU     z"",,T[_-ABBKOO1224J4J4JKKKKKrB   c                 J   t          |          }|                    | j        j        j                  }t          t          |          d           |d         }t          |                    d          g d           t          |                    d          g d           d S )Nr   r   r  ro  r  rl  )r   r*  r   rh  rm   r   r^  r  )r~   r   r   foreign_keysr  s        r@   test_fk_column_orderz/CompositeKeyReflectionTest.test_fk_column_order  s     z"",,T[_-ABBCq!!!QEII())+A+A+ABBBEII+,,.G.G.GHHHHHrB   N)rC   rD   rE   r   rF   r]   r   rT   ra  rp  r   rs  rG   rB   r@   rc  rc    s         $
 
 [
6 7L L 87L 7I I 87I I IrB   rc  )rH  r~  rh  r  r   rI   r   r  r&  rK  rc  r   )Ir  r  r  r:   rp   rM  r   r   r   r   r   r	   r
   r   r   	provisionr   r   rS   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rc  r5  r   r    r!   excr"   r#   r$   r%   sql.elementsr&   
sql.schemar'   r(   r)   r*   r+   r,   r-   r\   rO  
TablesTestr0   rI   r   TestBaser   r   r  rF  rH  rh  r~  r  ComputedReflectionFixtureTestr&  rK  rc  __all__rG   rB   r@   <module>r|     s        				                                   $ $ $ $ $ $                   + + + + + + / / / / / /                                                                               " " " " " "                   ! ! ! ! ! ! # # # # # # * * * * * *             ' ' ' ' ' ' & & & & & & & & & & & & % % % % % %                         %    h1    U: U: U: U: U:* U: U: U:pJ
 J
 J
 J
 J
8& J
 J
 J
ZdG dG dG dG dG8, dG dG dGN#G #G #G #G #GH- #G #G #GLT0 T0 T0 T0 T0X0 T0 T0 T0n1 1 1<n0 n0 n0 n0 n0n.E n0 n0 n0b?2, 2, 2, 2, 2,* 2, 2, 2,jsI sI sI sI sI?H4E sI sI sIl(: (: (: (: (:, (: (: (:V^ ^ ^ ^ ^XC ^ ^ ^BJ J J J JX0 J J JZ.I .I .I .I .I!4 .I .I .IbrB   