ó
:îÜWt  c           @   sÞ   d  d l  Z d  d l j j Z d  d l Z d  d l Z d „  Z d „  Z	 d „  Z
 e rc d „  Z n  d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d d d „  ƒ  YZ d d d „  ƒ  YZ d S(   iÿÿÿÿNc          C   sè  t  j j t d d d ƒ ƒ }  |  |  k } | sì t j d | f d |  |  f ƒ i d t j ƒ  k sr t j |  ƒ r t j	 |  ƒ n d d 6d t j ƒ  k s© t j |  ƒ r¸ t j	 |  ƒ n d d 6} d i | d
 6} t
 t j | ƒ ƒ ‚ n  d  } t  j j t d d d ƒ ƒ } | |  k } | sÞt j d | f d | |  f ƒ i d t j ƒ  k sdt j | ƒ rst j	 | ƒ n d d 6d t j ƒ  k s›t j |  ƒ rªt j	 |  ƒ n d d 6} d i | d
 6} t
 t j | ƒ ƒ ‚ n  d  } d  S(   Ns   foo = "bar"t    t   execs   ==s   %(py0)s == %(py2)st   code1t   py0t   py2s   assert %(py4)st   py4s   foo = "baz"s   !=s   %(py0)s != %(py2)st   code2(   s   ==(   s   %(py0)s == %(py2)ss   assert %(py4)s(   s   !=(   s   %(py0)s != %(py2)ss   assert %(py4)s(   t   pyt   codet   Codet   compilet
   @pytest_art   _call_reprcomparet   @py_builtinst   localst   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   None(   R   t   @py_assert1t   @py_format3t   @py_format5R   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_ne   s      “     “   c          C   sX  d }  t  d |  d ƒ } | j } | |  k } | sÿ t j d | f d | |  f ƒ i d t j ƒ  k su t j | ƒ r„ t j | ƒ n d d 6t j | ƒ d 6d	 t j ƒ  k s¼ t j |  ƒ rË t j |  ƒ n d	 d
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } t j j | ƒ } | j } t | ƒ } | |  k }	 |	 sUt j d |	 f d | |  f ƒ i d t j ƒ  k s„t j t ƒ r“t j t ƒ n d d 6d t j ƒ  k s»t j | ƒ rÊt j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6d	 t j ƒ  k st j |  ƒ r!t j |  ƒ n d	 d 6}
 d i |
 d 6} t t j	 | ƒ ƒ ‚ n  d  } } }	 | j } | d  k } | sJt j d  | f d! | d  f ƒ i d t j ƒ  k sÀt j | ƒ rÏt j | ƒ n d d 6t j | ƒ d 6d t j ƒ  k st j d  ƒ rt j d  ƒ n d d
 6} d" i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } d  S(#   Ns   abc-123s   pass
