ó
œyNYè!  c           @   sJ  d  d l  Z d  d l j j Z d  d l Z d  d l m Z	 d  d l m
 Z
 e
 j 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 „  Z$ d „  Z% d „  Z& d S(   iÿÿÿÿN(   t
   exceptions(   t
   rules_yaccc    	      C   sw  t  j }  d } |  | ƒ } d g } t j } | | } | | k } | sU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 6t j | ƒ d 6t j | ƒ d	 6t j | ƒ d
 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s   A simple string workss	   two wordst   strings   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})t   py2t   parsert   py0t   py6t   py4t   py9R   t   py10t   py12t    s   assert %(py15)st   py15N(   s   strings	   two words(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   t   parseR   t   IMPLICIT_SUFFIXESt
   @pytest_art   _call_reprcomparet	   _safereprt   @py_builtinst   localst   _should_repr_global_namet   AssertionErrort   _format_explanationt   None(	   t   @py_assert1t   @py_assert3t   @py_assert5t   @py_assert8t   @py_assert11t   @py_assert13t   @py_assert7t   @py_format14t   @py_format16(    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string   s    	   	 	 
   ã   c    	      C   sz  t  j }  d } |  | ƒ } d d g } t j } | | } | | k } | sX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
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s$   A string followed by an entity workss   two words <entity>R   s
   two words t   entitys   <entity>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings
   two words (   s   entitys   <entity>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_entity"   s    	    	 
   ã   c    	      C   s€  t  j }  d } |  | ƒ } d d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s$   A string followed by an entity workss   two words <#> <entity>R   s
   two words t   hashs   <#>t    R"   s   <entity>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings
   two words (   s   hashs   <#>(   s   stringR%   (   s   entitys   <entity>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_hashedstring_entity*   s    	    	 
   ã   c    	      C   sw  t  j }  d } |  | ƒ } d g } t j } | | } | | k } | sU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 6t j | ƒ d 6t j | ƒ d	 6t j | ƒ d
 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s   A longer string workss   three words yeahR   s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings   three words yeah(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_long_string4   s    	   	 	 
   ã   c    	      C   sw  t  j }  d } |  | ƒ } d g } t j } | | } | | k } | sU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 6t j | ƒ d 6t j | ƒ d	 6t j | ƒ d
 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s   An entity as a name workss   <entity>R"   s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   entitys   <entity>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_entity;   s    	   	 	 
   ã   c    	      C   s}  t  j }  d } |  | ƒ } d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s!   A string followed by a name workss   two words - <yyyy-mm-dd>R   s	   two wordss    - t   dates   <yyyy-mm-dd>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings	   two words(   s   strings    - (   s   dates   <yyyy-mm-dd>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_dateA   s    	    	 
   ã   c    	      C   s}  t  j }  d } |  | ƒ } d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s"   An entity followed by a year workss   <entity> - <yyyy>R"   s   <entity>R   s    - t   years   <yyyy>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   entitys   <entity>(   s   strings    - (   s   years   <yyyy>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_entity_yearJ   s    	    	 
   ã   c          C   s  t  j }  d } |  | ƒ } d d f d d d f d d f g f g } t j } | | } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k p:t j
 t ƒ rL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 6}	 d d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  t }  } } } } } } } } d S(   s)   String followed by an optional hash workss   two words[ - <#>]R   s	   two wordst   optionals    - R$   s   <#>s   ==s´   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == ((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py16)s
{%(py16)s = %(py14)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   t   py14t   py16R	   R
   R   s   assert %(py19)st   py19N(   R   R   R   t   IMPLICIT_VERSIONt   IMPLICIT_PARENSR   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   t   @py_assert15t   @py_assert17R   t   @py_format18t   @py_format20(    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_opt_hashQ   s    	   * 	 
 	 
   ÿ 1   c          C   s   t  j }  d } |  | ƒ } d d f d d d f d d f g f d d d f d d	 f g f g } t j } | | } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pUt j
 t ƒ rg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 6}	 d d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  t }  } } } } } } } } d S(   sC   String followed by an optional hash works by an optional user values   two words[ - <#>][ - <address>]R   s	   two wordsR-   s    - R$   s   <#>t   user_strs	   <address>s   ==s´   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == ((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py16)s
{%(py16)s = %(py14)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R.   R/   R	   R
   R   s   assert %(py19)sR0   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R3   R4   R   R5   R6   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt!   test_string_opt_hash_opt_user_strZ   s    	   E 	 
 	 
   ÿ 1   c    	      C   s‰  t  j }  d } |  | ƒ } d d d d g f d g } t j } | | } | | k } | sg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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ r#t j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(    s4   String followed by optional hash by required versions   two words[ - <#>] v<#>R   s	   two wordsR-   s    - R$   s   <#>t   versions    v<#>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings	   two words(   s   strings    - (   s   hashs   <#>(   s   versions    v<#>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})s   assert %(py15)s(   R   R   R   R2   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_opt_hash_versiond   s    	    	 
   ã   c    	      C   s}  t  j }  d } |  | ƒ } d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s8   String followed by a version followed by a parentheticals   two words v<#> (some note)R   s	   two wordsR:   s    v<#>t   parens    (some note)s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings	   two words(   s   versions    v<#>(   s   parens    (some note)(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})s   assert %(py15)s(   R   R   R   R2   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_version_parenm   s    	    	 
   ã   c    	      C   sz  t  j }  d } |  | ƒ } d d g } t j } | | } | | k } | sX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
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s   String followed by a versions   two words v<#>R   s	   two wordsR:   s    v<#>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings	   two words(   s   versions    v<#>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})s   assert %(py15)s(   R   R   R   R2   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_versionv   s    	    	 
   ã   c          C   s  t  j }  d } |  | ƒ } d d f g } t j } | | } d d f g } | | } t j } | | }	 | |	 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
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pHt j
 t ƒ rZ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 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s   String followed by parens   two words (some note)R   s	   two wordsR<   s    (some note)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   t   py17R	   R
   R0   R   s   assert %(py22)st   py22N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   t   @py_assert14t   @py_assert16t   @py_assert18t   @py_assert20R   t   @py_format21t   @py_format23(    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_paren}   s"    	    	 
  
 	 
   ÿ A   c          C   s-  t  j }  d } |  | ƒ } d d f g } t j } | | } d d f d d d f g f g } | | } t j } | | }	 | |	 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 6t j | ƒ 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 6d t j	 ƒ  k p‘t j
 t ƒ r£t j t ƒ n d d 6t j | ƒ d 6t j | ƒ d 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s*   String followed by paren by optional parens'   two words (some note)[ (optional note)]R   s	   two wordsR<   s    (some note)R-   s    (optional note)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   R?   R	   R
   R0   R   s   assert %(py22)sR@   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   RA   RB   RC   RD   R   RE   RF   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_paren_opt_paren†   s"    	    	 
 ! 
 	 
   ÿ A   c          C   s$  t  j }  d } |  | ƒ } d d f g } t j } | | } d d d f g f g } | | } t j } | | }	 | |	 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pQt j
 t ƒ rc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 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s!   String followed by optional parens   two words[ (optional note)]R   s	   two wordsR-   R<   s    (optional note)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   R?   R	   R
   R0   R   s   assert %(py22)sR@   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   RA   RB   RC   RD   R   RE   RF   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_opt_paren   s"    	    	 
  
 	 
   ÿ A   c          C   s$  t  j }  d } |  | ƒ } d d f g } t j } | | } d d f d d f g } | | } t j } | | }	 | |	 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pQt j
 t ƒ rc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 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s!   String followed by paren by parens$   two words (some note) (another note)R   s	   two wordsR<   s    (some note)s    (another note)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   R?   R	   R
   R0   R   s   assert %(py22)sR@   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   RA   RB   RC   RD   R   RE   RF   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_paren_paren™   s"    	    	 
  
 	 
   ÿ A   c          C   s6  t  j }  d } |  | ƒ } d d f g } t j } | | } d d d f g f d d d f g f g } | | } t j } | | }	 | |	 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pct j
 t ƒ ru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 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s3   String followed by optional paren by optional parens0   two words[ (optional note)][ (another opt note)]R   s	   two wordsR-   R<   s    (optional note)s    (another opt note)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   R?   R	   R
   R0   R   s   assert %(py22)sR@   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   RA   RB   RC   RD   R   RE   RF   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_opt_paren_opt_paren£   s"    	    	 
 * 
 	 
   ÿ A   c          C   s6  t  j }  d } |  | ƒ } d d f d d f d d f g } t j } | | } d d d	 f g f g } | | } t j } | | }	 | |	 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k pct j
 t ƒ ru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 6} d d i | d 6} t t j | ƒ ƒ ‚ n  t }  } } }
 } } } } } } }	 d S(   s?   String followed by a user element followed by an optional parens   word - <address>[ (optional)]R   t   words    - R8   s	   <address>R-   R<   s    (optional)s   ==sÁ   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py15)s) + %(py19)s
{%(py19)s = %(py17)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R   R?   R	   R
   R0   R   s   assert %(py22)sR@   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   RA   RB   RC   RD   R   RE   RF   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt"   test_string_user_element_opt_paren®   s"    	   ! 	 
  
 	 
   ÿ A   c    	      C   s}  t  j }  d } |  | ƒ } d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s)   Hash follwed by period followed by strings   <#>. two wordsR$   s   <#>R   s   . s	   two wordss   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   hashs   <#>(   s   strings   . (   s   strings	   two words(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_numbered_bullet¹   s    	    	 
   ã   c    	      C   s€  t  j }  d } |  | ƒ } d d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s)   Hash follwed by period followed by strings   <#>. two words v<#>R$   s   <#>R   s   . s	   two wordsR:   s    v<#>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   hashs   <#>(   s   strings   . (   s   strings	   two words(   s   versions    v<#>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_PARENS
})s   assert %(py15)s(   R   R   R   R2   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_numbered_bullet_versionÂ   s    	    	 
   ã   c    	      C   s}  t  j }  d } |  | ƒ } d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s    String followed by last 4 digitss   two words - <last 4 digits>R   s	   two wordss    - t   last_4_digitss   <last 4 digits>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings	   two words(   s   strings    - (   s   last_4_digitss   <last 4 digits>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_last_4_digitsÌ   s    	    	 
   ã   c    	      C   sz  t  j }  d } |  | ƒ } d d g } t j } | | } | | k } | sX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
 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s   String followed by hashs   two words <#>R   s
   two words R$   s   <#>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings
   two words (   s   hashs   <#>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt!   test_hash_suffixed_string_complexÕ   s    	    	 
   ã   c    	      C   s†  t  j }  d } |  | ƒ } d d d d d d g } t j } | | } | | k } | sd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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ r t j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(    s-   String followed by entity by string by entitys    two words <entity> from <entity>R   s
   two words R"   s   <entity>R%   t   froms   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   strings
   two words (   s   entitys   <entity>(   s   stringR%   (   s   strings   from(   s   stringR%   (   s   entitys   <entity>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_uval_string_uvalÜ   s    	    	 
   ã   c          C   s  t  j }  d } |  | ƒ } d d f d d d f d d f g f g } t j } | | } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j	 ƒ  k p:t j
 t ƒ rL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 6}	 d d i |	 d 6}
 t t j |
 ƒ ƒ ‚ n  t }  } } } } } } } } d S(   s-   String followed by optional string-user_values   two words[ from <somewhere>]R   s	   two wordsR-   s    from R8   s   <somewhere>s   ==s´   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == ((%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_VERSION
}) + %(py16)s
{%(py16)s = %(py14)s.IMPLICIT_PARENS
})R   R   R   R   R   R   R   R.   R/   R	   R
   R   s   assert %(py19)sR0   N(   R   R   R   R1   R2   R   R   R   R   R   R   R   R   R   (   R   R   R   R   R   R   R3   R4   R   R5   R6   (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_string_opt_string_uvalè   s    	   * 	 
 	 
   ÿ 1   c    	      C   s€  t  j }  d } |  | ƒ } d d d d g } t j } | | } | | 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 6t j | ƒ d 6t j | ƒ d 6t j | ƒ d 6d t j ƒ  k st j	 t ƒ rt j t ƒ n d d 6t j | ƒ d 6} d i | d 6} t
 t j | ƒ ƒ ‚ n  d }  } } } } } } d S(   s,   user value followed by string, by user values   <first> of <second>R8   s   <first>R   R%   s   of s   <second>s   ==s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})R   R   R   R   R   R   R   R	   R
   R   s   assert %(py15)sR   N(   s   user_strs   <first>(   s   stringR%   (   s   strings   of (   s   user_strs   <second>(   s   ==(   s   %(py6)s
{%(py6)s = %(py2)s
{%(py2)s = %(py0)s.parse
}(%(py4)s)
} == (%(py9)s + %(py12)s
{%(py12)s = %(py10)s.IMPLICIT_SUFFIXES
})s   assert %(py15)s(   R   R   R   R   R   R   R   R   R   R   R   R   R   (	   R   R   R   R   R   R   R   R   R    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_uval_string_uvalò   s    	    	 
   ã   c           C   s*   t  j t j ƒ  t j d ƒ Wd QXd S(   s"   Test the yacc bad-token error codes    -  - N(   t   pytestt   raisest   ext	   YaccErrorR   R   (    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_yaccerrorü   s    c           C   s*   t  j t j ƒ  t j d ƒ Wd QXd S(   s   Test the yacc eof error codes
   something N(   RW   RX   RY   t   YaccEOFErrorR   R   (    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   test_yacceoferror  s    ('   t   __builtin__R   t   _pytest.assertion.rewritet	   assertiont   rewriteR   RW   t   enforcerR    RY   R   R   R!   R#   R&   R'   R(   R*   R,   R7   R9   R;   R=   R>   RG   RH   RI   RJ   RK   RM   RN   RO   RQ   RR   RT   RU   RV   R[   R]   (    (    (    sU   /home/kop/biz/barnett/enforcer_project/BRIEF-Script/Enforcer/tests/test_rules_yacc.pyt   <module>   s@     				
								
								
			
					
					
	
	