ó
|‰ãW–C  c           @   s„  d  d l  Z d  d l j j Z d  d l m Z d  d l Z d  d l	 Z	 d  d l
 m Z e d k	 rt e j j j Z n e j j j d d d ƒZ e j j j 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 d: d „  ƒ  YZ d d; d „  ƒ  YZ  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% d „  Z& e j j j d ƒ d „  ƒ Z' e( rœd  „  Z) n  d! „  Z* d" „  Z+ d# „  Z, d$ „  Z- d% „  Z. d& „  Z/ d' „  Z0 d( „  Z1 d) „  Z2 d* „  Z3 d+ „  Z4 d, „  Z5 d- „  Z6 d. „  Z7 d/ „  Z8 d0 „  Z9 d1 d< d2 „  ƒ  YZ: d3 d= d4 „  ƒ  YZ; d5 d> d6 „  ƒ  YZ< d7 „  Z= d8 „  Z> d9 „  Z? d S(?   iÿÿÿÿN(   t   Source(   t   _astt   Truet   reasons   only works with AST-compiles   sys.platform.startswith('java')c          C   sx  t  d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sr 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	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } t  d ƒ }  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 sÃt j |  ƒ rÒt j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } t  d d t ƒ}  t |  ƒ } d } | | k } | sF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	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } t  d d t ƒ}  t |  ƒ } d } | | k } | sf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	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Nt   3s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)st   strt   py0t   xt   py1t   py3t   py6t    s   assert %(py8)st   py8s      3s   
        3
    t   rstrips   
3
    s   
3(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R    R   t
   @pytest_art   _call_reprcomparet   @py_builtinst   localst   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   Nonet   FalseR   (   R   t   @py_assert2t   @py_assert5t   @py_assert4t   @py_format7t   @py_format9(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_str_function   sL        ³       ³       ³       ³   c    
      C   sd  y t  Wn t k
 r d  SXt t  d ƒ ƒ }  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 sÌ t j |  ƒ rÛ t j	 |  ƒ n d d 6t j	 | ƒ d 6t j	 | ƒ d	 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } t j j t  d d ƒ d d ƒ} t | ƒ } t | t  ƒ } | sZd
 d 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 6d t j ƒ  k st j t  ƒ r't j	 t  ƒ n d d 6t j	 | ƒ d 6}	 t
 t j |	 ƒ ƒ ‚ n  d  } d  S(   Nt   4s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R   R   R	   R
   R   s   assert %(py8)sR   s   u"Ã¥"t   utf8t   modet   evals5   assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}t
   isinstancet   valt   unicodet   py2t   py4(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R$   t	   NameErrorR    R   R   R   R   R   R   R   R   R   R   t   pyt   codet   compileR!   R"   (
   R   R   R   R   R   R   t   coR#   t   @py_assert3t   @py_format5(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_unicode   s(        ³   !  Ã  c          C   s)  t  j j t ƒ }  t |  ƒ } | j } d } | | ƒ } | sd d i t j | ƒ d 6d t j	 ƒ  k sz 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
 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S(   Ns   def test_source_str_function():R   sj   assert %(py9)s
{%(py9)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.startswith
}(%(py7)s)
}t   py9R   R   t   sourceR   R	   t   py5t   py7(   R(   R)   R    R   R   t
   startswithR   R   R   R   R   R   R   R   (   R0   R   R   t   @py_assert6t   @py_assert8t   @py_format10(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_from_function)   s     	    ¼  c          C   s	  d d d „  ƒ  Y}  t  j j |  ƒ  j ƒ } | j } d 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
 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } d  S(   Nt	   TestClassc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   t   self(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_method/   s    (   t   __name__t
   __module__R:   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR8   .   s   s   def test_method(self):s       passs   ==s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)sR0   R   R%   R1   R   s   assert %(py7)sR2   (    (   s   ==(   s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)ss   assert %(py7)s(   R(   R)   R    R:   t   linesR   R   R   R   R   R   R   R   R   (   R8   R0   t   @py_assert1R   R,   t   @py_format6t   @py_format8(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_from_method-   s    	    |   c          C   s  d d d g }  t  j j |  ƒ } | j } d d 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 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } d  S(   Ns   a 
s   b
t   cs   a t   bs   ==s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)sR0   R   R%   R1   R   s   assert %(py7)sR2   (   s   ==(   s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)ss   assert %(py7)s(   R(   R)   R    R=   R   R   R   R   R   R   R   R   R   (   R=   R0   R>   R   R,   R?   R@   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_from_lines5   s    	    |   c          C   s]  d „  }  t  j j |  d t ƒ} t | ƒ } | j } d } | | ƒ } | s"d d 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 6t j | ƒ d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } } t  j j |  ƒ } t | ƒ } | j } d } | | ƒ } | sGd d 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 6t j | ƒ d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S(   Nc           S   s   d  S(   N(    (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   f;   s    t   deindents       def f():R   sj   assert %(py9)s
{%(py9)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.startswith
}(%(py7)s)
}R/   R   R   R0   R   R	   R1   R2   s   def f():(   R(   R)   R    R   R   R3   R   R   R   R   R   R   R   R   (   RE   R0   R   R   R4   R5   R6   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_from_inner_function:   s&    	 	    ¼   	    ¼  c          C   s0  t  d ƒ }  |  j d d ƒ }  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 s» t j |  ƒ rÊ t j |  ƒ n d	 d
 6t j | ƒ d 6t j | ƒ d 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ns   raise ValueErrors   try:sN           except ValueError:
            x = 42
        else:
            x = 23sH   try:
    raise ValueError
except ValueError:
    x = 42
