관리-도구
편집 파일: assertions.cpython-37.pyc
B ��4]aF � @ s� d dl mZ d dlZd dlZd dlZddlmZ ddlmZ ddlmZ ddlm Z ddlmZ dd l m Z d dlmZ d dlmZ d d lmZ d dlmZ d dlmZ d dlm Z d dlmZ d dlmZ d dl mZ d dl mZ dd� Zejdd� �Zdd� Zdd� Zdd� Zdd� Z ejdJd"d#��Z!d$d%� Z"d a#d&d'� Z$dKd(d)�Z%dLd*d+�Z&dMd,d-�Z'dNd.d/�Z(dOd0d1�Z)dPd2d3�Z*dQd4d5�Z+dRd6d7�Z,dSd8d9�Z-dTd:d;�Z.dUd<d=�Z/dVd>d?�Z0d@dA� Z1dBdC� Z2G dDdE� dEe3�Z4G dFdG� dGe3�Z5G dHdI� dIe3�Z6dS )W� )�absolute_importN� )� assertsql)�config)�mock)�util)�db_spec)�fail� )�exc)�orm)�pool)�schema)�types)�default)�url)�compat)� decoratorc O s t tj| f|�S )a� 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. )�_expect_warnings�sa_excZ SAWarning)�messages�kw� r �P/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/assertions.py�expect_warnings s r c o sF t | �}t| tj�r&|tj�s&dV nt||�� dV W dQ R X dS )z�Context manager which expects one or more warnings on specific dialects. The expect version **asserts** that the warnings were in fact seen. N)r � isinstancer �string_typesr Z_currentr )�dbr r �specr r r �expect_warnings_on0 s r c s t � fdd��}|S )z�Decorator form of expect_warnings(). Note that emits_warning does **not** assert that the warnings were in fact seen. c s$ t � ddi�� | ||�S Q R X d S )N�assert_F)r )�fn�argsr )r r r �decorateI s zemits_warning.<locals>.decorate)r )r r# r )r r � emits_warningA s r$ c O s t tj| f|�S )N)r r ZSADeprecationWarning)r r r r r �expect_deprecatedQ s r% c s t � �fdd��}|S )aV Mark 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 � f��ddi�� | ||�S Q R X d S )Nr F)r )r! r"