ó
ŸÌ1Y  c           @   s   d  d l  Z d  d l j j Z d  d l m Z d Z d e	 f d „  ƒ  YZ
 d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d S(   iÿÿÿÿN(   t   printouts	   some/patht   MockDirobjectc           B   s   e  Z d  „  Z RS(   c         C   s   t  |  _ d  S(   N(   t   EXAMPLE_PATHt   path(   t   self(    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt   __init__    s    (   t   __name__t
   __module__R   (    (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyR      s   c   
      C   sî  t  j ƒ  } | j d ƒ |  j ƒ  \ } } | j d ƒ } | d } t  j } | | 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 6t j | ƒ d	 6} d i | d 6}	 t t j |	 ƒ ƒ ‚ n  d } } } | d } t  j } | | k } | sÜt j d | f d | | f ƒ i d t j	 ƒ  k sy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 } } } d S(   s<   Does the first print section begin and end with break lines?s   line of text
s   
i    s   ==s-   %(py1)s == %(py5)s
{%(py5)s = %(py3)s.BREAK
}R    t   py3t   py1t   py5t    s   assert %(py7)st   py7iþÿÿÿN(   s   ==(   s-   %(py1)s == %(py5)s
{%(py5)s = %(py3)s.BREAK
}s   assert %(py7)s(   s   ==(   s-   %(py1)s == %(py5)s
{%(py5)s = %(py3)s.BREAK
}s   assert %(py7)s(   R    t   Printert   print_sectiont
   readouterrt   splitt   BREAKt
   @pytest_art   _call_reprcomparet   @py_builtinst   localst   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   None(
   t   capsyst   printert   outt   errt   linest   @py_assert0t   @py_assert4t   @py_assert2t   @py_format6t   @py_format8(    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt    test_printer_print_section_first(   s(    
 	   |   
 	   |   c         C   s“  t  j ƒ  } | j d ƒ | j d ƒ |  j ƒ  \ } } | j d ƒ } | j } t  j } | | ƒ } d } | | k }	 |	 sy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 S(   s-   Printing 2 sections should result in 3 breakss   line of text
s   line in a new section
s   
i   s   ==sg   %(py7)s
{%(py7)s = %(py2)s
{%(py2)s = %(py0)s.count
}(%(py5)s
{%(py5)s = %(py3)s.BREAK
})
} == %(py10)sR    R   t   py2R   t   py0R   R
   t   py10R   s   assert %(py12)st   py12N(   s   ==(   sg   %(py7)s
{%(py7)s = %(py2)s
{%(py2)s = %(py0)s.count
}(%(py5)s
{%(py5)s = %(py3)s.BREAK
})
} == %(py10)ss   assert %(py12)s(   R    R   R   R   R   t   countR   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   t   @py_assert1R!   t   @py_assert6t   @py_assert9t   @py_assert8t   @py_format11t   @py_format13(    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt   test_printer_print_section_last3   s    	 	     Ó   c          C   s?  t  j ƒ  }  |  j } |  j d ƒ |  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 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(   s)   Printing a section bumps the item counters   line of text
i   s   ==s9   %(py2)s
{%(py2)s = %(py0)s.count
} == (%(py4)s + %(py6)s)R&   R   R'   t   py6R*   t   py4R   s   assert %(py9)st   py9N(   s   ==(   s9   %(py2)s
{%(py2)s = %(py0)s.count
} == (%(py4)s + %(py6)s)s   assert %(py9)s(   R    R   R*   R   R   R   R   R   R   R   R   R   R   (   R   R*   R+   t   @py_assert5t   @py_assert7t   @py_assert3R$   t   @py_format10(    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt   test_printer_counts@   s    		  
   ³   c          C   sÙ  t  j ƒ  }  d d g } |  j t ƒ  | ƒ |  j } t | ƒ } t | ƒ } | | 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 6d t	 j
 ƒ  k pë t j t ƒ rý t j t ƒ n d d	 6d t	 j
 ƒ  k p"t j t ƒ r4t j t ƒ n d d
 6t j | ƒ d 6d t	 j
 ƒ  k pit j | ƒ r{t j | ƒ n d d 6t j | ƒ d 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t } } } } d S(   s2   Adding a initial report item does what is expecteds   one itemt   anothers   ==sr   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.report_items
})
} == %(py10)s
{%(py10)s = %(py7)s(%(py8)s)
}R   R   R	   t   lenR'   R   R
   t   datat   py8R(   R   s   assert %(py12)sR)   N(   R    R   t   add_report_itemsR   t   report_itemsR;   R   R   R   R   R   R   R   R   R   (   R   R<   R"   R!   R-   R,   R/   R0   (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt%   test_printer_add_report_items_initialJ   s    	     ÿ 8   c    	      C   sy  t  j ƒ  }  t ƒ  } d d g } |  j | | ƒ d g } |  j | | ƒ |  j } t | ƒ } d } | | k } | sct j d | f d | | f ƒ i t j | ƒ 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 6t j | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d } } } } d S(   s1   Adding a second report item does what is expecteds   one itemR:   t   thirdi   s   ==sR   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.report_items
})
} == %(py8)sR   R   R	   R;   R'   R=   R
   R   s   assert %(py10)sR(   N(   s   ==(   sR   %(py5)s
{%(py5)s = %(py0)s(%(py3)s
{%(py3)s = %(py1)s.report_items
})
} == %(py8)ss   assert %(py10)s(   R    R   R   R>   R?   R;   R   R   R   R   R   R   R   R   R   (	   R   t   dirR<   R"   R!   R6   R,   t   @py_format9R/   (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt$   test_printer_add_report_items_secondR   s    			     Ã   c          C   s$  t  j t d g ƒ ƒ }  d d d g } |  j t ƒ  | ƒ |  j } t d f t d f g } | | 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	 6} d i | d 6} t t j | ƒ ƒ ‚ n  d } } } d S(   s.   Stock parens are filtered out of parens added.t   ignoreds   one itemR:   s   ==s4   %(py2)s
{%(py2)s = %(py0)s.report_items
} == %(py5)sR&   R   R'   R
   R   s   assert %(py7)sR   N(   s   ==(   s4   %(py2)s
{%(py2)s = %(py0)s.report_items
} == %(py5)ss   assert %(py7)s(   R    R   t   setR>   R   R?   R   R   R   R   R   R   R   R   R   R   (   R   R<   R+   R!   R7   R#   R$   (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt&   test_printer_add_report_items_filtered]   s    	    |   c         C   sš  t  j ƒ  } d d g } | j t ƒ  | ƒ | j ƒ  |  j ƒ  \ } } | j } d } | | ƒ } t | ƒ } | | 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	 6t j
 | ƒ d
 6d t j ƒ  k p-t j | ƒ r?t j
 | ƒ n d d 6d t j ƒ  k pdt j t ƒ rvt j
 t ƒ n d d 6t j
 | ƒ d 6}
 d d i |
 d 6} t t j | ƒ ƒ ‚ n  t } } } }	 } d } | | k } | rŒt j	 d f | f d f | | f ƒ i t j
 | ƒ d 6d t j ƒ  k pBt j | ƒ rTt j
 | ƒ n d d 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t } } d S(   s,   Printing report items prints a line per items   one itemR:   s   
s   ==sk   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.count
}(%(py4)s)
} == %(py11)s
{%(py11)s = %(py8)s(%(py9)s)
}R&   R   R'   R2   R3   R<   R4   R;   R=   t   py11R   s   assert %(py13)st   py13s   %(py0)s == %(py3)sR   R   s   assert %(py5)sR
   N(   R    R   R>   R   t   print_report_itemsR   R*   R;   R   R   R   R   R   R   R   R   R   (   R   R   R<   R   R   R+   R7   R5   t   @py_assert10R6   t   @py_format12t   @py_format14R"   t   @py_format4R#   (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt   test_printer_print_report_itemsh   s.    
	      ÿ       r   (   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   t   enforcerR    R   t   objectR   R%   R1   R9   R@   RD   RG   RO   (    (    (    sS   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_printout.pyt   <module>   s     					
			