• File: assertions.cpython-37.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.pyc
  • Date Modified: 06/27/2022 11:08 PM
  • File size: 6.23 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)mockcCs ||kst|pd||fdS)z.Assert a == b, with repr messaging on failure.z%r != %rN)AssertionError)abmsgrK/opt/alt/python37/lib/python3.7/site-packages/alembic/testing/assertions.pyeq_srcCs ||kst|pd||fdS)z.Assert a != b, with repr messaging on failure.z%r == %rN)r)r
rrrrrne_srcCs ||kst|pd||fdS)z.Assert a is b, with repr messaging on failure.z%r is not %rN)r)r
rrrrris_srcCs ||k	st|pd||fdS)z2Assert a is not b, with repr messaging on failure.z%r is %rN)r)r
rrrrris_not_srcOs<y|||d}Wn|k
r*d}YnX|s8tddS)NFTz#Callable did not raise an exception)r)
except_cls	callable_argskwsuccessrrr
assert_raises s

rc
Osxy|||dstdWnX|k
rr}z:t|t|tjsPtd||ftt|dWdd}~XYnXdS)NFz#Callable did not raise an exceptionz%r !~ %szutf-8)rresearchrUNICODEprintencode)rrrrkwargserrrassert_raises_message*s
 r#)rrrrr#rcCsztdd|}tdd|}tdd|}tdd|}trLtdd|}ntdd|}||ksvt|prd||fdS)Nz^\s+?|\nz {2,} z!Uuz%r != %r)rsubrr)r
rrrrreq_ignore_whitespace8sr(cCsBt|}tt|j|ddddd|dddddS)N)dialect
r$	)_get_dialectrrcompilereplace)ZelementZ
assert_stringr)rrrassert_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_moddrrrr,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)messagesrrrrexpect_warningses
r9c	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_excludedr9)dbr8rspecrrrexpect_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)r9)fnrr)r8rrdecorateszemits_warning.<locals>.decorate)r)r8r@r)r8r
emits_warningsrAcstfdd}|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)r;r8rrr@sz"emits_warning_on.<locals>.decorate)r)r;r8r@r)r;r8remits_warning_onsrBTc	#srdd|Dn|ttjd
fdd	}td|dVWdQRX|rrtddfdd	DdS)NcSsg|]}t|tjqSr)rr-I).0rrrr
<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_warnregexseenrrour_warns

z"_expect_warnings.<locals>.our_warnz
warnings.warnzWarnings were not seen: %sz, c3s |]}dr|jn|VqdS)z%rN)pattern)rDs)rMrr	<genexpr>sz#_expect_warnings.<locals>.<genexpr>)N)setwarningswarnrZpatchrjoin)rJr8rMr>rOr)rJrKrLrMrNrr6sr6)N)N)N)N)N)N)TT)$Z
__future__rrr$rZsqlalchemy.enginerZutil.compatrr
contextlibZsqlalchemy.utilrZ
sqlalchemyr	r7rTrZsqla_094rrrrrr#Zsqlalchemy.testing.assertionsr(r/r0r,r9contextmanagerr=rArBr6rrrr<module>s6