
    ?d                         d 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dlmZ ddlm	Z	  ej                  ej                  d       G d	 d
e	j                               Zedk(  r ej                          yy)zTests for yapf.reformatter.    N)	py3compat)reformatter)style)verifier)yapf_test_helperzRequires Python 2c                   4    e Zd Zed        Zd Zd Zd Zd Zy)TestVerifyNoVerifyc                 R    t        j                  t        j                                y )N)r   SetGlobalStyleCreatePEP8Style)clss    C/usr/lib/python3/dist-packages/yapftests/reformatter_verify_test.py
setUpClasszTestVerifyNoVerify.setUpClass   s    	..01    c                    t        j                  d      }t        j                  |      }| j	                  t
        j                        5  t        j                  |d       d d d        t        j                  |       y # 1 sw Y   xY w)N:        class ABC(metaclass=type):
          pass
        Tverify)	textwrapdedentr   ParseAndUnwrapassertRaisesr   InternalErrorr   Reformat)selfunformatted_codelliness      r   testVerifyExceptionz&TestVerifyNoVerify.testVerifyException"   sp     (  ,,-=>F			811	2 06$/0 0 0s   
B  B	c                     t        j                  d      }t        j                  d      }t        j                  |      }| j	                  |t        j                  |d             y )Nr   z<        class ABC(metaclass=type):
            pass
        Fr   r   r   r   r   assertCodeEqualr   r   )r   r   expected_formatted_coder   s       r   testNoVerifyzTestVerifyNoVerify.testNoVerify,   sa     (  'oo /  ,,-=>F0$--fUCEr   c                    t        j                  d      }t        j                  |      }| j	                  t
        j                        5  t        j                  |d       d d d        t        j                  d      }t        j                  |      }| j                  |t        j                  |d             y # 1 sw Y   [xY w)Nz        from __future__ import print_function

        def call_my_function(the_function):
          the_function("hi")

        if __name__ == "__main__":
          call_my_function(print)
        Tr   z        from __future__ import print_function


        def call_my_function(the_function):
            the_function("hi")


        if __name__ == "__main__":
            call_my_function(print)
        F)
r   r   r   r   r   r   r   r   r   r!   )r   r   r   r"   s       r   testVerifyFutureImportz)TestVerifyNoVerify.testVerifyFutureImport9   s     (  ,,-=>F			811	2 06$/0 'oo 
/ 
 ,,-=>F0$--fUCE0 0s   
B<<Cc                     t        j                  d      }t        j                  |      }| j	                  |t        j                  |d             y )Nz        class Foo(object):

            def bar(self):
                if self.solo_generator_that_is_long is None and len(
                        self.generators + self.next_batch) == 1:
                    pass
        Fr   r    )r   coder   s      r   )testContinuationLineShouldBeDistinguishedz<TestVerifyNoVerify.testContinuationLineShouldBeDistinguishedV   sD    ??  D ,,T2F{33F5IJr   N)	__name__
__module____qualname__classmethodr   r   r#   r%   r(    r   r   r	   r	      s-     2 2!EE:
Kr   r	   __main__)__doc__r   unittestyapf.yapflibr   r   r   r   	yapftestsr   skipIfPY3YAPFTestr	   r)   mainr-   r   r   <module>r7      st    "   " $  ! &  34DK)22 DK 5DKN z(--/ r   