id% ddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZGddejZGddejZGddejZdZdS))config)engines)fixtures)eq_) requirements)Column)Table)Integer)literal)literal_column)select)StringcjeZdZdZdZdZddiZedZdZ dZ d Z e j d Zd S) LastrowidTesteachT)implements_get_lastrowidautoincrement_insertimplicit_returningFc td|tdtddtdtdtd|tdtdd tdtddS) N autoinc_pkidT primary_keytest_needs_autoincrementdata2 manual_pkFr autoincrementr rr rclsmetadatas Y/opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/testing/suite/test_insert.py define_tableszLastrowidTest.define_tabless   g4$    66":: & &        4d% H H H 66":: & &      c||}t|tjjjdfdSN some dataexecuterfirstrrdbdialectdefault_sequence_baseselftableconnrows r%_assert_round_tripz LastrowidTest._assert_round_trip*Jll5<<>>**0022 C&)#9;GHHHHHr'ctj|jjd||jjtjdSNr*rrr.r,tablesrinsertr6r2s r%test_autoincrement_on_insertz*LastrowidTest.test_autoincrement_on_insert.Q $+07799 LLL  6 BBBBBr'c.tj|jjd}tjt|jjjj g}t|j |gdSr9 rr.r,r<rr=scalarrcrrinserted_primary_keyr2rpks r%test_last_inserted_idz#LastrowidTest.test_last_inserted_id3| I   K " ) ) + ++   Y  fdk&<&>&A%BCC D D A "RD)))))r'c0tj|jjd}|j}tjt|jjj j g}t||dSr9) rr.r,r<rr= lastrowidrCrrDrr)r2rGrLrHs r%test_native_lastrowid_autoincz+LastrowidTest.test_native_lastrowid_autoinc?s~ I   K " ) ) + ++   K Y  fdk&<&>&A%BCC D D Irr'N)__name__ __module__ __qualname__ run_deletes __backend__ __requires____engine_options__ classmethodr&r6r?rIrdbapi_lastrowidrMr'r%rrsKKEL.6  [ "IIICCC ***!"!r'rceZdZdZdZedZdZej dZ ej dZ ej dZej dZej d Zej d Zd S) InsertBehaviorTestrTc8td|tdtddtdtdtd|tdtdd tdtdtd |tdtddtdtdtd td tdtt dtt dz dS)NrrTrrrrFrincludes_defaultsx)defaulty2)type_r)r rr rr r r"s r%r&z InsertBehaviorTest.define_tablesMs$   g4$    66":: & &        4d% H H H 66":: & &       g4$    66":: & & 3 + + + &s':::WQZZG    r'c0tjjrtjddi}n t j}|5}||j j d}ddddS#1swxYwYdS)NrF)optionsr*r:) r returningenabledrtesting_enginerr.beginr,r<rr=)r2enginer4rGs r%test_autoclose_on_insertz+InsertBehaviorTest.test_autoclose_on_insertls  ! ) +-u5FFYF \\^^ Pt T[3::<<; OOA P P P P P P P P P P P P P P P P P Ps 4B  BBctj|jjd}dSr9)rr.r,r<rr=r2rGs r%+test_autoclose_on_insert_implicit_returningz>InsertBehaviorTest.test_autoclose_on_insert_implicit_returning{s8 I   K " ) ) + ++   r'cHtj|jj}tj|jj|jjjj dk}dS)N) rr.r,r<rr=rwhererDrrks r%test_empty_insertz$InsertBehaviorTest.test_empty_inserts| I  dk4;;== > > I   K " ) ) + + 1 1 &(+t3    r'c 4|jj}|jj}tj|tddtddtddgtj|dt|j j g |j j ddg}t|jdgtjt|j j g|j j }t|d d gdS) Ndata1rrrdata2r data3r:rtru)r<rrrr.r,r=dict from_selectrrDrrnin_rrEorder_byfetchallr2 src_table dest_tableresults r%test_insert_from_select_autoincz2InsertBehaviorTest.test_insert_from_select_autoincshK) [+       (((((((((    ""      + + ()**00K$(('7);<<     F '$000"" JL%& ' ' 0 01B C C   FOO   J788888r'c l|jj}|jj}tj|dt|j j g |j j ddg}t|jdgtjt|j j g|j j }t|gdS)Nr:rtru)r<rrrr.r,r=ryrrDrrnrzrrEr{r|r}s r%'test_insert_from_select_autoinc_no_rowsz:InsertBehaviorTest.test_insert_from_select_autoinc_no_rowssK) [+ ""      + + ()**00K$(('7);<<     F '$000"" JL%& ' ' 0 01B C C   FOO  r"""""r'c  |jj}tj|t ddt ddt ddgtj|d dt|j j d z|j j g |j j ddgttjt|j j g|j j gd dS) Nrqrrrsrrtr ruTinliner]))rrrvrvrwrw)r<rrr.r,r=rxryrrDrrrnrzrr{r|r2r3s r%test_insert_from_selectz*InsertBehaviorTest.test_insert_from_selectsT %  LLNN(((((((((       LLL % % 1 1 Q 566<<GL$$gw%788      I   ~&&// ==  hjj H H H      r'c |jj}tj|t ddt ddt ddgtj|d dt|j j d z|j j g |j j ddgttjt|g|j j |j j gd dS) Nrqrrrsrrtr ruTrr]))rqrrr])rrtr]r)rtr]r)r rur]r)rur]r)r<r[rr.r,r=rxryrrDrrrnrzrr{r|rs r%%test_insert_from_select_with_defaultsz8InsertBehaviorTest.test_insert_from_select_with_defaultssZ -  LLNN(((((((((       LLL % % 1 1 Q 566<<GL$$gw%788      I  w((uwzBB  hjj    r'N)rNrOrPrQrRrUr&rirrdrl empty_insertsroinsert_from_selectrrrrrWr'r%rYrYIsKK  [ < " " """" ! !  !$99%$98$##%$#($  %$ 6$  %$   r'rYcpeZdZdZdZdZddiZdZedZ e j dZ dZ d Zd Zd S) ReturningTestr)rdrTrc||}t|tjjjdfdSr)r+r1s r%r6z ReturningTest._assert_round_trip r7r'c td|tdtddtdtddS)NrrTrrrr!r"s r%r&zReturningTest.define_tablessT   g4$    66":: & &      r'ctj}|jj}|5}|||jj d}dddn #1swxYwY| d}tj t|jj g}t||dSNr*r:rr.r<rrgr,r=rdrDrr-rCrrr2rhr3r4rGrH fetched_pks r%%test_explicit_returning_pk_autocommitz3ReturningTest.test_explicit_returning_pk_autocommits & \\^^ t  ((44;A               WWYYq\Y%%fegj\&:&:;;  JsABBBctj}|jj}|5}|||jj d}| d}dddn #1swxYwYtj t|jj g}t||dSrrrs r%(test_explicit_returning_pk_no_autocommitz6ReturningTest.test_explicit_returning_pk_no_autocommit&s & \\^^ t  ((44;A1B                 Y%%fegj\&:&:;;  JsA!BB!Bctj|jjd||jjtjdSr9r;r>s r%/test_autoincrement_on_insert_implicit_returningz=ReturningTest.test_autoincrement_on_insert_implicit_returning1r@r'c.tj|jjd}tjt|jjjj g}t|j |gdSr9rBrFs r%(test_last_inserted_id_implicit_returningz6ReturningTest.test_last_inserted_id_implicit_returning6rJr'N)rNrOrPrun_create_tablesrSrRrTr6rUr&rfetch_rows_post_commitrrrrrWr'r%rrs6LK.5III  [ (  )(    CCC *****r'r)rrYrN)rrr assertionsrrschemarr r r r rr TablesTestrrYr__all__rWr'r%rs{!!!!!!77777H'777tx x x x x ,x x x v8*8*8*8*8*H'8*8*8*v Cr'