Current Path : /usr/lib/python2.7/dist-packages/twisted/trial/test/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyc |
Mc @ s d Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z m Z d d l m Z d e f d YZ d e f d YZ d e f d YZ d e f d YZ d S( s? Tests for Trial's interaction with the Python warning system. iN( t StringIO( t FilePath( t TestCaset _collectWarningst _setWarningRegistryToNone( t TestResultt Maskc B s$ e Z d Z d e f d YZ RS( sS Hide a L{TestCase} definition from trial's automatic discovery mechanism. t MockTestsc B s, e Z d Z d Z e Z d Z d Z RS( s A test case which is used by L{FlushWarningsTests} to verify behavior which cannot be verified by code inside a single test method. s some warning textc C s t j | j | j d S( s@ Generate a warning and don't flush it. N( t warningst warnt messaget category( t self( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt test_unflushed s c C s6 t j | j | j | j t | j d d S( s: Generate a warning and flush it. i N( R R R R t assertEqualt lent flushWarnings( R ( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt test_flushed# s ( t __name__t __module__t __doc__R t UserWarningR R R ( ( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR s ( R R R R R ( ( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyR s t FlushWarningsTestsc B s e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( sn Tests for L{TestCase.flushWarnings}, an API for examining the warnings emitted so far in a test. c C s5 x. | j D] \ } } | j | | | q Wd S( s Assert that all the keys present in C{subset} are also present in C{set} and that the corresponding values are equal. N( t iteritemsR ( R t sett subsett kt v( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt assertDictSubset2 s c C sP | j t | t | x- t | | D] \ } } | j | | q, Wd S( s For each pair of corresponding elements in C{sets} and C{subsets}, assert that the element from C{subsets} is a subset of the element from C{sets}. N( R R t zipR ( R t setst subsetst at b( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt assertDictSubsets; s c C s | j | j g d S( sp If no warnings are emitted by a test, L{TestCase.flushWarnings} returns an empty list. N( R R ( R ( ( sC /usr/lib/python2.7/dist-packages/twisted/trial/test/test_warning.pyt test_noneF s c C s d } t } t j d | d | d } t } t j d | d | | j | j i | d 6| d 6i | d 6| d 6g d S( s If several warnings are emitted by a test, L{TestCase.flushWarnings} returns a list containing all of them. s first warning messageR R s second warning messageN( R R R t RuntimeWarningR"