• File: assertions.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/alembic/testing/__pycache__/assertions.cpython-37.opt-1.pyc
  • Date Modified: 06/27/2022 11:08 PM
  • File size: 5.61 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

M!V@s*ddlmZddlZddlmZddlmZddlmZm	Z	ddl
Z
ddlmZddl
mZddlZd	d
lmZejsd)ddZd*d
dZd+ddZd,ddZddZddZn ddlmZmZmZmZmZmZd-ddZd.ddZiZddZddZe
jd d!Z d"d#Z!d$d%Z"e
jd/d'd(Z#dS)0)absolute_importN)util)default)	text_typepy3k)	decorator)exc)mockcCsdS)z.Assert a == b, with repr messaging on failure.N)abmsgrrK/opt/alt/python37/lib/python3.7/site-packages/alembic/testing/assertions.pyeq_srcCsdS)z.Assert a != b, with repr messaging on failure.Nr)r
rrrrrne_srcCsdS)z.Assert a is b, with repr messaging on failure.Nr)r
rrrrris_srcCsdS)z2Assert a is not b, with repr messaging on failure.Nr)r
rrrrris_not_srcOs0y|||d}Wn|k
r*d}YnXdS)NFTr)
except_cls	callable_argskwsuccessrrr
assert_raises s

rc
OsHy|||Wn4|k
rB}ztt|dWdd}~XYnXdS)Nzutf-8)printrencode)rrrrkwargserrrassert_raises_message*s

r)rrrrrrcCs^tdd|}tdd|}tdd|}tdd|}trLtdd|}ntdd|}dS)Nz^\s+?|\nz {2,} z!Uu)resubr)r
rrrrreq_ignore_whitespace8sr%cCsBt|}tt|j|ddddd|dddddS)N)dialect
r 	)_get_dialectrrcompilereplace)ZelementZ
assert_stringr&rrrassert_compiledHs
r,cCs||dks|dkrtSyt|Stk
rvttd|j|}|t|<}|dkrdd|_n|dkrrd|_	|SXdS)Nrzsqlalchemy.dialects.%sZ
postgresqlTZmssqlF)
rZDefaultDialect	_dialectsKeyErrorgetattr
__import__Zdialectsr&Zimplicit_returningZlegacy_schema_aliasing)nameZdialect_moddrrrr)Tsr)cOsttj|f|S)aContext 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.

    )_expect_warningssa_excZ	SAWarning)messagesrrrrexpect_warningses
r6c	osVt|}t|tjr&|tjs&dVn,t|s6dVnt||dVWdQRXdS)zContext manager which expects one or more warnings on specific
    dialects.

    The expect version **asserts** that the warnings were in fact seen.

    N)Zdb_spec
isinstancerZstring_typesZconfigZ_currentZ_is_excludedr6)dbr5rspecrrrexpect_warnings_onusr:cstfdd}|S)zDecorator form of expect_warnings().

    Note that emits_warning does **not** assert that the warnings
    were in fact seen.

    c	s$tddi|||SQRXdS)Nassert_F)r6)fnrr)r5rrdecorateszemits_warning.<locals>.decorate)r)r5r=r)r5r
emits_warningsr>cstfdd}|S)aVMark 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$tf|||SQRXdS)N)r:)r<rr)r8r5rrr=sz"emits_warning_on.<locals>.decorate)r)r8r5r=r)r8r5remits_warning_onsr?Tc	#sbrdd|Dn|ttjdfdd	}td|dVWdQRX|r^dS)NcSsg|]}t|tjqSr)r#r*I).0rrrr
<listcomp>sz$_expect_warnings.<locals>.<listcomp>cs|r t|s ||f||Ss(dSx^D]*}r@||sLs.||kr.|Pq.W|dkrv|f||n||f||dS)N)
issubclassmatchdiscard)rZ	exceptionargrZfilter_)exc_clsfilters	real_warnregexseenrrour_warns

z"_expect_warnings.<locals>.our_warnz
warnings.warn)N)setwarningswarnrZpatch)rGr5rJr;rLr)rGrHrIrJrKrr3sr3)N)N)N)N)N)N)TT)$Z
__future__rr#r rZsqlalchemy.enginerZutil.compatrr
contextlibZsqlalchemy.utilrZ
sqlalchemyr	r4rNrZsqla_094rrrrrrZsqlalchemy.testing.assertionsr%r,r-r)r6contextmanagerr:r>r?r3rrrr<module>s6