ó
`¼åX   c           @   sB  d  d l  Z d  d l j j Z d  d l Z d  d l Z d  d l m	 Z
 d  d l m Z d  d l m Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d S(   iÿÿÿÿN(   t
   exceptions(   t	   get_rules(   t   headerc           C   s   i d d 6d d 6S(   Nt   joet   namet   3t   id(    (    (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   mock_google_metainfo   s    c           C   s   t  j t ƒ  f S(   N(   R   t   GOOGLE_SOURCER   (    (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   mock_tagged_google_metainfo   s    c           C   s   i d d 6d d 6S(   Ns	   some/patht   pathi    t   mtime(    (    (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   mock_file_metainfo#   s    
c   	      C   s|  |  j  t d t ƒ t 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 6t j
 | ƒ 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 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d } } } } } } d S(   s.   A timestamp is produced when not in a DST zonet   daylightt    s   !=sˆ   %(py9)s
{%(py9)s = %(py2)s
{%(py2)s = %(py0)s.pretty_timestamp
}(%(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s.time
}()
})
} != %(py12)st   timet   py3t   py2R   t   py0t   py7t   py5t   py9t   py12s   assert %(py14)st   py14N(   s   !=(   sˆ   %(py9)s
{%(py9)s = %(py2)s
{%(py2)s = %(py0)s.pretty_timestamp
}(%(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s.time
}()
})
} != %(py12)ss   assert %(py14)s(   t   setattrR   t   FalseR   t   pretty_timestampt
   @pytest_art   _call_reprcomparet   @py_builtinst   localst   _should_repr_global_namet	   _safereprt   AssertionErrort   _format_explanationt   None(	   t   monkeypatcht   @py_assert1t   @py_assert4t   @py_assert6t   @py_assert8t   @py_assert11t   @py_assert10t   @py_format13t   @py_format15(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_pretty_timestamp_nodst.   s    	 	 	     ã   c   	      C   s|  |  j  t d t ƒ t 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 6t j
 | ƒ 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 6t j
 | ƒ d 6} d i | d 6} t t j | ƒ ƒ ‚ n  d } } } } } } d S(   s*   A timestamp is produced when in a DST zoneR   R   s   !=sˆ   %(py9)s
{%(py9)s = %(py2)s
{%(py2)s = %(py0)s.pretty_timestamp
}(%(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s.time
}()
})
} != %(py12)sR   R   R   R   R   R   R   R   R   s   assert %(py14)sR   N(   s   !=(   sˆ   %(py9)s
{%(py9)s = %(py2)s
{%(py2)s = %(py0)s.pretty_timestamp
}(%(py7)s
{%(py7)s = %(py5)s
{%(py5)s = %(py3)s.time
}()
})
} != %(py12)ss   assert %(py14)s(   R   R   t   TrueR   R   R   R   R   R   R   R    R!   R"   R#   (	   R$   R%   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_pretty_timestamp_dst4   s    	 	 	     ã   c          C   s  t  j }  d } |  | ƒ } d } | | k } | sø t j d | f d | | f ƒ i t 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 }  } } } } d S(   s   Is a good timestamp produced?s   1970-01-01T00:00:00.0Zi    s   ==sZ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.rfc3339_to_timestamp
}(%(py4)s)
} == %(py9)sR   R   R   R   t   py6t   py4R   s   assert %(py11)st   py11N(   s   ==(   sZ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.rfc3339_to_timestamp
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   R   t   rfc3339_to_timestampR   R   R    R   R   R   R!   R"   R#   (   R%   t   @py_assert3t   @py_assert5R(   t   @py_assert7t   @py_format10t   @py_format12(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_rfc3339_to_timestamp_value<   s    	      œ   c           C   s*   t  j t j ƒ  t j d ƒ Wd QXd S(   s(   Does a bad rfc3339 value raise an error?t   badN(   t   pytestt   raisest   ext   Unrecognized3339TimeWarningR   R3   (    (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_rfc3339_to_timestamp_failA   s    c          C   s.  g  }  t  j |  i  d d ƒ t |  ƒ } 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 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(   s/   Nothing happens when the key is not in the dictt   valuet   keyi    s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   t   lstt   py1t   lenR   R0   R   s   assert %(py8)st   py8N(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   t   optional_appendRD   R   R   R    R   R   R   R!   R"   R#   (   RB   t   @py_assert2R5   R&   t   @py_format7t   @py_format9(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_optional_append_nokeyI   s        ³   c          C   s5  g  }  t  j |  i d d 6d d ƒ t |  ƒ } 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	 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(   s0   The list gets longer when the key is in the dictt	   somethingRA   R@   i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   RB   RC   RD   R   R0   R   s   assert %(py8)sRE   N(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   RF   RD   R   R   R    R   R   R   R!   R"   R#   (   RB   RG   R5   R&   RH   RI   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_optional_append_keyP   s        ³   c          C   si  t  j }  i  } |  | ƒ } t | ƒ } d } | | 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 t ƒ r× t j t ƒ 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(   s"   With no mod time get an empty listi    s   ==sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_modtime
}(%(py5)s)
})
} == %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   s   ==(   sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_modtime
}(%(py5)s)
})
} == %(py12)ss   assert %(py14)s(   R   t   build_google_modtimeRD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_modtime_noneY   s    	       ã   c          C   sp  t  j }  i d d 6} |  | ƒ } t | ƒ } d } | | k } | sR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 t ƒ rÞ t j t ƒ 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(   s)   A good mod time produces a 1 element lists   1970-01-01T00:00:00.0Zt   modifiedTimei   s   ==sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_modtime
}(%(py5)s)
})
} == %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   s   ==(   sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_modtime
}(%(py5)s)
})
} == %(py12)ss   assert %(py14)s(   R   RM   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_modtime_good^   s    	       ã   c         C   sñ  t  j i d d 6ƒ } |  j ƒ  \ } } t | ƒ } 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 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 } | | 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 }	 } d S(   s@   A bad mod time produces something on stdout and a 1 element listR:   RO   i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   t   resultRC   RD   R   R0   R   s   assert %(py8)sRE   s   !=s   %(py0)s != %(py3)st   errs   assert %(py5)sR   N(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   s   !=(   s   %(py0)s != %(py3)ss   assert %(py5)s(   R   RM   t
   readouterrRD   R   R   R    R   R   R   R!   R"   R#   (   t   capsysRQ   t   outRR   RG   R5   R&   RH   RI   R%   t   @py_format4t   @py_format6(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_modtime_badd   s"        ³      l   c          C   s~  t  j }  i i d d 6d d 6d 6} |  | ƒ } t | ƒ } d } | | 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 t ƒ rì t j t ƒ 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(   s/   When there's a key a non-empty list is returnedt   Joet   displayNames   joe@example.comt   emailAddresst   lastModifyingUseri    t   >sx   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_lastmod
}(%(py5)s)
})
} > %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   R]   (   sx   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_lastmod
}(%(py5)s)
})
} > %(py12)ss   assert %(py14)s(   R   t   build_google_lastmodRD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_lastmod_keyo   s    	       ã   c          C   si  t  j }  i  } |  | ƒ } t | ƒ } d } | | 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 t ƒ r× t j t ƒ 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(   s,   When there's no key a empty list is returnedi    s   ==sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_lastmod
}(%(py5)s)
})
} == %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   s   ==(   sy   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_lastmod
}(%(py5)s)
})
} == %(py12)ss   assert %(py14)s(   R   R^   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt    test_build_google_lastmod_no_keyv   s    	       ã   c          C   si  t  j }  i  } |  | ƒ } t | ƒ } d } | | 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 t ƒ r× t j t ƒ 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(   s-   When there's no key an empty list is returnedi    s   ==sx   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_owners
}(%(py5)s)
})
} == %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   s   ==(   sx   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_google_owners
}(%(py5)s)
})
} == %(py12)ss   assert %(py14)s(   R   t   build_google_ownersRD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_owners_no_key}   s    	       ã   c          C   s2  t  j i i d d 6g d 6ƒ }  t |  ƒ } 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	 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(   s8   When there's one owner you get one owner worth of outputR   RZ   t   ownersi   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   RQ   RC   RD   R   R0   R   s   assert %(py8)sRE   N(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   Ra   RD   R   R   R    R   R   R   R!   R"   R#   (   RQ   RG   R5   R&   RH   RI   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_owners_one‚   s        ³   c          C   s<  t  j i i d d 6i d d 6g d 6ƒ }  t |  ƒ } 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 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(   s:   When there's two owners you get two owners worth of outputR   RZ   s   joe@example.comR[   Rc   i   s   ==s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)sR   RQ   RC   RD   R   R0   R   s   assert %(py8)sRE   N(   s   ==(   s0   %(py3)s
{%(py3)s = %(py0)s(%(py1)s)
} == %(py6)ss   assert %(py8)s(   R   Ra   RD   R   R   R    R   R   R   R!   R"   R#   (   RQ   RG   R5   R&   RH   RI   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_google_owners_twoŠ   s        ³   c          C   s®  t  j }  t ƒ  } |  | ƒ } t | ƒ } 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	 6d
 t j ƒ  k p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 }  } } } } } d S(   s%   Get something when given name and id?i    R]   s   %(py10)s
{%(py10)s = %(py0)s(%(py8)s
{%(py8)s = %(py3)s
{%(py3)s = %(py1)s.build_googleinfo
}(%(py6)s
{%(py6)s = %(py4)s()
})
})
} > %(py13)sR   R   RC   RD   R   R0   R   R1   RE   t   py10t   py13R   s   assert %(py15)st   py15N(   R   t   build_googleinfoR   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R5   R6   t   @py_assert9t   @py_assert12R)   t   @py_format14t   @py_format16(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_googleinfo•   s    	 	      ÿ !   c          C   s®  t  j }  t ƒ  } |  | ƒ } t | ƒ } 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	 6d
 t j ƒ  k p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 }  } } } } } d S(   s   Get something?i    R]   s‹   %(py10)s
{%(py10)s = %(py0)s(%(py8)s
{%(py8)s = %(py3)s
{%(py3)s = %(py1)s.build_fileinfo
}(%(py6)s
{%(py6)s = %(py4)s()
})
})
} > %(py13)sR   R   RC   RD   R   R0   R   R1   RE   Rf   Rg   R   s   assert %(py15)sRh   N(   R   t   build_fileinfoR   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R5   R6   Rj   Rk   R)   Rl   Rm   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_fileinfoœ   s    	 	      ÿ !   c          C   s®  t  j }  t ƒ  } |  | ƒ } t | ƒ } 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	 6d
 t j ƒ  k p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 }  } } } } } d S(   s2   Supplying google metainfo returns a non-empty listi   R]   s‹   %(py10)s
{%(py10)s = %(py0)s(%(py8)s
{%(py8)s = %(py3)s
{%(py3)s = %(py1)s.build_metainfo
}(%(py6)s
{%(py6)s = %(py4)s()
})
})
} > %(py13)sR   R   RC   RD   R   R0   R	   R1   RE   Rf   Rg   R   s   assert %(py15)sRh   N(   R   t   build_metainfoR	   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R5   R6   Rj   Rk   R)   Rl   Rm   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_metainfo_google£   s    	 	      ÿ !   c          C   su  t  j }  t j t ƒ  f } |  | ƒ } t | ƒ } d } | | k } | sW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 t ƒ rã t j t ƒ 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(   s0   Supplying file metainfo returns a non-empty listi   R]   sr   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_metainfo
}(%(py5)s)
})
} > %(py12)sR   R   RC   RD   R   R   R   R   R   R   s   assert %(py14)sR   N(   R]   (   sr   %(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.build_metainfo
}(%(py5)s)
})
} > %(py12)ss   assert %(py14)s(   R   Rq   R   t   FILE_SOURCER   RD   R   R   R    R   R   R   R!   R"   R#   (   RG   R&   R'   R(   R)   R*   R+   R,   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_build_metainfo_file©   s    	       ã   c    	      C   s  t  j ƒ  }  t |  t ƒ } | sü d d i d t j ƒ  k sL 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 } |  j } d
 } | | ƒ } d } | | k } | sút j d | f d | | f ƒ i t j | ƒ d 6t j | ƒ 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(   s!   Returns a string with no newlinesR   s5   assert %(py4)s
{%(py4)s = %(py0)s(%(py1)s, %(py2)s)
}t   strR   t   versionRC   t
   isinstanceR   R1   s   
i    s   ==sK   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.count
}(%(py4)s)
} == %(py9)sR   R0   s   assert %(py11)sR2   N(   s   ==(   sK   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.count
}(%(py4)s)
} == %(py9)ss   assert %(py11)s(   R   t   get_versionRw   Ru   R   R   R   R   R    R!   R"   R#   t   countR   (	   Rv   R4   t   @py_format5R%   R5   R(   R6   R7   R8   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_get_version±   s       Ã  	      œ   c    	      C   sË  t  j }  d } t ƒ  } |  | | ƒ } t | ƒ } 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	 6d
 t j ƒ  k pt j	 t ƒ r!t j t ƒ n d
 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(   s   Returns a non-empty listi    i   R]   s   %(py12)s
{%(py12)s = %(py0)s(%(py10)s
{%(py10)s = %(py3)s
{%(py3)s = %(py1)s.build
}(%(py5)s, %(py8)s
{%(py8)s = %(py6)s()
})
})
} > %(py15)sR   R   RC   RD   R   R	   R0   R   RE   Rh   Rf   R   R   s   assert %(py17)st   py17N(   R   t   buildR	   RD   R   R   R    R   R   R   R!   R"   R#   (	   RG   R&   R6   Rj   R)   t   @py_assert14t   @py_assert13Rm   t   @py_format18(    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt
   test_buildº   s    	  	      ÿ 1   c         C   s?  t  j d t ƒ  ƒ |  j ƒ  \ } } | s„ d i d t j ƒ  k sR t j | ƒ ra t j | ƒ n d d 6} t	 t j
 | ƒ ƒ ‚ n  d } | | k } | s1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 } } d S(   s   Prints on stdout but not stderri    R   s   assert %(py0)sRU   R   s   ==s   %(py0)s == %(py3)sR   RR   s   assert %(py5)sR   Ns   assert %(py0)s(   s   ==(   s   %(py0)s == %(py3)ss   assert %(py5)s(   R   t   print_headerR	   RS   R   R   R   R   R    R!   R"   R   R#   (   RT   RU   RR   t   @py_format1RG   R%   RV   RW   (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   test_print_headerÁ   s     A    l   (%   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   R;   R   t   enforcerR    R=   R   R   R   R	   R   R-   R/   R9   R?   RJ   RL   RN   RP   RX   R_   R`   Rb   Rd   Re   Rn   Rp   Rr   Rt   R{   R   R„   (    (    (    sQ   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_header.pyt   <module>   s<     																									