R   s   ==s3   %(py2)s
{%(py2)s = %(py0)s.co_filename
} == %(py4)st   co_codeR   R   t   nameR   R    s   assert %(py6)st   py6sJ   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.path
})
} == %(py7)st   strR   t   py1t   py3t   py5t   py7s   assert %(py9)st   py9t   iss2   %(py2)s
{%(py2)s = %(py0)s.fullsource
} is %(py4)sR   (   s   ==(   s3   %(py2)s
{%(py2)s = %(py0)s.co_filename
} == %(py4)ss   assert %(py6)s(   s   ==(   sJ   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.path
})
} == %(py7)ss   assert %(py9)s(   R!   (   s2   %(py2)s
{%(py2)s = %(py0)s.fullsource
} is %(py4)ss   assert %(py6)s(   R
   t   co_filenameR   R   R   R   R   R   R   R   R   R   R   R	   t   pathR   t
   fullsource(   R   R   R   t   @py_assert3R   t   @py_format7R   t   @py_assert2t   @py_assert4t   @py_assert6t   @py_format8t   @py_format10(    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt/   test_code_gives_back_name_for_not_existing_file
   s2    	   £   
	    ê   	   £   c          C   s*   d d d „  ƒ  Y}  t  j j t d ƒ d  S(   Nt   Ac           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyR-      s   s   py.code.Code(A)(    (   R   t   testt   raisest	   TypeError(   R-   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_code_with_class   s    c           C   s   d  S(   N(    (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   x   s    c          C   s-  t  j j t ƒ }  |  j } d } t | ƒ } | | k } | st j d | f d | | f ƒ i t j | ƒ d 6d t	 j
 ƒ  k s‘ t j t ƒ r  t j t ƒ n d d 6d t	 j
 ƒ  k sÈ t j | ƒ r× t j | ƒ n d d 6t j | ƒ d	 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } d  S(   Ns   test_code_fullsource()t   ins0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}R   R   R   t   fullR   R   R    s   assert %(py8)st   py8(   R5   (   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}s   assert %(py8)s(   R   R   R	   R4   R$   R   R   R   R   R   R   R   R   R   R   (   R   R6   t   @py_assert0t   @py_assert5R'   R&   t   @py_format9(    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_code_fullsource   s    	    ³   c          C   sS  t  j j t ƒ }  |  j ƒ  } d } t | ƒ } | | k } | sEt j d | f d | | f ƒ i d t j	 ƒ  k s„ t j
 t ƒ r“ t j t ƒ n d d 6d t j	 ƒ  k s» t j
 | ƒ rÊ t j | ƒ n d d 6t j | ƒ d 6d	 t j	 ƒ  k st j
 | ƒ rt j | ƒ n d	 d
 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } d  S(   Ns   def x():
    passs   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py5)sR   R   t   srcR   R   t   expectedR   R    s   assert %(py7)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py5)ss   assert %(py7)s(   R   R   R	   R4   t   sourceR   R   R   R   R   R   R   R   R   R   (   R   R<   R=   R'   R(   t   @py_format6R*   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_code_source    s       Ú   c    	      C   sá   d „  }  |  ƒ  } t  j j | ƒ } | j j | j } } | | } | j } d } | | ƒ } | sË d d i t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} t t j	 | ƒ ƒ ‚ n  d  } } } } d  S(	   Nc           S   s   t  j d ƒ S(   Ni    (   t   syst	   _getframe(    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   func(   s    s           return sys._getframe(0)R    sL   assert %(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.startswith
}(%(py5)s)
}R   R   R   R   (   R   R   t   FrameR$   t   linenot
   startswithR   R   R   R   R   (	   RC   t   fR>   RE   R8   R'   R(   R)   R*   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt!   test_frame_getsourcelineno_myself'   s    		
 	    N  c          C   sÂ  d „  }  |  ƒ  } t  j j | ƒ } | j j j } zxd  | j j _ | j } t  j } | j } d } | | ƒ } | | k } | st j	 d | f d | | f ƒ i t j
 | ƒ d 6d t j ƒ  k sÖ t j | ƒ rå t j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d	 6d
 t j ƒ  k s-t j t  ƒ r<t j
 t  ƒ n d
 d 6t j
 | ƒ d 6t j
 | ƒ d 6}	 d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  d  } } } } } } Wd  | | j j _ Xd  S(   Nc           S   s   t  j d ƒ S(   Ni    (   RA   RB   (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyRC   0   s    R    s   ==sˆ   %(py2)s
{%(py2)s = %(py0)s.statement
} == %(py12)s
{%(py12)s = %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.code
}.Source
}(%(py10)s)
}R7   RG   R   t   py12R   R   R   t   py10R   s   assert %(py14)st   py14(   s   ==(   sˆ   %(py2)s
{%(py2)s = %(py0)s.statement
} == %(py12)s
{%(py12)s = %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.code
}.Source
}(%(py10)s)
}s   assert %(py14)s(   R   R   RD   t	   __class__R$   R   t	   statementt   SourceR   R   R   R   R   R   R   R   (   RC   RG   t   propR   R9   t   @py_assert7t   @py_assert9t   @py_assert11R%   t   @py_format13t   @py_format15(    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt"   test_getstatement_empty_fullsource/   s$    			 	 	     ã   c          C   s  t  j j t ƒ }  |  j } | sŽ d d i d t j ƒ  k sL t j |  ƒ r[ t j	 |  ƒ n d d 6t j	 | ƒ d 6} t
 t j | ƒ ƒ ‚ n  d  } |  j } | sd d i d t j ƒ  k sÎ t j |  ƒ rÝ t j	 |  ƒ n d d 6t j	 | ƒ d 6} t
 t j | ƒ ƒ ‚ n  d  } d  S(   NR    s/   assert %(py2)s
{%(py2)s = %(py0)s.firstlineno
}t   coR   R   s(   assert %(py2)s
{%(py2)s = %(py0)s.path
}(   R   R   R	   RH   t   firstlinenoR   R   R   R   R   R   R   R   R#   (   RV   R   R   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_code_from_func;   s    	  U  	  U  c            sB  t  j j } | j ‰  ‡  f d †  } d t f d „  ƒ  Y} |  j | d | ƒ |  j | d | ƒ t  j j ƒ  | j } | | k } | sTt j	 d | f d | | f ƒ i d t
 j ƒ  k sÊ t j | ƒ rÙ t j | ƒ n d d	 6t j | ƒ d
 6d t
 j ƒ  k st j | ƒ r t j | ƒ n d d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } | j } | | k } | sEt j	 d | f d | | f ƒ i d t
 j ƒ  k s»t j | ƒ rÊt j | ƒ n d d	 6t j | ƒ d
 6d t
 j ƒ  k st j | ƒ rt j | ƒ n d d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } t  j j ƒ  | j } | | k } | sCt j	 d | f d | | f ƒ i d t
 j ƒ  k s¹t j | ƒ rÈt j | ƒ n d d	 6t j | ƒ d
 6d t
 j ƒ  k s t j | ƒ rt j | ƒ n d d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } | j } | | k } | s4t j	 d | f d | | f ƒ i d t
 j ƒ  k sªt j | ƒ r¹t j | ƒ n d d	 6t j | ƒ d
 6d t
 j ƒ  k sñt j | ƒ r t j | ƒ n d d 6} d  i | d 6} t t j | ƒ ƒ ‚ n  d  } } d  S(!   Nc             s   ˆ  |  | Ž  S(   N(    (   t   argst   kwargs(   t   comp(    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt	   mycompileE   s    t   Subc           B   s   e  Z RS(    (   R.   R/   (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyR]   G   s   R   R
   s   !=s6   %(py2)s
{%(py2)s = %(py0)s.AssertionError
} != %(py4)st   cpy_builtinR   R   R   R    s   assert %(py6)sR   s/   %(py2)s
{%(py2)s = %(py0)s.compile
} != %(py4)sR\   R!   s6   %(py2)s
{%(py2)s = %(py0)s.AssertionError
} is %(py4)ss   ==s/   %(py2)s
{%(py2)s = %(py0)s.compile
} == %(py4)s(   s   !=(   s6   %(py2)s
{%(py2)s = %(py0)s.AssertionError
} != %(py4)ss   assert %(py6)s(   s   !=(   s/   %(py2)s
{%(py2)s = %(py0)s.compile
} != %(py4)ss   assert %(py6)s(   R!   (   s6   %(py2)s
{%(py2)s = %(py0)s.AssertionError
} is %(py4)ss   assert %(py6)s(   s   ==(   s/   %(py2)s
{%(py2)s = %(py0)s.compile
} == %(py4)ss   assert %(py6)s(   R   t   builtint   builtinsR
   R   t   setattrR   t   patch_builtinsR   R   R   R   R   R   R   R   t   unpatch_builtins(   t   monkeypatchR^   R\   R]   R   R%   R   R&   (    (   R[   s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_builtin_patch_unpatchB   sH    		   £   
	   £   
	   £   
	   £   c             st   t  j j d d ƒ j d ƒ ‰  ‡  f d †  }  t  j j t |  ƒ } t | ƒ } t j	 d d k  rp t
 | ƒ } n  d  S(   Ns   Ä…Ä‡
s   utf-8t   utf8c              s   t  ˆ  ƒ ‚ d  S(   N(   t	   Exception(    (   t   value(    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyRG   U   s    i    i   (   R   R_   t   _totextt   encodeR0   R1   Rg   R   RA   t   version_infot   unicode(   RG   t   excinfot   st   u(    (   Rh   s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_unicode_handlingS   s    c          C   s(  d „  }  t  j j |  ƒ } | j } | d t ƒ } d } | | k } | s7t j d | f d | | f ƒ i d t j ƒ  k s t j	 | ƒ rœ t j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d	 6d
 t j ƒ  k sä t j	 t ƒ ró t j
 t ƒ n d
 d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  } t  j j | ƒ }	 |	 j } | d t ƒ } d } | | k } | s€t j d | f d | | f ƒ i d t j ƒ  k sÖt j	 |	 ƒ råt j
 |	 ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d	 6d
 t j ƒ  k s-t j	 t ƒ r<t j
 t ƒ n d
 d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  }
 t  j j |
 ƒ } | j } | d t ƒ } d  } | | k } | sÉt j d! | f d" | | f ƒ i d t j ƒ  k st j	 | ƒ r.t j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d	 6d
 t j ƒ  k svt j	 t ƒ r…t j
 t ƒ n d
 d 6t j
 | ƒ d 6} d# i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  } t  j j | ƒ } | j } | d t ƒ } d$ } | | k } | st j d% | f d& | | f ƒ i d t j ƒ  k sht j	 | ƒ rwt j
 | ƒ n d d 6t j
 | ƒ d 6t j
 | ƒ d	 6d
 t j ƒ  k s¿t j	 t ƒ rÎt j
 t ƒ n d
 d 6t j
 | ƒ d 6} d' i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S((   Nc         S   s   d  S(   N(    (   R4   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   f1]   s    t   varR4   s   ==sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)st   c1R   R7   R   t   TrueR   R   R    s   assert %(py10)sRJ   c         W   s   d  S(   N(    (   R4   t   y(    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   f2b   s    Ru   t   c2c         [   s   d  S(   N(    (   R4   t   z(    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   f3g   s    Rx   t   c3c         _   s   d  S(   N(    (   R4   Ru   Rx   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   f4l   s    t   c4(   R4   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   Ru   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   Rx   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   Ru   Rx   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R   R   R	   t   getargsRt   R   R   R   R   R   R   R   R   R   (   Rq   Rs   R   R(   RP   R)   R:   t   @py_format11Rv   Rw   Ry   Rz   R{   R|   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_code_getargs\   sX    		     Ã   		     Ã   		     Ã   		     Ã   c          C   s“  d „  }  t  j j |  d ƒ ƒ } | j } | d t ƒ } d g } | | k } | s@t j d | f d | | f ƒ i d t j ƒ  k s– t j	 | ƒ r¥ t j
 | ƒ n d d 6t j
 | ƒ d	 6t j
 | ƒ d
 6d t j ƒ  k sí t j	 t ƒ rü t j
 t ƒ n d d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  } t  j j | d d d ƒ ƒ }	 |	 j } | d t ƒ } d  d d! f g } | | k } | s¡t j d" | f d# | | f ƒ i d t j ƒ  k s÷t j	 |	 ƒ rt j
 |	 ƒ n d d 6t j
 | ƒ d	 6t j
 | ƒ d
 6d t j ƒ  k sNt j	 t ƒ r]t j
 t ƒ n d d 6t j
 | ƒ d 6} d$ i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  }
 t  j j |
 d d d ƒƒ } | j } | d t ƒ } d% d i d d 6f g } | | k } | s	t j d& | f d' | | f ƒ i d t j ƒ  k s_t j	 | ƒ rnt j
 | ƒ n d d 6t j
 | ƒ d	 6t j
 | ƒ d
 6d t j ƒ  k s¶t j	 t ƒ rÅt j
 t ƒ n d d 6t j
 | ƒ d 6} d( i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d „  } t  j j | d d d d ƒƒ } | j } | d t ƒ } d) d d* f d i d d 6f g } | | k } | s}t j d+ | f d, | | f ƒ i d t j ƒ  k sÓt j	 | ƒ rât j
 | ƒ n d d 6t j
 | ƒ d	 6t j
 | ƒ d
 6d t j ƒ  k s*t j	 t ƒ r9t j
 t ƒ n d d 6t j
 | ƒ d 6} d- i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S(.   Nc         S   s   t  j d ƒ S(   Ni    (   RA   RB   (   R4   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyRq   s   s    t   aRr   R4   s   ==sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)st   fr1R   R7   R   Rt   R   R   R    s   assert %(py10)sRJ   c         W   s   t  j d ƒ S(   Ni    (   RA   RB   (   R4   Ru   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyRv   x   s    t   bt   cRu   t   fr2c         [   s   t  j d ƒ S(   Ni    (   RA   RB   (   R4   Rx   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyRy   }   s    Rx   t   fr3c         _   s   t  j d ƒ S(   Ni    (   RA   RB   (   R4   Ru   Rx   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyR{   ‚   s    t   dt   fr4(   R4   R€   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   R€   (   R‚   Rƒ   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   R€   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R4   R€   (   R‚   (   s   ==(   sQ   %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.getargs
}(var=%(py3)s)
} == %(py8)ss   assert %(py10)s(   R   R   RD   R}   Rt   R   R   R   R   R   R   R   R   R   (   Rq   R   R   R(   RP   R)   R:   R~   Rv   R„   Ry   R…   R{   R‡   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_frame_getargsr   sX    		  	   Ã   		     Ã   		     Ã   	!	  "   Ã   t   TestExceptionInfoc           B   s   e  Z d  „  Z RS(   c         C   s2  yl t  r n_ t  sk d	 i d t j ƒ  k s9 t j t  ƒ rH t j t  ƒ n d d 6} t t j | ƒ ƒ ‚ n  Wn  t k
 rŽ t j	 j
 ƒ  } n X| j } | ƒ  } | s$d d i d t j ƒ  k sÒ t j | ƒ rá t j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } d  S(
   NR    s   assert %(py0)st   FalseR   sB   assert %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.getrepr
}()
}t   exciR   R   s   assert %(py0)s(   RŠ   R   R   R   R   R   R   R   R   R   t   ExceptionInfot   getreprR   (   t   selft   @py_format1R‹   R   R%   R   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_bad_getsource‹   s      A 	 	  e  (   R.   R/   R   (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyR‰   ‰   s   t   TestTracebackEntryc           B   s   e  Z d  „  Z RS(   c         C   sX  yl t  r n_ t  sk d i d t j ƒ  k s9 t j t  ƒ rH t j t  ƒ n d d 6} t t j | ƒ ƒ ‚ n  Wn  t k
 rŽ t j	 j
 ƒ  } n X| j d } | j ƒ  } t | ƒ } d } | | k } | s¨t j d | f d | | f ƒ i d	 t j ƒ  k st j t ƒ rt j t ƒ n d	 d 6d
 t j ƒ  k sEt j | ƒ rTt j | ƒ n d
 d 6t j | ƒ d 6t j | ƒ d 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d  } } } d }
 | d } |
 | k } | sFt j d | f d |
 | f ƒ i t j |
 ƒ d 6t j | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  }
 } } d  S(   NR    s   assert %(py0)sRŠ   R   i    i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)st   lenR>   R   R   R   s   assert %(py8)sR7   s   else: assert Falsei   R5   s   %(py1)s in %(py4)sR   s   assert %(py6)ss   assert %(py0)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R5   (   s   %(py1)s in %(py4)ss   assert %(py6)s(   RŠ   R   R   R   R   R   R   R   R   R   RŒ   t	   tracebackt	   getsourceR’   R   R   (   RŽ   R   R‹   t   entryR>   R'   R9   R(   R&   R:   R8   R%   R   (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   test_getsource–   s4      A     ³    
   E   (   R.   R/   R–   (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyR‘   ”   s   (    (    (   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   R   RA   R   R,   R3   Rt   R4   R;   R@   RH   RU   RX   Re   Rp   R   Rˆ   R‰   R‘   (    (    (    s<   /home/ronny/Projects/pytest-dev/py/testing/code/test_code.pyt   <module>   s&     													