id#tUddlmZddlZddlmZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZddlmZddlmZddlmZddlmZddlZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*ej+Z,e,-dgGddeZGdd eeZe)rdd!lm.Z.n Gd"d#Z.d$e._/d0d&Z0iZ1d'e2d(<ed)Z3ed*Z4 d1d-Z5Gd.d/Z6dS)2) annotationsN)contextmanager)Any)DictColumn)inspect)MetaData)String)Table)testing)text)config)mock)eq_) TablesTest)TestBase) _get_dialect)EnvironmentContext)MigrationContext) Operations) sqla_compatcreate_mock_engine)sqla_14)sqla_2ztest.cfgceZdZeZejdZejdZejdZ dS)rc#K|d5t|VddddS#1swxYwYdS)NT)_per_migration)begin_transactionr)selfmigration_contexts M/opt/cloudlinux/venv/lib/python3.11/site-packages/alembic/testing/fixtures.py ops_contextzTestBase.ops_context)s  0 0 0 E E 0 0.// / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s 8<<cJtj|tdS)NT)transaction_per_migration)opts)r configuredict)r# connections r%r$zTestBase.migration_context.s,) TDAAA    c#Ktj5}|VddddS#1swxYwYdSN)rdbconnect)r#conns r%r,zTestBase.connection4s Y    DJJJ                  s 377N) __name__ __module__ __qualname__ris_sqlalchemy_futurer fixturer&r$r,r-r%rr&sx!W_000 _  _  __r-rceZdZdS)rN)r3r4r5r8r-r%rr:sDr-r)FutureEngineMixinceZdZdZdS)r:) sqlalchemy_14N)r3r4r5 __requires__r8r-r%r:r:Bs) r-r:T postgresql://c>gfd}t||fS)Nc~t|jdSN)dialect)appendstrcompilerB)sql multiparamsparamsbufengines r%dumpzcapture_db..dumpLs3 3s{{6>{::;;<<<<.configure`0 RtS C   r-r*) popioBytesIOStringIOrVrr*rpatchobject)r[rIr*rZs` @r%capture_context_bufferrcVs vvj%  jllkmmIIx#>>???  'D!!!!!!   -{I F F sB$$B(+B(c+Kddlm}ddlm}t j|}|}||dfd}d|itj fd}tj td |5VddddS#1swxYwYdS) Nr)_sqlite_file_dbr)eventbefore_cursor_executec8|dzdS)N )write)r2cursor statement parameterscontext executemanyrIs r%bcez*capture_engine_context_buffer..bcess  )d"#####r-r,c.|jdi|i|SrTrUrWs r%r*z0capture_engine_context_buffer..configurezr\r-r*)envre sqlalchemyrfr^r`r1 listens_forrVrr*rrarb) r[rerfengr2rpr*rIrZs ` @@r%capture_engine_context_bufferrvhsP$$$$$$      +--C /  C ;;==D t455$$$$65$II|T"###  'D!!!!!!   -{I F F s3CC  C defaultFc i}|rt||d<Gfdd}| G fddt}r|d<|r||d<ts|d krtd  d _nt| || _d _s fd }tj |} n |d<d} | | |} t| tj _ | S)N)naming_conventiontarget_metadatac&eZdZdZfdZdZdS)op_fixture..buffer_cg|_dSr/linesr#s r%__init__z$op_fixture..buffer_.__init__s DJJJr-c|}tjdd|}r,tjdd|}tjdd|}|j|dS)N[\n\t]z z\;\n*$)stripresubrrC)r#msgas_sqls r%rjz!op_fixture..buffer_.writeso))++C&B,,C 1fWb#..fYC00 J  c " " " " "r-cdSr/r8rs r%flushz!op_fixture..buffer_.flushs Dr-N)r3r4r5rrjr)rsr%buffer_r|sL    # # # # #     r-rc8eZdZfdZfdZfdZfdZdS)op_fixture..ctxcSr/r8r#rIs r%get_bufzop_fixture..ctx.get_bufsJr-c gjdd<dSr/r~rs r%clear_assertionsz(op_fixture..ctx.clear_assertionssCIaaaLLLr-cFtjd|DdS)Nc:g|]}tjdd|S)rr)rr).0ss r% z3op_fixture..ctx.assert_..s&BBBBF9b!44BBBr-)rr)r#rFrIs r%assert_zop_fixture..ctx.assert_s,  BBcBBB C C C C Cr-cRjD]}tjdd||vrdSdS)Nrr)rrr)r#rFstmtrIs r%assert_containsz'op_fixture..ctx.assert_containssC   6)R--55FF6  r-N)r3r4r5rrrr)rIsr%ctxrs~           D D D D D        r-rr literal_bindsmariadbmysql) rMariaDBTct|trt|}t|}|dSrA) isinstancerDrrErj)r multiparamparamrFrI ctx_dialects r%executezop_fixture..executesN$$$ "Dzzdll;l7788C IIcNNNNNr-)rBrrR) r rrrserver_version_infosupports_native_boolean#non_native_boolean_check_constraintrMockralembicop_proxy) rBrryrnative_booleanr)rrrr,rnrIrs ` @@r% op_fixturers DP"*=N"O"O"O $ '))C, X. -_ ,w)++"7++ *? ''#7++ !.< +;? 7        Y{GDDD #_ c+z400G"7++GJ Nr-c2eZdZdZdZdZdZdZddZdS) AlterColRoundTripFixture) alter_columnctj|_t j|j|_t|j|_t|_ dSr/) rr0r1r2rr*rrrr metadatars r%setUpzAlterColRoundTripFixture.setUpsKI%%'' #-di88TX&&  r-cFtd|}td|}dS)Nqr)r#t1t2c1c2s r% _compare_typez&AlterColRoundTripFixture._compare_types C__ C__r-cNtd||}td||}dS)Nr)server_defaultr)r#rs1rs2rrs r%_compare_server_defaultz0AlterColRoundTripFixture._compare_server_defaults. CB / / / CB / / /r-c tj|j|j5|j|jdddn #1swxYwY|jdSr/)r%_safe_rollback_connection_transactionr2beginrdrop_allclosers r%tearDownz!AlterColRoundTripFixture.tearDowns9$)DDD Y__   . . M " "49 - - - . . . . . . . . . . . . . . . s AA#&A#Nct|dd|dtd|dd|dd}td |j|}t j|j5||jt|j}| d d }|j d |j |j|j|jnd |jrdnd |dd|dd |dd|dd dddn #1swxYwYt|j}| d d }||}t#|dd|vr|dn|j ||d|d|dt#|d|d|j||d|d d|d|dd|vr |djn|j|jjjnddS)NnamecolnametypernullableTr)rrxrF) existing_typeexisting_server_defaultexisting_nullablerrnew_column_nametype_rw)rgetr r rr_ensure_scope_for_ddlr2creater get_columnsrrrrrrrrrrrX) r#from_to_comparecolumntinspold_colnew_cols r%_run_alter_colz'AlterColRoundTripFixture._run_alter_cols IIfi ( ( IIffRjj ) )YYz400 99%5t<<     #t}f - -  .ty 9 9   HHTY   49%%D&&s++A.G G  $k(4)/(=(=*0/"D$$uT22"ww'7?? # 5 5ggfd++ !                   ,ty!!""3''* ?G FO%00GFOOfk     FOW[[AA    GJ Z!I!IJJJ $$ FO KK 4 ( ( KK 0 07** $ % * *$0&*// s CF  FFr/) r3r4r5r=rrrrrr8r-r%rrsq %L### LLLOOO 7 7 7 7 7 7 r-r)r>)rwFNFN)7 __future__r configparser contextlibrr^rtypingrrrsrr r r r r rsqlalchemy.testingrrsqlalchemy.testing.assertionsrsqlalchemy.testing.fixturesrSQLAlchemyTablesTestrSQLAlchemyTestBaser assertionsr environmentr migrationr operationsrutilrutil.sqla_compatrrr ConfigParsertesting_configreadr:r6rLrM__annotations__rcrvrrr8r-r%rst"""""""%%%%%% %%%%%%######------JJJJJJFFFFFF$$$$$$,,,,,,((((((######111111&&&&&&%%%%%%+*,,ZL!!!!(     /    *=======*********.&"4   VVVVrY Y Y Y Y Y Y Y Y Y r-