else:
    x = 23s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R    t	   putaroundR   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_putaround_simpleB   s    	    ³   c          C   sd  t  ƒ  }  |  j d ƒ }  t |  ƒ } | j } | ƒ  } d } | | k } | sJ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
 6t j	 | ƒ d 6t j	 | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } } } d  S(   Ns#   
        if 1:
            x=1
    s   if 1:
    x=1s   ==sc   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
} == %(py10)sR   R   R0   R   t   py10R	   R1   R2   R   s   assert %(py12)st   py12(   s   ==(   sc   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
} == %(py10)ss   assert %(py12)s(   R    RH   R   t   stripR   R   R   R   R   R   R   R   R   (   R0   R   R   R4   t   @py_assert9R5   t   @py_format11t   @py_format13(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_putaroundR   s    		 	 	    Ó   c    	      C   s  t  d ƒ }  t  ƒ  } |  | k } | só t j d | f d |  | f ƒ i d t j ƒ  k si t j |  ƒ rx t j |  ƒ n d 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  } } t
 |  ƒ } d } | | k } | sýt j d | f d | | f ƒ i d t j ƒ  k sct j t
 ƒ rr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
 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } |  j } | ƒ  } | |  k } | st j d | f d | |  f ƒ i d t j ƒ  k sq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  } } } d  S(   NR   s   ==s)   %(py0)s == %(py4)s
{%(py4)s = %(py2)s()
}R0   R   R    R%   R&   s   assert %(py6)sR
   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R	   s   assert %(py8)sR   sD   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.strip
}()
} == %(py6)s(   s   ==(   s)   %(py0)s == %(py4)s
{%(py4)s = %(py2)s()
}s   assert %(py6)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   s   ==(   sD   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.strip
}()
} == %(py6)ss   assert %(py8)s(   R    R   R   R   R   R   R   R   R   R   R   RL   (	   R0   R,   R>   R-   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_stripsZ   s0    	   £   
    ³   	 	   ³   c          C   s  t  ƒ  }  d d d g |  _ |  j ƒ  } | j } 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	 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   NR   s    hellos     s   ==s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)st   source2R   R%   R1   s   assert %(py7)sR2   (   s   ==(   s-   %(py2)s
{%(py2)s = %(py0)s.lines
} == %(py5)ss   assert %(py7)s(   R    R=   RL   R   R   R   R   R   R   R   R   R   (   R0   RR   R>   R   R,   R?   R@   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_source_strip_multiline`   s    		 	   |   c    	      C   sæ  t  j j t t  j j d ƒ }  |  j } | j } 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 6t j | ƒ d	 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } |  j } | j } 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 6t j | ƒ d	 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } |  j } | j } | j } | ƒ  } | sÐt j d ƒ d i d t
 j ƒ  k s^t j |  ƒ rmt j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } } } d  S(   Ns   xyz xyzi   s   ==sI   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.lineno
} == %(py7)st   exR   R%   R&   R2   R   s   assert %(py9)sR/   i   i   t   insI   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.offset
} in %(py7)ss   x xsw   
>assert %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.text
}.strip
}()
}R   R
   (   s   ==(   sI   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.lineno
} == %(py7)ss   assert %(py9)s(   i   i   (   RU   (   sI   %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.value
}.offset
} in %(py7)ss   assert %(py9)s(   R(   t   testt   raisest   SyntaxErrorR)   R*   t   valuet   linenoR   R   R   R   R   R   R   R   R   t   offsett   textRL   t   _format_assertmsg(	   RT   R>   R,   R4   R   R@   R6   t   @py_assert7R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt!   test_syntaxerror_rerepresentationf   s6    	 	    Œ   	 	    Œ   	 	 	 	  Ž  c          C   s’  d }  t  |  ƒ } | j } | ƒ  } | sÇ d d i d t j ƒ  k sU t j t  ƒ rd t j t  ƒ n d d 6t j | ƒ d 6t j |  ƒ d 6t j | ƒ d 6t j | ƒ d	 6} t t j | ƒ ƒ ‚ n  d  }  } } } d
 }  t  |  ƒ } | j } | ƒ  } | s d d i d t j ƒ  k s.t j t  ƒ r=t j t  ƒ n d d 6t j | ƒ d 6t j |  ƒ d 6t j | ƒ d 6t j | ƒ d	 6} t t j | ƒ ƒ ‚ n  d  }  } } } d }  t  |  ƒ } | j } | ƒ  } | syd d i d t j ƒ  k st j t  ƒ rt j t  ƒ n d d 6t j | ƒ d 6t j |  ƒ d 6t j | ƒ d 6t j | ƒ d	 6} t t j | ƒ ƒ ‚ n  d  }  } } } d }  t  |  ƒ } | j } | ƒ  } | } | sYd d i d t j ƒ  k sçt j t  ƒ röt j t  ƒ n d d 6t j | ƒ d 6t j |  ƒ d 6t j | ƒ d 6t j | ƒ d	 6} t t j | ƒ ƒ ‚ n  d  }  } } } } d }  t  |  ƒ } | j } | ƒ  } | } | s=d d i d t j ƒ  k sËt j t  ƒ rÚt j t  ƒ n d d 6t j | ƒ d 6t j |  ƒ d 6t j | ƒ d 6t j | ƒ d	 6} t t j | ƒ ƒ ‚ n  d  }  } } } } d } t
 | ƒ } t  | ƒ }	 |	 j }
 |
 ƒ  } | } | std d i t j |
 ƒ d 6t j | ƒ d 6d t j ƒ  k sÛt j t  ƒ rêt j t  ƒ n d d 6d t j ƒ  k st j t
 ƒ r!t j t
 ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j |	 ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } }	 }
 } } d  S(   Nt   helloR   sd   assert %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
}.isparseable
}()
}R    R   R   R%   R&   R
   s   if 1:
  passs    
if 1:
  passs   if 1:
sh   assert not %(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
}.isparseable
}()
}s    
if 1:
passi    sˆ   assert not %(py11)s
{%(py11)s = %(py9)s
{%(py9)s = %(py7)s
{%(py7)s = %(py0)s(%(py5)s
{%(py5)s = %(py1)s(%(py3)s)
})
}.isparseable
}()
}R/   t   py11t   chrR   R	   R1   R2   (   R    t   isparseableR   R   R   R   R   R   R   R   Rb   (   R>   R,   R   R^   R   RM   R6   R   R   R4   R5   t   @py_assert10t   @py_assert12RO   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_isparseablel   sh      	 	  …    	 	  …    	 	  …    	 	   …    	 	   …     	 	   Ì  t   TestAccessesc           B   s8   e  Z e d  ƒ Z d „  Z d „  Z d „  Z d „  Z RS(   sJ           def f(x):
            pass
        def g(x):
            pass
    c         C   sì  |  j  d d !} | j } | ƒ  } | s¥ d d i d t j ƒ  k sS t j | ƒ rb t j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} t t j | ƒ ƒ ‚ n  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 sUt j | ƒ rdt j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6}	 d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  d  } } } } t | ƒ } d } | | k } | sÚt j d | f d | | f ƒ i d t j ƒ  k s@t j t ƒ rOt j t ƒ n d d 6d t j ƒ  k swt j | ƒ r†t j | ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d  } } } d  S(   Ni    i   R   sF   assert %(py4)s
{%(py4)s = %(py2)s
{%(py2)s = %(py0)s.isparseable
}()
}R   R   R%   R&   s   ==sK   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.lines
})
} == %(py8)st   lenR   R   R	   R1   s   assert %(py10)sRJ   s   def f(x):
    passs0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R
   s   assert %(py8)s(   s   ==(   sK   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.lines
})
} == %(py8)ss   assert %(py10)s(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R0   Rc   R   R   R   R   R   R   R   R   R=   Rh   R   R   (   R9   R   R>   R,   R-   R   R   R^   R4   R   RN   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getrange{   s0    	 	  e  
	     Ã       ³   c         C   sÈ   |  j  d } d } | | k } | sº t j d | f d | | f ƒ i d t j ƒ  k sg t j | ƒ rv t j | ƒ n d d 6t j | ƒ d 6} d i | d
 6} t t j | ƒ ƒ ‚ n  d  } } d  S(   Ni    s	   def f(x):s   ==s   %(py0)s == %(py3)sR   R   R	   R   s   assert %(py5)sR1   (   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(
   R0   R   R   R   R   R   R   R   R   R   (   R9   R   R   R>   t   @py_format4R?   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getline   s       l   c         C   s/  |  j  } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k so 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	 6t j | ƒ d
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } } d  S(   Ni   s   ==sL   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.source
})
} == %(py8)sRh   R   R9   R   R   R	   R1   R   s   assert %(py10)sRJ   (   s   ==(   sL   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.source
})
} == %(py8)ss   assert %(py10)s(   R0   Rh   R   R   R   R   R   R   R   R   R   (   R9   R   R   R^   R4   R   RN   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_len…   s    	     Ã   c         C   s.  g  |  j  D] } | ^ q
 } 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 s¹ t j | ƒ rÈ t j | ƒ n d d 6t j | ƒ d 6t j | ƒ d	 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   t   lR   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R0   Rh   R   R   R   R   R   R   R   R   R   (   R9   R   Rm   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt	   test_iterˆ   s        ³   (   R;   R<   R    R0   Ri   Rk   Rl   Rn   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRg   t   s   				t   TestSourceParsingAndCompilingc           B   sÑ   e  Z e d  ƒ j ƒ  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 e
 d „  ƒ Z d „  Z d „  Z d	 „  Z e j j j d
 ƒ d „  ƒ Z d „  Z e j j j d
 ƒ d „  ƒ Z d „  Z d „  Z d „  Z RS(   s^           def f(x):
            assert (x ==
                    3 +
                    4)
    c         B   sÂ   e  j j d ƒ } i  } | | U| d } d } | | k } | s° e j d | f d | | f ƒ i e j | ƒ d 6e j | ƒ d 6} d i | d
 6} e e j | ƒ ƒ ‚ n  d  } } } d  S(   Ns   x=3R   i   s   ==s   %(py1)s == %(py4)sR   R&   R   s   assert %(py6)sR
   (   s   ==(   s   %(py1)s == %(py4)ss   assert %(py6)s(	   R(   R)   R*   R   R   R   R   R   R   (   R9   R+   t   dt   @py_assert0R,   R   R-   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_compile”   s    
    E   c         B   s>  e  j j d ƒ } | d  Ue  j j | ƒ } e | ƒ } d } | | k } | s,e j d | f d | | f ƒ i d e j ƒ  k s’ e j	 e ƒ r¡ e j
 e ƒ n d d 6d e j ƒ  k sÉ e j	 | ƒ rØ e j
 | ƒ n d d 6e j
 | ƒ d 6e j
 | ƒ d	 6} d i | d 6} e e j | ƒ ƒ ‚ n  d  } } } d  S(   Ns   x=3s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R(   R)   R*   R    R   R   R   R   R   R   R   R   R   R   (   R9   R+   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt!   test_compile_and_getsource_simpleš   s        ³   c   
      C   s½  d „  } | d ƒ } | d ƒ } t  j 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	 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } t  j j j | ƒ }	 d } | |	 k } | s¯t j d | f d | |	 f ƒ i t j | ƒ d 6d t j ƒ  k slt j	 |	 ƒ r{t j |	 ƒ n d d	 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } d  S(   Nc         S   s   t  j j |  ƒ S(   N(   R(   R)   R*   (   R0   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt	   gensource¡   s    s?   
            def f():
                raise KeyError()
        sA   
            def f():
                raise ValueError()
        t   KeyErrorRU   s   %(py1)s in %(py3)sR   t   source1R	   R   s   assert %(py5)sR1   t
   ValueErrorRR   (   RU   (   s   %(py1)s in %(py3)ss   assert %(py5)s(   RU   (   s   %(py1)s in %(py3)ss   assert %(py5)s(   R(   t   stdt   inspectt	   getsourceR   R   R   R   R   R   R   R   R   (
   R9   Rt   t   co1t   co2Rv   Rq   R   Rj   R?   RR   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt0   test_compile_and_getsource_through_same_function    s*    			   l   
   l   c         C   sn  t  |  j d ƒ } xTt d d ƒ D]C} |  j j | ƒ } t  | ƒ } | | 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 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  } } q# Wd  S(   Ni   i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py5)sR   R   t   sR   R	   t   assR1   R   s   assert %(py7)sR2   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py5)ss   assert %(py7)s(   R   R0   t   ranget   getstatementR   R   R   R   R   R   R   R   R   (   R9   R   t   iR~   R   R   R?   R@   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getstatement°   s       Ú   c         C   s„  t  d ƒ } | j d ƒ } t | ƒ } | | k } | s<t j d | f d | | f ƒ i d t j ƒ  k s{ t j | ƒ rŠ t j | ƒ n d 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  } } | j d ƒ } t | ƒ } | | k } | svt j d | f d | | f ƒ i d t j ƒ  k sµt j | ƒ rÄt j | ƒ n d d 6d t j ƒ  k sìt j t ƒ rût j t ƒ n d d 6d	 t j ƒ  k s#t j | ƒ r2t j | ƒ n d	 d
 6t j | ƒ d 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } d  S(   Ns   hello('''
        ''')i    s   ==s0   %(py0)s == %(py5)s
{%(py5)s = %(py2)s(%(py3)s)
}R~   R   R   R%   R0   R	   R1   R   s   assert %(py7)sR2   i   (   s   ==(   s0   %(py0)s == %(py5)s
{%(py5)s = %(py2)s(%(py3)s)
}s   assert %(py7)s(   s   ==(   s0   %(py0)s == %(py5)s
{%(py5)s = %(py2)s(%(py3)s)
}s   assert %(py7)s(   R    R   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R~   R   R>   R?   R@   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt$   test_getstatementrange_triple_quoted¹   s$    	   Ú   
   Ú   c         C   sV  t  d ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sr 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
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d# i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d' i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d+ i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 d  S(,   Ns¶               try:
                try:
                    raise ValueError
                except SomeThing:
                    pass
            finally:
                42
        i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   R0   R   R	   R
   R   s   assert %(py8)sR   i   i   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)sR/   R%   R&   s   assert %(py11)sRa   i   i   i   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   i   i   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   i   i   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   i   i   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   i   i   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   R    Rh   R   R   R   R   R   R   R   R   R   t   getstatementrange(   R9   R0   R   R   R   R   R   R>   R,   R5   R^   R6   t   @py_format12(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt(   test_getstatementrange_within_constructsÂ   sd    	    ³   	      œ   	      œ   	      œ   	      œ   c         C   s,  t  d ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sr 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
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 d  S(   Ns…               try:
                x = (
                   y +
                   z)
            except:
                pass
        i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   R0   R   R	   R
   R   s   assert %(py8)sR   i   i   i   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)sR/   R%   R&   s   assert %(py11)sRa   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   i   i   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   R    Rh   R   R   R   R   R   R   R   R   R   R…   (   R9   R0   R   R   R   R   R   R>   R,   R5   R^   R6   R†   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getstatementrange_bug×   s(    	    ³   	      œ   c         C   s,  t  d ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sr 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
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } | j } d } | | ƒ } 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 6t j | ƒ d 6t j | ƒ d
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } }
 }	 d  S(   NsÃ               assert (
                33
                ==
                [
                  X(3,
                      b=1, c=2
                   ),
                ]
              )
        i	   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   R0   R   R	   R
   R   s   assert %(py8)sR   i   i    sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)sR/   R%   R&   s   assert %(py11)sRa   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   i    i	   (   s   ==(   sW   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.getstatementrange
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   R    Rh   R   R   R   R   R   R   R   R   R   R…   (   R9   R0   R   R   R   R   R   R>   R,   R5   R^   R6   R†   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getstatementrange_bug2ã   s(    
	    ³   	      œ   c   	      C   s´  t  d ƒ } d } t | | ƒ } | j } | j d d !} | | k } | sHt j d | f d | | f ƒ i d t j ƒ  k sŽ t j t ƒ r t j t ƒ n d d 6t j | ƒ d 6d	 t j ƒ  k sÕ t j | ƒ rä t j | ƒ n d	 d
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } } } d } t | | ƒ } | j } | j d 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 6t j | ƒ d 6d	 t j ƒ  k s't j | ƒ r6t j | ƒ n d	 d
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } } } d  S(   Ns…   
            def test_some():
                for a in [a for a in
                    CAUSE_ERROR]: pass

            x = 3
        i   i   s   ==sU   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py0)s(%(py2)s, %(py3)s)
}.lines
} == %(py10)sR   R   RJ   R0   R	   R1   R2   R%   R   s   assert %(py12)sRK   i   (   s   ==(   sU   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py0)s(%(py2)s, %(py3)s)
}.lines
} == %(py10)ss   assert %(py12)s(   s   ==(   sU   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py0)s(%(py2)s, %(py3)s)
}.lines
} == %(py10)ss   assert %(py12)s(   R    R   R=   R   R   R   R   R   R   R   R   R   (	   R9   R0   R>   R   R4   RM   R5   RN   RO   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt"   test_getstatementrange_ast_issue58ò   s,    	  	    Ó     	    Ó   s   sys.version_info < (2,6)c         C   sÖ   t  d ƒ } | j d ƒ } d } | | 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 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } d  S(   Ns-   if xxx:
   from .collections import somethingi   i   s   ==s   %(py0)s == %(py3)st   rR   R	   R   s   assert %(py5)sR1   (   i   i   (   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   R    R…   R   R   R   R   R   R   R   R   R   (   R9   R0   R‹   R   R>   Rj   R?   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt(   test_getstatementrange_out_of_bounds_py3þ   s       l   c            s,   t  d ƒ ‰  t j j t ‡  f d †  ƒ d  S(   Nt   :c              s   ˆ  j  d ƒ S(   Ni    (   R…   (    (   R0   (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   <lambda>  s    (   R    R(   RV   RW   RX   (   R9   (    (   R0   s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt.   test_getstatementrange_with_syntaxerror_issue7  s    c         C   sT  d d  l  } t d ƒ } | j d | j ƒ } | j } t | | ƒ } | s6d d i d t j ƒ  k sv t j	 t ƒ r… t j
 t ƒ n d d 6d t j ƒ  k s­ t j	 | ƒ r¼ t j
 | ƒ n d d	 6d
 t j ƒ  k sä t j	 | ƒ ró t j
 | ƒ n d
 d 6t j
 | ƒ d 6t j
 | ƒ d 6} t t j | ƒ ƒ ‚ n  d  } } t | d d ƒ d  S(   Niÿÿÿÿs   x = 4t   flagR   sQ   assert %(py6)s
{%(py6)s = %(py0)s(%(py1)s, %(py4)s
{%(py4)s = %(py2)s.Module
})
}R"   R   t   modR   t   astR%   R&   R
   s
   <filename>t   exec(   R’   R    R*   t   PyCF_ONLY_ASTt   ModuleR"   R   R   R   R   R   R   R   R   (   R9   R’   R0   R‘   R,   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_compile_to_ast  s    	   Ó  
c         C   s½  |  j  j ƒ  } t j j | t ƒ  ƒ t d ƒ t j j t	 d ƒ } | j
 d j } | j j j | j ƒ } t | ƒ } | j } | ƒ  } | j } d }	 | |	 ƒ }
 |
 sŸd d i t j | ƒ d 6t 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 6t j | ƒ d 6t j | ƒ d 6t j |
 ƒ d 6} t	 t j | ƒ ƒ ‚ n  d  } } } } }	 }
 d  S(   Ni   s   f(6)iÿÿÿÿt   assertR   sŸ   assert %(py13)s
{%(py13)s = %(py9)s
{%(py9)s = %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
}.startswith
}(%(py11)s)
}R/   Ra   R   R   t   stmtR   R	   R1   R2   t   py13(   R0   R*   R(   t   builtint   exec_t   globalsRE   RV   RW   R   t	   tracebackt   frameR)   t
   fullsourceR   RZ   R   RL   R3   R   R   R   R   R   R   R   (   R9   R+   t   excinfoRž   R˜   R   R   R4   R5   Rd   Re   t   @py_format14(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_compile_and_getsource  s     
 	 	 	    Ü  c         #   s…   ‡  ‡ ‡ f d †  } t  j j ˆ j ƒ } | j ‰  | j ‰ xB t  j j t  j j j f D]% } x d D] } | | | f Vqe WqX Wd  S(   Nc            s4  |  ˆ j  | ƒ } | s3 d ˆ ˆ  d d f } n d | ˆ ˆ  d d f } | j } | j } | | ƒ } | s&d d 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 6t j | ƒ d 6} t t j	 | ƒ ƒ ‚ n  d  } } d  S(   Ns   codegen %s:%d>i   i   s   codegen %r %s:%d>R   sJ   assert %(py5)s
{%(py5)s = %(py2)s
{%(py2)s = %(py0)s.endswith
}(%(py3)s)
}t   fnR   R%   t   expectedR	   R1   (   R0   t   co_filenamet   endswithR   R   R   R   R   R   R   R   (   t   compt   nameR+   R¤   R£   R>   R   R?   (   t   mylinenot   mypathR9   (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   check  s    		   œ  R   t   my(   R   NR¬   (	   R(   R)   t   Codet!   test_compilefuncs_and_path_sanityt   firstlinenot   pathR*   R    R   (   R9   R«   t   mycodeR§   R¨   (    (   R©   Rª   R9   s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR®     s    			"c         C   s&   t  j j t t  j j d d d ƒd  S(   Ns   lambda a,a: 0R    R!   (   R(   RV   RW   RX   R)   R*   (   R9   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_offsetless_synerr,  s    (   R;   R<   R    RL   R0   Rr   Rs   R}   Rƒ   R„   t   astonlyR‡   Rˆ   R‰   RŠ   R(   RV   t   markt   skipifRŒ   R   R–   R¢   R®   R²   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRo   Œ   s"   												
	c    	      C   s_  d d d „  ƒ  Y}  |  d d ƒ } g  | j  j D] } | j ƒ  r/ | ^ q/ } t | ƒ } d } | | k } | sM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 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } d  S(   Nt   Ac           B   s   e  Z d  „  Z RS(   c         W   s+   t  j d ƒ } t j j | ƒ j |  _ d  S(   Ni   (   t   syst	   _getframeR(   R)   t   Framet	   statementR0   (   R9   t   argsRž   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   __init__1  s    (   R;   R<   R¼   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR¶   0  s   R   t   yi   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   Rm   R   R	   R
   R   s   assert %(py8)sR   (    (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R0   R=   RL   Rh   R   R   R   R   R   R   R   R   R   (	   R¶   R   R‚   Rm   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt    test_getstartingblock_singleline/  s    +    ³   c    	      C   sb  d d d „  ƒ  Y}  |  d d d ƒ } g  | j  j D] } | j ƒ  r2 | ^ q2 } t | ƒ } d } | | k } | sP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 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d  } } } d  S(   NR¶   c           B   s   e  Z d  „  Z RS(   c         W   s+   t  j d ƒ } t j j | ƒ j |  _ d  S(   Ni   (   R·   R¸   R(   R)   R¹   Rº   R0   (   R9   R»   Rž   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR¼   <  s    (   R;   R<   R¼   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR¶   ;  s   R   R½   t   zi   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sRh   R   Rm   R   R	   R
   R   s   assert %(py8)sR   (    (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R0   R=   RL   Rh   R   R   R   R   R   R   R   R   R   (	   R¶   R   R‚   Rm   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getstartingblock_multiline:  s    	+    ³   c    
      C   sz  d „  }  t  j j t d ƒ } | j d j } t | ƒ } | j } | ƒ  } 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 sÝ t j | ƒ rì t j | ƒ n d	 d
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d  } } } } } d  S(   Nc           S   s   d  S(   N(    (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRB   I  s    s•   
           teardown = None
           try:
                c(1)
           finally:
                if teardown:
                    teardown()
    iÿÿÿÿs   c(1)s   ==sc   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
} == %(py10)sR   R   R0   R   RJ   R	   R1   R2   R   s   assert %(py12)sRK   (   s   ==(   sc   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
} == %(py10)ss   assert %(py12)s(   R(   RV   RW   t	   TypeErrorR   Rº   R   RL   R   R   R   R   R   R   R   R   R   (
   RB   R    R0   R   R   R4   RM   R5   RN   RO   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getline_finallyH  s    		 	 	    Ó   c          C   sú  d }  t  j j |  ƒ } t  j j | t ƒ  ƒ t  j } | j } | t ƒ } t | ƒ } | j	 } | ƒ  } d } | | k }	 |	 rðt
 j d f |	 f d f | | f ƒ i
 t
 j | ƒ d 6d t j ƒ  k pØ t
 j t ƒ rê t
 j t ƒ n d d 6d t j ƒ  k pt
 j t  ƒ r!t
 j t  ƒ n d d	 6t
 j | ƒ d
 6t
 j | ƒ d 6t
 j | ƒ d 6d t j ƒ  k pvt
 j t ƒ rˆt
 j t ƒ n d d 6t
 j | ƒ d 6t
 j | ƒ d 6t
 j | ƒ d 6}
 d d i |
 d 6} t t
 j | ƒ ƒ ‚ n  t } } } } } } }	 } t  j } | j } | t ƒ } t | ƒ } | j	 } | ƒ  } d } | | k }	 |	 rÔt
 j d f |	 f d f | | f ƒ i
 t
 j | ƒ d 6d t j ƒ  k p¼t
 j t ƒ rÎt
 j t ƒ n d d 6d t j ƒ  k pót
 j t  ƒ rt
 j t  ƒ n d d	 6t
 j | ƒ d
 6t
 j | ƒ d 6t
 j | ƒ d 6d t j ƒ  k pZt
 j t ƒ rlt
 j t ƒ n d d 6t
 j | ƒ d 6t
 j | ƒ d 6t
 j | ƒ d 6}
 d d i |
 d 6} t t
 j | ƒ ƒ ‚ n  t } } } } } } }	 } d  S(   NsJ   
        def f():
            raise ValueError

        def g(): pass
    s   def f():
    raise ValueErrors   ==s½   %(py14)s
{%(py14)s = %(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py0)s(%(py8)s
{%(py8)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.code
}.Source
}(%(py6)s)
})
}.strip
}()
} == %(py17)sR   R   R   R(   R   RJ   R	   R1   RE   R
   t   py17RK   t   py14R   s   assert %(py19)st   py19s   def g(): passt   g(   R(   R)   R*   Rš   R›   Rœ   R    RE   R   RL   R   R   R   R   R   R   R   R   R   RÆ   (   R0   R+   R   R   R^   RM   t   @py_assert11t   @py_assert13t   @py_assert16t   @py_assert15t   @py_format18t   @py_format20(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getfuncsource_dynamicU  s>    	 	   	 	    ÿ A   "	 	   	 	    ÿ A   c          C   sñ  d „  }  t  j } | j } | |  ƒ } t | ƒ } | j } | ƒ  } d } | | k } | rËt j d f | f d f | | f ƒ i
 t j | ƒ d 6d t j	 ƒ  k p³ t j
 t ƒ rÅ t j t ƒ n d d 6d t j	 ƒ  k pê t j
 t  ƒ rü t j t  ƒ n d d	 6t j | ƒ d
 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pQt j
 |  ƒ rct j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6}	 d d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  t } } } } } } } } d  S(   Nc          S   s
   d }  d  S(   Ns   while True:
    pass
(    (   RB   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRE   c  s    s,   def f():
    c = '''while True:
    pass
'''s   ==s½   %(py14)s
{%(py14)s = %(py12)s
{%(py12)s = %(py10)s
{%(py10)s = %(py0)s(%(py8)s
{%(py8)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.code
}.Source
}(%(py6)s)
})
}.strip
}()
} == %(py17)sR   R   R   R(   R   RJ   R	   R1   RE   R
   RÃ   RK   RÄ   R   s   assert %(py19)sRÅ   (   R(   R)   R    R   RL   R   R   R   R   R   R   R   R   R   (   RE   R   R   R^   RM   RÇ   RÈ   RÉ   RÊ   RË   RÌ   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt&   test_getfuncsource_with_multine_stringb  s    		 	   	 	    ÿ A   c          C   sâ  d d l  m }  d d g } |  | ƒ } d 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 6t j | ƒ d 6} d! i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } } d „  } d d  l } |  | j | ƒ j ƒ  ƒ }	 d d d 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 6} d$ i | d 6} t t j	 | ƒ ƒ ‚ n  d  } }
 d } |  | j ƒ  ƒ }	 d d d d 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 6} d' i | d 6} t t j	 | ƒ ƒ ‚ n  d  } }
 d  S((   Niÿÿÿÿ(   RF   s   	foos   	bart   foot   bars   ==s0   %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)sRF   R   R%   R&   R2   R   s   assert %(py9)sR/   c          S   s
   d }  d  S(   Ns   while True:
    pass
(    (   RB   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRE   n  s    s   def f():s       c = '''while True:s       passs   '''s   %(py0)s == %(py3)sR=   R	   s   assert %(py5)sR1   s@   
        def f():
            def g():
                pass
    s       def g():s           passs       (   s   ==(   s0   %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)ss   assert %(py9)s(   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   t   py._code.sourceRF   R   R   R   R   R   R   R   R   R   Ry   Rz   t
   splitlines(   RF   R>   R,   R4   R   R@   R6   RE   Ry   R=   R   Rj   R?   R0   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_deindentj  s:         Œ   	   l   
   l   sI   sys.version_info[:3] < (2,7,0) or ((3,0) <= sys.version_info[:2] < (3,2))c         C   sW  t  j j d ƒ } |  j d ƒ } | j | ƒ t  j j |  j d ƒ j ƒ  j ƒ } t | ƒ } | j } | ƒ  } t | ƒ } | j } | ƒ  }	 | |	 k }
 |
 r5t	 j
 d f |
 f d f | |	 f ƒ i
 d t j ƒ  k pæ t	 j t ƒ rø t	 j t ƒ n d d 6d t j ƒ  k pt	 j t ƒ r/t	 j t ƒ n d d 6d t j ƒ  k pTt	 j | ƒ rft	 j | ƒ n d d	 6d
 t j ƒ  k p‹t	 j | ƒ rt	 j | ƒ n d
 d 6t	 j | ƒ d 6t	 j |	 ƒ d 6t	 j | ƒ d 6t	 j | ƒ d 6t	 j | ƒ d 6t	 j | ƒ d 6} d d i | d 6} t t	 j | ƒ ƒ ‚ n  t } } } }
 } } }	 d  S(   NsR   
        class A(object):
            def method(self):
                x = 1
    s   a.pys   ==s¹   %(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
}.strip
}()
} == %(py16)s
{%(py16)s = %(py14)s
{%(py14)s = %(py12)s
{%(py12)s = %(py9)s(%(py10)s)
}.strip
}()
}R   R/   R   R0   R   t   s2RJ   R	   t   py16R1   RÄ   R2   RK   R   s   assert %(py18)st   py18(   R(   R)   R    t   joint   writet   pyimportR¶   R   RL   R   R   R   R   R   R   R   R   R   (   t   tmpdirR0   R°   RÔ   R   R   R4   RÇ   RÈ   RÊ   R5   t   @py_format17t   @py_format19(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt+   test_source_of_class_at_eof_without_newline~  s$    		$ 	 	  	 	   ÿ h   c           C   s   d  S(   N(    (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR   Ž  s    c          C   sú   d d l  m }  d } |  t ƒ } | | k } | sð t j d | f d | | f ƒ i d t j ƒ  k sv 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  } d  S(   Niÿÿÿÿ(   Rz   s   def x():
    passs   ==s   %(py0)s == %(py2)st   srcR   R¤   R%   R   s   assert %(py4)sR&   (   s   ==(   s   %(py0)s == %(py2)ss   assert %(py4)s(   RÑ   Rz   R   R   R   R   R   R   R   R   R   R   (   Rz   R¤   RÞ   R>   t   @py_format3R-   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getsource_fallback‘  s      “   c          C   s  d d l  m }  d } t j j | ƒ } |  | ƒ } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sˆ 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  } d  S(   Niÿÿÿÿ(   Rz   s   def x(): passs   ==s   %(py0)s == %(py2)sRÞ   R   R¤   R%   R   s   assert %(py4)sR&   (   s   ==(   s   %(py0)s == %(py2)ss   assert %(py4)s(   RÑ   Rz   R(   R)   R*   R   R   R   R   R   R   R   R   R   (   Rz   R¤   R+   RÞ   R>   Rß   R-   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_idem_compile_and_getsource˜  s      “   c    
      C   sÒ  d d l  m }  |  t ƒ \ } } 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 } | | k } | sÀ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(   Niÿÿÿÿ(   t
   findsourcet   test_findsource_simpleRU   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}R   R   R	   RÞ   R&   R
   R   s   assert %(py8)sR   s       def x():s   ==s   %(py1)s == %(py4)ss   assert %(py6)s(   RU   (   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}s   assert %(py8)s(   s   ==(   s   %(py1)s == %(py4)ss   assert %(py6)s(   RÑ   Râ   R   R   R   R   R   R   R   R   R   R   R   (
   Râ   RÞ   RZ   Rq   R   R   R   R   R,   R-   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_findsource_fallbackŸ  s$        ³   
    E   c          C   s  d d l  m }  t j j d ƒ } |  | ƒ \ } } d } t | ƒ } | | k } | s4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  } } } i  }	 t | |	 ƒ |  |	 d ƒ \ } } d } t | ƒ } | | k } | sk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 }
 | |
 k } | s	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(   Niÿÿÿÿ(   Râ   s    if 1:
    def x():
        pass
s   if 1:RU   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}R   R   R	   RÞ   R&   R
   R   s   assert %(py8)sR   R   s       def x():s   ==s   %(py1)s == %(py4)ss   assert %(py6)s(   RU   (   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}s   assert %(py8)s(   RU   (   s0   %(py1)s in %(py6)s
{%(py6)s = %(py3)s(%(py4)s)
}s   assert %(py8)s(   s   ==(   s   %(py1)s == %(py4)ss   assert %(py6)s(   RÑ   Râ   R(   R)   R*   R   R   R   R   R   R   R   R   R   R   R!   (   Râ   R+   RÞ   RZ   Rq   R   R   R   R   Rp   R,   R-   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_findsource¥  s>    		    ³       ³   
    E   c          C   s‘  d d l  m }  d „  } |  | ƒ \ } } | j } d } | | k } | rü t j d f | f d f | | f ƒ i d t j ƒ  k p’ t j | ƒ r¤ t j | ƒ n d d 6t j | ƒ d	 6t j | ƒ d
 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } t j } | j }	 |	 | ƒ }
 |
 j } d } | | } | | k } | r¡t j d f | f d f | | f ƒ i t j |
 ƒ d 6d t j ƒ  k p©t j | ƒ r»t j | ƒ n d d 6t j | ƒ d 6d t j ƒ  k pðt j t ƒ rt j t ƒ n d d	 6t j | ƒ d 6t j | ƒ d 6t j |	 ƒ d 6d t j ƒ  k pWt j | ƒ rit j | ƒ n d d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } }	 }
 } } } d t f d „  ƒ  Y} |  | ƒ \ } } t j j j | ƒ \ } } | j } d } | | k } | rÓt j d f | f d f | | f ƒ i d t j ƒ  k pit j | ƒ r{t j | ƒ n d d 6t j | ƒ d	 6t j | ƒ d
 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } | | k } | rºt j d f | f d f | | f ƒ i d t j ƒ  k p9t j | ƒ rKt j | ƒ n d d 6d t j ƒ  k ppt j | ƒ r‚t j | ƒ n d d	 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } d } |  | ƒ } d d f } | | k }	 |	 r°t j d f |	 f d  f | | f ƒ i d! t j ƒ  k p6t j |  ƒ rHt j |  ƒ n d! d 6t j | ƒ d	 6t j | ƒ d 6t j | ƒ d 6} d d" i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } }	 } d# f  d$ „  ƒ  Y} d% | _ |  | ƒ d } d } | | k } | rt j d f | f d& f | | f ƒ i t j | ƒ d' 6t j | ƒ d 6} d d( i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } d  S()   Niÿÿÿÿ(   t   getfslinenoc         S   s   d  S(   N(    (   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRE   ¹  s    s   test_source.pys   ==s0   %(py2)s
{%(py2)s = %(py0)s.basename
} == %(py5)st   fspathR   R%   R1   R   s   assert %(py7)sR2   i   s   %(py0)s == (%(py11)s
{%(py11)s = %(py9)s
{%(py9)s = %(py6)s
{%(py6)s = %(py4)s
{%(py4)s = %(py2)s.code
}.getrawcode
}(%(py7)s)
}.co_firstlineno
} - %(py13)s)R/   RZ   R™   R(   Ra   R&   R
   RE   s   assert %(py16)sRÕ   R¶   c           B   s   e  Z RS(    (   R;   R<   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR¶   Á  s   s   %(py0)s == %(py2)st   A_linenos   assert %(py4)si   s0   %(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)sRæ   s   assert %(py9)st   Bc           B   s   e  Z RS(    (   R;   R<   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRé   Ë  s   t   B2s   %(py1)s == %(py4)sR   s   assert %(py6)s(   t   py.codeRæ   t   basenameR   R   R   R   R   R   R   R   R   R(   R)   t
   getrawcodet   co_firstlinenot   objectRx   Ry   Râ   R;   (   Ræ   RE   Rç   RZ   R>   R   R,   R?   R@   R   R5   Rd   Re   t   @py_assert14t   @py_format15RÛ   R¶   t   _Rè   Rß   R-   R4   R6   Ré   Rq   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_getfslineno¶  sx    		    ‚   	 	  	  
   ÿ !   	    ‚     ™        ’   	    K   c    	         sÕ  d d d „  ƒ  Y‰  t  j j t ‡  f d †  ƒ d d d „  ƒ  Y}  t  j j |  ƒ  ƒ } d } | j } | ƒ  } t | ƒ } | | k } | s‰t j	 d | f d | | f ƒ i t j
 | ƒ d	 6t j
 | ƒ d
 6t j
 | ƒ d 6d t j ƒ  k sÿ t j t ƒ rt j
 t ƒ n d d 6d t j ƒ  k s6t j | ƒ rEt j
 | ƒ n d d 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d  } } } } } d t f d „  ƒ  Y‰ t  j j t ‡ f d †  ƒ d  S(   NR¶   c           B   s   e  Z RS(    (   R;   R<   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR¶   Ñ  s   c              s   t  j j ˆ  ƒ  ƒ S(   N(   R(   R)   R    (    (   R¶   (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRŽ   Ó  s    t   WithCallc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   R9   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   __call__Õ  s    (   R;   R<   Rõ   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRô   Ô  s   t   passRU   se   %(py1)s in %(py10)s
{%(py10)s = %(py3)s(%(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.source
}()
})
}R   R   RJ   R   R	   R)   R&   R
   R   s   assert %(py12)sRK   t   Helloc           B   s   e  Z d  „  Z RS(   c         S   s   d  S(   N(    (   R9   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRõ   Ü  s    (   R;   R<   Rõ   (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR÷   Û  s   c              s   t  j j ˆ  ƒ S(   N(   R(   R)   R­   (    (   R÷   (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyRŽ   Þ  s    (    (    (   RU   (   se   %(py1)s in %(py10)s
{%(py10)s = %(py3)s(%(py8)s
{%(py8)s = %(py6)s
{%(py6)s = %(py4)s.source
}()
})
}s   assert %(py12)s(   R(   RV   RW   RÁ   R)   R­   R0   R   R   R   R   R   R   R   R   R   R   Rï   (	   Rô   R)   Rq   R   R^   RM   R   RN   RO   (    (   R¶   R÷   s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt&   test_code_of_object_instance_with_callÐ  s      	 	    Ó   c         C   sK   d d l  m } t j j | d t ƒ} | |  | ƒ \ } } } | | | !S(   Niÿÿÿÿ(   t   getstatementrange_astRF   (   RÑ   Rù   R(   R)   R    R   (   RZ   R0   Rù   R’   t   startt   end(    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR   á  s    c          C   s!  t  d d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k su 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
 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni    s   raise ValueErrors   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_onelineç  s        ³   c    	      C   sø   d d l  m }  t d d d g ƒ } |  d | ƒ \ } } } 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 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } d  S(   Niÿÿÿÿ(   Rù   s   def test_basic_complex():s       assert 1 == 2s#   # vim: filetype=pyopencl:fdm=markeri   i   s   ==s   %(py0)s == %(py3)sRû   R   R	   R   s   assert %(py5)sR1   (   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   RÑ   Rù   R    R   R   R   R   R   R   R   R   R   (	   Rù   R0   R’   Rú   Rû   R   R>   Rj   R?   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt"   test_comment_and_no_newline_at_endë  s       l   c          C   s!  t  d d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k su 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 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni    s   raise ValueError
#hellos   raise ValueErrors   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_oneline_and_commentó  s        ³   c          C   s  d }  xÁt  d d ƒ D]°} t | |  ƒ } t | ƒ } d } | | k } | r´t j d f | f d f | | f ƒ i d t j ƒ  k p• t j t ƒ r§ t j t ƒ n d d 6d	 t j ƒ  k pÌ t j t ƒ rÞ t j t ƒ n d	 d
 6d t j ƒ  k pt j | ƒ rt j | ƒ n d d 6d t j ƒ  k p:t j |  ƒ rLt j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } } q WxÁt  d d ƒ D]°} t | |  ƒ } t | ƒ } d } | | k } | rxt j d f | f d f | | f ƒ i d t j ƒ  k pYt j t ƒ rkt j t ƒ n d d 6d	 t j ƒ  k pt j t ƒ r¢t j t ƒ n d	 d
 6d t j ƒ  k pÇt j | ƒ rÙt j | ƒ n d d 6d t j ƒ  k pþt j |  ƒ rt j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } } qÚWd } t | |  ƒ }	 t |	 ƒ }
 d } |
 | k } | rt j d f | f d f |
 | f ƒ i t j |
 ƒ d 6t j | ƒ d 6d t j ƒ  k p-t j t ƒ r?t j t ƒ n d d 6d	 t j ƒ  k pdt j t ƒ rvt j t ƒ n d	 d
 6t j | ƒ d 6d t j ƒ  k p«t j |  ƒ r½t j |  ƒ n d d 6t j |	 ƒ d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } }	 }
 } } d  S(   Nsm   def test():
    "comment 1"
    x = 1
      # comment 2
    # comment 3

    assert False

"""
comment 4
"""
i   i   s	       x = 1s   ==sX   %(py7)s
{%(py7)s = %(py0)s(%(py5)s
{%(py5)s = %(py1)s(%(py2)s, %(py3)s)
})
} == %(py10)sR   R   R   R   t   lineR%   R0   R	   R1   R2   RJ   R   s   assert %(py12)sRK   i
   s       assert Falses   """sX   %(py8)s
{%(py8)s = %(py0)s(%(py6)s
{%(py6)s = %(py1)s(%(py3)s, %(py4)s)
})
} == %(py11)sR   Ra   R&   R
   s   assert %(py13)sR™   (   R€   R   R   R   R   R   R   R   R   R   R   R   (   R0   Rÿ   R   R4   RM   R5   RN   RO   R   R   R^   Rd   R†   R¡   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_comments÷  sD         ÿ 8        ÿ 8         ÿ    c          C   sÎ  d }  xÁt  d d ƒ D]°} t | |  ƒ } t | ƒ } d } | | k } | r´t j d f | f d f | | f ƒ i d t j ƒ  k p• t j t ƒ r§ t j t ƒ n d d 6d	 t j ƒ  k pÌ t j t ƒ rÞ t j t ƒ n d	 d
 6d t j ƒ  k pt j | ƒ rt j | ƒ n d d 6d t j ƒ  k p:t j |  ƒ rLt j |  ƒ n d d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } } q Wd  S(   Ns'   test(foo=1,
    # comment 1
    bar=2)
i   i   s&   test(foo=1,
    # comment 1
    bar=2)s   ==sX   %(py7)s
{%(py7)s = %(py0)s(%(py5)s
{%(py5)s = %(py1)s(%(py2)s, %(py3)s)
})
} == %(py10)sR   R   R   R   Rÿ   R%   R0   R	   R1   R2   RJ   R   s   assert %(py12)sRK   (   R€   R   R   R   R   R   R   R   R   R   R   R   (   R0   Rÿ   R   R4   RM   R5   RN   RO   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_comment_in_statement
  s         ÿ 8   c          C   s!  t  d d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k su 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 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   if False: 2
else: 3s   else: 3s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_single_line_else  s        ³   c          C   s!  t  d d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k su 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 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   try: 1
finally: 3s
   finally: 3s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_single_line_finally  s        ³   c          C   s'  d }  t  d |  ƒ } 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 s² t j | ƒ rÁ t j | ƒ n d d	 6t j | ƒ d
 6t j | ƒ d 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   NsN   def round_trip(dinp):
  assert 1 == dinp
def test_rt():
  round_trip("""
""")
i   s     round_trip("""
""")s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R~   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R~   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_issue55  s        ³   c          C   s!  t  d d ƒ }  t |  ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k su 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 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ni    s!   raise ValueError(
    23
)
x = 3
s   raise ValueError(
    23
)s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   XXXtest_multiline"  s    	    ³   t   TestTryc           B   s8   e  Z e Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s_   try:
    raise ValueError
except Something:
    raise IndexError(1)
else:
    raise KeyError()
c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s       raise ValueErrors   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt	   test_body6  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   except Something:s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_except_line:  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s       raise IndexError(1)s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_except_body>  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s       raise KeyError()s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt	   test_elseB  s        ³   (	   R;   R<   R³   t
   pytestmarkR0   R  R  R	  R
  (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR  +  s   			t   TestTryFinallyc           B   s    e  Z d  Z d „  Z d „  Z RS(   s;   try:
    raise ValueError
finally:
    raise IndexError(1)
c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s       raise ValueErrors   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR  N  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s       raise IndexError(1)s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_finallyR  s        ³   (   R;   R<   R0   R  R  (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR  F  s   	t   TestIfc           B   s8   e  Z e Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s6   if 1:
    y = 3
elif False:
    y = 5
else:
    y = 7
c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s	       y = 3s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR  c  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s   elif False:s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_elif_clauseg  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s	       y = 5s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt	   test_elifk  s        ³   c         C   s$  t  d |  j ƒ } t | ƒ } d } | | k } | st j d | f d | | f ƒ i d t j ƒ  k sx 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
 6} d i | d 6} t	 t j
 | ƒ ƒ ‚ n  d  } } } d  S(   Ni   s	       y = 7s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R0   R   R   R   R   R   R   R   R   R   R   (   R9   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR
  o  s        ³   (	   R;   R<   R³   R  R0   R  R  R  R
  (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyR  X  s   			c          C   s‰  d }  t  d |  ƒ } t | ƒ } |  j } | ƒ  } | | k } | rst j d f | f d f | | f ƒ i t j | ƒ d 6d t j ƒ  k p› t j t ƒ r­ t j t ƒ n d d 6d t j ƒ  k pÒ t j | ƒ rä t j | ƒ n d d	 6t j | ƒ d
 6d t j ƒ  k pt j |  ƒ r+t j |  ƒ n d d 6t j | ƒ d 6} d d i | d 6} t	 t j
 | ƒ ƒ ‚ n  t } } } } d  S(   Ns   hello ; pytest.skip()
i    s   ==sb   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py9)s
{%(py9)s = %(py7)s
{%(py7)s = %(py5)s.strip
}()
}R/   R   R   R0   R   R	   R~   R1   R2   R   s   assert %(py11)sRa   (   R   R   RL   R   R   R   R   R   R   R   R   R   (   R~   R0   R   R4   R5   R   R6   R†   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_semicolons  s     	 	   ÿ    c          C   s'  d }  t  d |  ƒ } 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 s² t j | ƒ rÁ t j | ƒ n d d	 6t j | ƒ d
 6t j | ƒ d 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ns<   def func(): raise ValueError(42)

def something():
    pass
i    s    def func(): raise ValueError(42)s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   R0   R   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R~   R0   R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   test_def_onlinez  s        ³   c          C   s'  d }  t  d |  ƒ } 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 s² t j | ƒ rÁ t j | ƒ n d d	 6t j | ƒ d
 6t j | ƒ d 6} d i | d 6} t t j	 | ƒ ƒ ‚ n  d  } } } d  S(   Ns   something
'''
'''i   s   '''
'''s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   R   t   resultR   R	   R
   R   s   assert %(py8)sR   (   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   R   R   R   R   R   R   R   R   R   R   (   R0   R  R   R   R   R   R   (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   XXX_test_expression_multiline„  s        ³   (    (    (    (    (    (@   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   Rë   R    R(   R·   RÑ   R   R   RV   R´   t   nothingR³   t   xfailt   failsonjythonR   R.   R7   RA   RD   RG   RI   RP   RQ   RS   R_   Rf   Rg   Ro   R¾   RÀ   RÂ   RÍ   RÎ   RÓ   RÝ   R   R   Rà   Rá   Rä   Rå   Ró   Rø   R   Rü   Rý   Rþ   R   R  R  R  R  R  R  R  R  R  R  R  (    (    (    s>   /home/ronny/Projects/pytest-dev/py/testing/code/test_source.pyt   <module>   sl     												£																										
