
    5hB                     P   S SK r S SKrSSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSK	Jr  S	S
KJr  S	SKJr  S	SKJr  S	SKJr  S	SKJr  S	SKJr  S	SKJr  S	SKJr   " S S\R(                  5      r " S S\R(                  5      r " S S\R.                  \R0                  5      rg)    N   )engines)fixtures)eq_)requirements)Column)Table   )DateTime)func)Integer)select)sql)String)testingtextc                   z    \ rS rSrSr\S 5       r\S 5       rS rS r	S r
S r\R                  S	 5       rS
 rSrg)RowFetchTest   Tc                     [        SU[        S[        SS9[        S[        S5      5      5        [        SU[        S[        SS9[        S[        5      5        g )	Nplain_pkidT)primary_keydata2   	has_datestoday)r	   r   r   r   r   clsmetadatas     p/var/www/html/cementerio_25MayoBackend/env/lib/python3.13/site-packages/sqlalchemy/testing/suite/test_results.pydefine_tablesRowFetchTest.define_tables   sP    4d366":&		
 	4d37H%		
    c                 &   UR                  U R                  R                  R                  5       SSS.SSS.SSS./5        UR                  U R                  R                  R                  5       S[
        R
                  " SS	S
S
SS5      S./5        g )N   d1)r   r   r   d2r
   d3        r   )r   r   )executetablesr   insertr   datetime)r    
connections     r"   insert_dataRowFetchTest.insert_data.   s    JJ&&($'$'$'	
 	JJ  '') 1 1$2r1a HIJ	
r%   c                 L   UR                  U R                  R                  R                  5       R	                  U R                  R                  R
                  R                  5      5      R                  5       n[        UR                  S5        [        UR                  S5        g Nr'   r(   )
r.   r/   r   r   order_bycr   firstr   r   selfr2   rows      r"   test_via_attrRowFetchTest.test_via_attr>   sp      KK  '')224;;3G3G3I3I3L3LM

%' 	 	CFFACHHdr%   c                 X   UR                  U R                  R                  R                  5       R	                  U R                  R                  R
                  R                  5      5      R                  5       n[        UR                  S   S5        [        UR                  S   S5        g )Nr   r'   r   r(   )
r.   r/   r   r   r7   r8   r   r9   r   _mappingr:   s      r"   test_via_stringRowFetchTest.test_via_stringF   s{      KK  '')224;;3G3G3I3I3L3LM

%' 	 	CLL"CLL $'r%   c                 0   UR                  U R                  R                  R                  5       R	                  U R                  R                  R
                  R                  5      5      R                  5       n[        US   S5        [        US   S5        g )Nr   r'   r(   )	r.   r/   r   r   r7   r8   r   r9   r   r:   s      r"   test_via_intRowFetchTest.test_via_intN   sp      KK  '')224;;3G3G3I3I3L3LM

%' 	 	CFACFDr%   c                    UR                  U R                  R                  R                  5       R	                  U R                  R                  R
                  R                  5      5      R                  5       n[        UR                  U R                  R                  R
                  R                     S5        [        UR                  U R                  R                  R
                  R                     S5        g r6   )r.   r/   r   r   r7   r8   r   r9   r   r@   r   r:   s      r"   test_via_col_object RowFetchTest.test_via_col_objectV   s      KK  '')224;;3G3G3I3I3L3LM

%' 	 	CLL--//223Q7CLL--//445t<r%   c                    UR                  [        U R                  R                  R                  R
                  U R                  R                  R                  R
                  R                  S5      5      R                  U R                  R                  R                  R                  5      5      nUR                  5       n[        UR                  5       SS/5        [        US5        g )Nr   )r(   r(   )r.   r   r/   r   r8   r   labelr7   r   r9   r   keys)r;   r2   resultr<   s       r"   test_row_with_dupe_names%RowFetchTest.test_row_with_dupe_names^   s    ##$$&&++$$&&++11&9 ht{{++--001	
 llnFKKMFF+,Cr%   c                    U R                   R                  n[        UR                  S5      R                  R
                  5      R                  5       n[        UR                  R                  UR                  S5      5      nUR                  U5      R                  5       n[        UR                  [        R                  " SSSSSS5      5        g)ztest that a scalar select as a column is returned as such
and that type conversion works OK.

(this is half a SQLAlchemy Core test and half to catch database
backends that may have unusual behavior with scalar selects.)

x	somelabelr+   r,   r-   r   N)r/   r   r   aliasr8   r   scalar_subqueryr   rJ   r.   r9   r   rQ   r1   )r;   r2   	datetabless2r<   s         r"   test_row_w_scalar_select%RowFetchTest.test_row_w_scalar_selectj   s     KK))	9??3'))//0@@BIKKNNAGGK$89  $**,CMM8,,T1b"aCDr%    N)__name__
__module____qualname____firstlineno____backend__classmethodr#   r3   r=   rA   rD   rG   r   %duplicate_names_in_cursor_descriptionrM   rW   __static_attributes__rY   r%   r"   r   r      sa    K
 
 
 
(= 77	 8	Er%   r   c                   f    \ rS rSrSrSrSr\S 5       rS r	S r
\R                  S 5       rS	 rS
rg)PercentSchemaNamesTestz   ztests using percent signs, spaces in table and column names.

This didn't work for PostgreSQL / MySQL drivers for a long time
but is now supported.

)percent_schema_namesTc           	         [        SU[        S[        5      [        S[        5      5      U R                  l        [
        R                  " S[
        R                  " S5      [
        R                  " S5      5      U R                  l        g )Nzpercent%tablepercent%spaces % more spaces)	r	   r   r   r/   percent_tabler   tablecolumnlightweight_percent_tabler   s     r"   r#   $PercentSchemaNamesTest.define_tables   sa    #(:w')73	$


  03yyJJz"JJ-.0


,r%   c                     U R                   R                  nSSS.SSS.SSS.SSS.4 H#  nUR                  UR                  5       U5        M%     U R	                  U5        g Nr,   r-   rg   rh         	   
   r/   ri   r.   r0   _assert_table)r;   r2   ri   paramss       r"   test_single_roundtrip,PercentSchemaNamesTest.test_single_roundtrip   sh    11B7B7B7Q7	
F }335v>
 	:&r%   c                     U R                   R                  nUR                  UR                  5       SSS.5        UR                  UR                  5       SSS.SSS.SSS./5        U R	                  U5        g ro   ru   )r;   r2   ri   s      r"   test_executemany_roundtrip1PercentSchemaNamesTest.test_executemany_roundtrip   s{    11  "B$O	
 	  ";;;	
 	:&r%   c                 |   U R                   R                  nUR                  UR                  5       SSS.5        UR                  UR                  5       R	                  UR
                  S   UR
                  S   5      SSS.SS	S.SSS./5      n[        UR                  5       / S
Q5        U R                  U5        g )Nr,   r-   rp   rg   rh   rq   rr   rs   rt   )rq   rr   rs   rt   rr   rs   )	r/   ri   r.   r0   	returningr8   r   allrv   )r;   r2   ri   rL   s       r"   $test_executemany_returning_roundtrip;PercentSchemaNamesTest.test_executemany_returning_roundtrip   s    11  "B$O	
 ##  ",,
+ 67
 ;;;

 	FJJL56:&r%   c                    U R                   R                  nU R                   R                  nUUR                  5       UUR                  5       4 GH  n[	        [        UR                  UR                  5       R                  UR                  S   5      5      5      / SQ5        [	        [        UR                  UR                  5       R                  UR                  S   R                  SS/5      5      R                  UR                  S   5      5      5      SS/5        UR                  UR                  5       R                  UR                  S   5      5      R                  5       n[	        UR                  S   S5        [	        UR                  S   S	5        [	        UR                  UR                  S      S5        [	        UR                  UR                  S      S	5        GM     UR                  UR                  5       R                  UR                  S   S
05      5        [	        [        UR                  UR                  5       R                  UR                  S   5      5      5      / SQ5        g )Nrg   ))r,   r-   r~   r   r   rh   rs   rt   r   r   r,   r-      ))r,   r   )rq   r   )rs   r   )rr   r   )r/   ri   rl   rR   r   listr.   r   r7   r8   wherein_r9   r@   updatevalues)r;   connri   rl   rj   r<   s         r"   rv   $PercentSchemaNamesTest._assert_table   s   11$(KK$I$I! !%%++-	
E LL!8!89L!MN 5	 LLuww'=>BBAr7KL!%''*"56 '"	 ,,''
(;<eg  Z(!,34b9UWWZ0115UWW%;<=rB?
B 	  "))!78"=	
 	!((*33%
3 2		
r%   rY   N)rZ   r[   r\   r]   __doc____requires__r^   r_   r#   rx   r{   r   insert_executemany_returningr   rv   ra   rY   r%   r"   rc   rc   z   sN     -LK
 
	'' ..' /'&4
r%   rc   c                      \ rS rSrSrSrS rS rS r\	R                  " SSS S4S	SS
 S4SS\" S5      S4SSS S4SS\" S5      R                  SS9S4SS\" S5      R                  SS9S4SS\" S5      R                  5       S4SSS S\	R                  " SS/5      4SSS S4SSS S4SSS9S 5       rS  rS! rS" rS# rS$ rS%rg&)'ServerSideCursorsTest   )server_side_cursorsTc                    U R                   R                  R                  S:X  a  [        UR                  5      $ U R                   R                  R                  S:X  a*  [        S5      R                  R                  n[        X5      $ U R                   R                  R                  S;   a  UR                  $ U R                   R                  R                  S:X  a*  [        S5      R                  R                  n[        X5      $ U R                   R                  R                  S:X  a  UR                  (       + $ U R                   R                  R                  S;   a  UR                  $ U R                   R                  R                  S	:X  a  [        US
S5      $ U R                   R                  R                  S:X  a  [        [        USS5      5      $ U R                   R                  R                  S:X  a  [        US
S5      $ g)Npsycopg2pymysqlzpymysql.cursors)aiomysqlasyncmyaioodbcmysqldbzMySQLdb.cursorsmariadbconnector)asyncpg	aiosqlitepg8000server_sideFpsycopgnameoracledb)enginedialectdriverboolr   
__import__cursorsSSCursor
isinstancer   bufferedgetattr)r;   cursorsscursors      r"   _is_server_side%ServerSideCursorsTest._is_server_side   s    ;;%%3$$[[  ''94!"34<<EEHf//[[  ''+MM%%%[[  ''94!"34<<EEHf//[[  ''+==&&[[  ''+CC%%%[[  ''836=%88[[  ''94677[[  '':56=%88r%   c                 "   U(       aF  [         R                  " S5         [        R                  " SU0S9U l        S S S 5        U R                  $ [        R                  " SU0S9U l        U R                  $ ! , (       d  f       U R                  $ = f)NzThe create_engine.server_side_cursors parameter is deprecated and will be removed in a future release.  Please use the Connection.execution_options.stream_results parameter.r   )options)r   expect_deprecatedr   testing_enginer   )r;   r   s     r"   _fixtureServerSideCursorsTest._fixture  s    ** &4424GH {{ "00.0CDDK {{  {{s   A55
Bc                 n    [         R                  " S[         R                  5      R                  S U5      $ )NzSELECT (\d+)c           	          [        [        [        U R                  S5      5      5      R	                  [
        R                  5      5      $ )Nr'   )strr   intgroupcompiler   db)ms    r"   <lambda>1ServerSideCursorsTest.stringify.<locals>.<lambda>-  s)    c&QWWQZ199'**EFr%   )rer   Isub)r;   str_s     r"   	stringifyServerSideCursorsTest.stringify+  s)    zz/244044F
 	
r%   global_stringc                     U " S5      $ Nselect 1rY   r   s    r"   r   ServerSideCursorsTest.<lambda>1  s	    )J2Gr%   global_textc                 $    [        U " S5      5      $ r   r   r   s    r"   r   r   5      d9Z#89r%   global_exprr'   global_off_explicitFc                 $    [        U " S5      5      $ r   r   r   s    r"   r   r   <  r   r%   stmt_optionstream_resultsstmt_option_disabledfor_update_exprfor_update_stringc                     U " S5      $ )NzSELECT 1 FOR UPDATErY   r   s    r"   r   r   P  s
    i(=>r%   sqlitemssql
text_no_ssc                 $    [        U " S5      5      $ )N	select 42r   r   s    r"   r   r   W  s    d9[#9:r%   text_ss_optionc                 >    [        U " S5      5      R                  SS9$ )Nr   Tr   )r   execution_optionsr   s    r"   r   r   ]  s"    d9[#9:LL# M r%   iaaaz*engine_ss_arg, statement, cursor_ss_status)id_argnamesc                    U R                  U5      nUR                  5        n[        U5      (       a  [        R                  " X R
                  S9n[        U[        5      (       a  UR                  U5      nOUR                  U5      n[        U R                  UR                  5      U5        UR                  5         S S S 5        g ! , (       d  f       g = f)Nr   )r   begincallabler   resolve_lambdar   r   r   exec_driver_sqlr.   r   r   r   close)r;   engine_ss_arg	statementcursor_ss_statusr   r   rL   s          r"   test_ss_cursor_status+ServerSideCursorsTest.test_ss_cursor_status0  s    p }-\\^t	""#22	 )S))--i8i0$$V]]35EFLLN ^^s   BC
Cc                 8   U R                  S5      nUR                  5        nUR                  SS9R                  U R	                  S5      5      nU R                  UR                  5      (       d   eUR                  5         S S S 5        g ! , (       d  f       g = f)NFTr   r   )r   connectr   r   r   r   r   r   )r;   r   r   rL   s       r"   test_conn_option&ServerSideCursorsTest.test_conn_optionv  s~    u%^^++# , odnnZ89  ''6666 LLN' s   A B
Bc                 ,   U R                  S5      n[        S5      R                  SS9nUR                  5        nUR                  SS9R	                  U5      nU R                  UR                  5      (       a   e S S S 5        g ! , (       d  f       g = f)NFr'   Tr   )r   r   r   r   r.   r   r   )r;   r   rU   r   rL   s        r"   &test_stmt_enabled_conn_option_disabled<ServerSideCursorsTest.test_stmt_enabled_conn_option_disabled  s{    u%1I''t'<^^++5+AII!LF++FMM::::: s   AB
Bc                    U R                  S5      n[        [        R                  " S5      R	                  S5      5      R                  SS9R                  5       nUR                  5        nUR                  UR                  5       5      nU R                  UR                  5      (       a   eUR                  5         S S S 5        [        S5      R                  U5      nUR                  5        nUR                  U5      nU R                  UR                  5      (       a   eUR                  5         S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)NF1rP   Tr   r'   )r   r   r   literal_columnrJ   r   subqueryr   r.   r   r   r   select_from)r;   r   s1r   rL   rV   s         r"   test_aliases_and_ss)ServerSideCursorsTest.test_aliases_and_ss  s    u%3%%c*0056d3XZ 	 \\^t\\"))+.F++FMM::::LLN 
 AY""2&\\^t\\"%F++FMM::::LLN ^ ^ ^s   +AD</AE<
E

Ec                    U R                   nU R                  S5      n[        SU[        S[        SSS9[        S[        S5      5      5      nUR                  5        nUR                  USS9  UR                  UR                  5       [        SS	95        UR                  UR                  5       [        S
S	95        [        UR                  UR                  5       R                  UR                  R                  5      5      R!                  5       SS/5        UR                  UR#                  5       R%                  UR                  R                  S:H  5      R'                  UR                  R(                  S-   S	95        [        UR                  UR                  5       R                  UR                  R                  5      5      R!                  5       SS/5        UR                  UR+                  5       5        [        UR-                  [        [.        R0                  " S5      5      R3                  U5      5      S5        S S S 5        g ! , (       d  f       g = f)NT
test_tabler   r   test_needs_autoincrementr   r   
checkfirstdata1r   data2)r'   r  )r   r  r   z updated)r   zdata2 updated*r   )r!   r   r	   r   r   r   r   creater.   r0   dictr   r   r7   r8   r   fetchallr   r   r   r   deletescalarr   countr   )r;   r!   mdr   r  r2   s         r"   test_roundtrip_fetchall-ServerSideCursorsTest.test_roundtrip_fetchall  s   ]]t$g4$ 66":&

 \\^zjT:z002Dg4FGz002Dg4FG""%%'00A(*|,	 !!#z||!+,Z\\..;<
 ""%%'00A(*34	 z0023!!4::c?+77
C 	- ^^s   G&I
Ic                    U R                   nU R                  S5      n[        SU[        S[        SSS9[        S[        S5      5      5      nUR                  5        nUR                  USS9  UR                  UR                  5       [        SS	5       Vs/ sH  n[        S
U-  S9PM     sn5        UR                  UR                  5       R                  UR                  R                  5      5      n[!        UR#                  S5      [        SS5       Vs/ sH	  ofS
U-  4PM     sn5        [!        UR#                  S5      [        SS5       Vs/ sH	  ofS
U-  4PM     sn5        [!        UR%                  5       [        SS	5       Vs/ sH	  ofS
U-  4PM     sn5        S S S 5        g s  snf s  snf s  snf s  snf ! , (       d  f       g = f)NTr  r   r  r   r   r  r'      zdata%dr  r,      rt      )r!   r   r	   r   r   r   r   r
  r.   r0   ranger  r   r7   r8   r   r   	fetchmanyr  )r;   r!   r  r   r  r2   irL   s           r"   test_roundtrip_fetchmany.ServerSideCursorsTest.test_roundtrip_fetchmany  s   ]]t$g4$ 66":&

 \\^zjT:!!#272,?,Q8a<(,?
  ''!!#,,Z\\__=F   #,1!QK8KqX\"K8   $,1!RL9LqX\"L9 !uR}#M}!1$5}#MN' ^ @ 9 :#M' ^sC   9F;F'+A,F;F,&*F;F1)F;F6F;'F;;
G	)r   N)rZ   r[   r\   r]   r   r^   r   r   r   r   combinationsr   r   with_for_updateskip_ifr   r   r   r   r  r  ra   rY   r%   r"   r   r      sW    ,LK4"

 	$ GN9		
 
fQi.!9		
 1I''t'<		
 #1I''u'=		
 
D&)";";"=tD  >OOXw/0	
 :		
  	
 =g4jk4j"0;((T Or%   r   )r1   r    r   r   
assertionsr   configr   schemar   r	   r   r   r   r   r   r   r   r   
TablesTestr   rc   TestBaseAssertsExecutionResultsr   rY   r%   r"   <module>r&     s     	    !          [E8&& [E||
X00 |
~}Ow66}Or%   