B
    u9aC  ã               @   s6   d dl Z d dlZG dd„ dejƒZedkr2e ¡  dS )é    Nc               @   s   e Zd Zdd„ Zdd„ ZdS )Ú
FLUFLTestsc          	   C   sœ   d}t | d¡ddtjƒ |  t¡}t | d¡ddtjƒ W d Q R X |  t|jƒd¡ |  	|jj
d¡ |  	|jjd¡ |  	|jjd	¡ |  	|jjd
¡ d S )Nz-from __future__ import barry_as_FLUFL
2 {0} 3z<>z<BDFL test>Úexecz!=z<FLUFL test>z,with Barry as BDFL, use '<>' instead of '!='z2 != 3
é   é   )ÚcompileÚformatÚ
__future__ZCO_FUTURE_BARRY_AS_BDFLÚassertRaisesÚSyntaxErrorÚassertRegexÚstrÚ	exceptionÚassertEqualÚtextÚfilenameÚlinenoÚoffset)ÚselfÚcodeÚcm© r   ú /usr/lib/python3.7/test_flufl.pyÚtest_barry_as_bdfl   s    zFLUFLTests.test_barry_as_bdflc          	   C   s”   d}t | d¡ddƒ |  t¡}t | d¡ddƒ W d Q R X |  t|jƒd¡ |  |jjd¡ |  |jj	d¡ |  |jj
d	¡ |  |jjd
¡ d S )Nz2 {0} 3z!=z<BDFL test>r   z<>z<FLUFL test>zinvalid syntaxz2 <> 3
é   r   )r   r   r	   r
   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   Útest_guido_as_bdfl   s    zFLUFLTests.test_guido_as_bdflN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s   r   Ú__main__)r   ZunittestZTestCaser   r   Úmainr   r   r   r   Ú<module>   s   