U kfB@sddlZddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z d d lm Z d d lm Z d d lmZd d lmZd dlmZd dlmZd dlmZd dlmZGdddejZGdddejZGdddejejZdS)N)engines)fixtures)eq_) requirements)Column)Table)DateTime)func)Integer)select)sql)String)testingtextc@s^eZdZdZeddZeddZddZdd Zd d Z d d Z e j ddZ ddZdS) RowFetchTestTcCsDtd|tdtddtdtdtd|tdtddtdtdS) Nplain_pkidT) primary_keydata2 has_datestoday)rrr rr clsmetadatarU/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/testing/suite/test_results.py define_tabless   zRowFetchTest.define_tablesc Cs\||jjdddddddddg||jjdtdd d d d d d gdS) Nd1)rrrZd2r Zd3 r)rr)executetablesrinsertrdatetime)r connectionrrr insert_data.s   zRowFetchTest.insert_datacCs@||jj|jjjj}t|jdt|j ddSNr!r") r&r'rr order_bycrfirstrrselfr*rowrrr test_via_attr>s  zRowFetchTest.test_via_attrcCsH||jj|jjjj}t|j ddt|j dddS)Nrr!rr") r&r'rr r-r.rr/r_mappingr0rrrtest_via_stringFs zRowFetchTest.test_via_stringcCsD||jj|jjjj}t|ddt|dddS)Nrr!r") r&r'rr r-r.rr/rr0rrr test_via_intNs zRowFetchTest.test_via_intcCsX||jj|jjjj}t|j |jjjjdt|j |jjjj ddSr,) r&r'rr r-r.rr/rr4rr0rrrtest_via_col_objectVs z RowFetchTest.test_via_col_objectcCs\|t|jjjj|jjjjd|jjjj}| }t | ddgt |ddS)Nr)r"r") r&r r'rr.rlabelr-rr/rkeys)r1r*resultr2rrrtest_row_with_dupe_names^s  z%RowFetchTest.test_row_with_dupe_namesc Cs`|jj}t|djj}t|jj|d}| | }t |j t dddddddS)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%rN)r'rr aliasr.rZscalar_subqueryrr8r&r/rr=r))r1r*Z datetabless2r2rrrtest_row_w_scalar_selectjs z%RowFetchTest.test_row_w_scalar_selectN)__name__ __module__ __qualname__ __backend__ classmethodr r+r3r5r6r7rZ%duplicate_names_in_cursor_descriptionr;rArrrrrs   rc@sJeZdZdZdZdZeddZddZdd Z e j d d Z d d Z dS)PercentSchemaNamesTestztests 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. )Zpercent_schema_namesTcCs@td|tdttdt|j_tdtdtd|j_dS)Nz percent%tablepercent%spaces % more spaces) rrr r' percent_tablertablecolumnlightweight_percent_tablerrrrr sz$PercentSchemaNamesTest.define_tablescCsP|jj}ddddddddddddfD]}|||q,||dSNr$r%rHrI r'rJr&r( _assert_table)r1r*rJparamsrrrtest_single_roundtripsz,PercentSchemaNamesTest.test_single_roundtripcCsT|jj}||ddd||dddddddddg||dSrNrT)r1r*rJrrrtest_executemany_roundtripsz1PercentSchemaNamesTest.test_executemany_roundtripcCs||jj}||ddd|||jd|jdddddd ddddg}t|d d d g||dS) Nr$r%rOrHrIrPrQrRrSrPrQrRrSrQrR) r'rJr&r(Z returningr.rallrU)r1r*rJr:rrr$test_executemany_returning_roundtrips" z;PercentSchemaNamesTest.test_executemany_returning_roundtripc CsL|jj}|jj}||||fD]}tt|||j dddddgtt|| |j d ddg|j dddg|||j d }t|j dd t|j dd t|j |j dd t|j |j dd q$|||j dd itt|||j dd d ddgdS)NrH)r$r%rYrZr[rIrRrSr$r%)r$r^)rPr^)rRr^)rQr^)r'rJrMr>rlistr&r r-r.whereZin_r/r4updatevalues)r1connrJrMrKr2rrrrUs^    z$PercentSchemaNamesTest._assert_tableN)rBrCrD__doc__ __requires__rErFr rWrXrZinsert_executemany_returningr]rUrrrrrGzs   rGc@seZdZdZdZddZddZddZej d dd d dfd dd d dfdde ddfdddd dfdde dj dddfdde dj dddfdde d dfdddd de ddgfdddd dfdddd dfdd d! d"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.S)/ServerSideCursorsTest)server_side_cursorsTcCs|jjjdkrt|jS|jjjdkr-z1ServerSideCursorsTest.stringify..)rerxIsub)r1Zstr_rrr stringify+szServerSideCursorsTest.stringifyZ global_stringcCs|dSNselect 1rrrrrr{1r|zServerSideCursorsTest.Z global_textcCs t|dSrrrrrrr{5r|Z global_exprr!Zglobal_off_explicitFcCs t|dSrrrrrrr{<r|Z stmt_optionZstream_resultsZstmt_option_disabledZfor_update_exprZfor_update_stringcCs|dS)NzSELECT 1 FOR UPDATErrrrrr{Pr|ZsqliteZmssqlZ text_no_sscCs t|dS)N select 42rrrrrr{Wr|Ztext_ss_optioncCst|djddS)NrTr)rexecution_optionsrrrrr{]s Ziaaaz*engine_ss_arg, statement, cursor_ss_status)Zid_argnamesc Cst||}|X}t|r,tj||jd}t|trB||}n | |}t | |j || W5QRXdS)Nr)rtbegincallablerZresolve_lambdarrnruexec_driver_sqlr&rrrrqclose)r1Z engine_ss_argZ statementZcursor_ss_statusrjrcr:rrrtest_ss_cursor_status0s8     z+ServerSideCursorsTest.test_ss_cursor_statusc CsR|d}|6}|jdd|d}||jsszBServerSideCursorsTest.test_roundtrip_fetchmany..r!r$cSsg|]}|d|fqSrrrrrrrsrScSsg|]}|d|fqSrrrrrrrscSsg|]}|d|fqSrrrrrrrs)rrtrrr rrrr&r(ranger r-r.rrZ fetchmanyr)r1rrrjrr*r:rrrtest_roundtrip_fetchmanys>   z.ServerSideCursorsTest.test_roundtrip_fetchmanyN)rBrCrDrerErrrtrr combinationsr rZwith_for_updateZskip_ifrrrrrrrrrrrfsl 5  *rf)r)r}rrZ assertionsrconfigrZschemarrr r r r rrrrZ TablesTestrrGZTestBaseZAssertsExecutionResultsrfrrrr s*              ^