σ ŒM!Vc@@s†ddlmZddlZddlmZddlmZddlmZm Z ddl Z ddl m Z ddl mZddlZd d lmZejsθdd „Zdd „Zdd „Zdd„Zd„Zd„Zn.ddlmZmZmZmZmZmZdd„Zdd„ZiZd„Zd„Ze j d„ƒZ!d„Z"d„Z#e j e$e$d„ƒZ%dS(i(tabsolute_importNi(tutil(tdefault(t text_typetpy3k(t decorator(texci(tmockcC@sdS(s.Assert a == b, with repr messaging on failure.N((tatbtmsg((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyteq_scC@sdS(s.Assert a != b, with repr messaging on failure.N((RR R ((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytne_scC@sdS(s.Assert a is b, with repr messaging on failure.N((RR R ((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytis_scC@sdS(s2Assert a is not b, with repr messaging on failure.N((RR R ((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytis_not_scO@s5y|||Žt}Wn|k r0t}nXdS(N(tFalsetTrue(t except_clst callable_targstkwtsuccess((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyt assert_raises s     cO@s?y|||ŽWn'|k r:}t|ƒjdƒGHnXdS(Nsutf-8(Rtencode(RR RRtkwargste((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytassert_raises_message*s  (R R R RRRcC@s‹tjdd|ƒ}tjdd|ƒ}tjdd|ƒ}tjdd|ƒ}trrtjdd|ƒ}ntjdd|ƒ}dS(Ns^\s+?|\nts {2,}t s!Utu(tretsubR(RR R ((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyteq_ignore_whitespace8scC@s_t|ƒ}tt|jd|ƒƒjddƒjddƒ|jddƒjddƒƒdS(Ntdialects Rs (t _get_dialectR Rtcompiletreplace(telementt assert_stringR!((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytassert_compiledHs  cC@s§|dks|dkr"tjƒSy t|SWnrtk r’ttd|ƒj|ƒ}|jƒt|<}|dkr†t |_ n|dkržt |_ n|SXdS(NRssqlalchemy.dialects.%st postgresqltmssql( tNoneRtDefaultDialectt _dialectstKeyErrortgetattrt __import__tdialectsR!Rtimplicit_returningRtlegacy_schema_aliasing(tnamet dialect_modtd((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyR"Ts       cO@sttj||S(sΚContext manager which expects one or more warnings. With no arguments, squelches all SAWarnings emitted via sqlalchemy.util.warn and sqlalchemy.util.warn_limited. Otherwise pass string expressions that will match selected warnings via regex; all non-matching warnings are sent through. The expect version **asserts** that the warnings were in fact seen. Note that the test suite sets SAWarning warnings to raise exceptions. (t_expect_warningstsa_exct SAWarning(tmessagesR((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytexpect_warningses co@sit|ƒ}t|tjƒr6|tjƒ r6dVn/t|ŒsJdVnt||Ž dVWdQXdS(s›Context manager which expects one or more warnings on specific dialects. The expect version **asserts** that the warnings were in fact seen. N(tdb_spect isinstanceRt string_typestconfigt_currentt _is_excludedR:(tdbR9Rtspec((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytexpect_warnings_onus " c@st‡fd†ƒ}|S(s„Decorator form of expect_warnings(). Note that emits_warning does **not** assert that the warnings were in fact seen. c@s*tdtˆŒ|||ŽSWdQXdS(Ntassert_(R:R(tfnRR(R9(sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytdecorates(R(R9RF((R9sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyt emits_warningˆsc@st‡‡fd†ƒ}|S(sVMark a test as emitting a warning on a specific dialect. With no arguments, squelches all SAWarning failures. Or pass one or more strings; these will be matched to the root of the warning description by warnings.filterwarnings(). Note that emits_warning_on does **not** assert that the warnings were in fact seen. c@s'tˆˆŒ|||ŽSWdQXdS(N(RC(RERR(RAR9(sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyRF£s(R(RAR9RF((RAR9sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytemits_warning_on˜s c#@s•ˆr1g|D]}tj|tjƒ^q ‰n|‰tˆƒ‰tj‰d‡‡‡‡‡fd†}tjd|ƒ dVWdQX|r‘ndS(Nc@s³|r)t|ˆƒ r)ˆ||||ŽSˆs3dSxyˆD]?}ˆrU|j|ƒshˆ r:||kr:ˆj|ƒPq:q:W|dkrœˆ|||Žnˆ||||ŽdS(N(t issubclasstmatchtdiscardR*(R t exceptiontargRtfilter_(texc_clstfilterst real_warntregextseen(sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pytour_warn·s   s warnings.warn( RR#tItsettwarningstwarnR*Rtpatch(ROR9RRRDR RT((RORPRQRRRSsK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyR6«s+   (&t __future__RRRRtsqlalchemy.engineRt util.compatRRt contextlibtsqlalchemy.utilRt sqlalchemyRR7RWRtsqla_094R*R R R RRRtsqlalchemy.testing.assertionsR R'R,R"R:tcontextmanagerRCRGRHRR6(((sK/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/assertions.pyts6         .