
    ?dM                        d Z ddlZddlZddl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 ej                  d        Zej                  d        Z G d	 d
ej                        Z G d dej                        Zd Z G d dej                        Z G d dej                        Z G d dej                        Z G d de      Z G d dej                        Z G d dej                        Zedk(  r ej6                          yy)zTests for yapf.file_resources.    N)errors)file_resources)	py3compat)utilsc               #      K   t        j                         } 	 d  t        j                  |        y # t        j                  |        w xY wwN)osgetcwdchdir)curdirs    ?/usr/lib/python3/dist-packages/yapftests/file_resources_test.py_restore_working_dirr      s1     99;&	HHVBHHVs   A2 AA		Ac              #      K   t        | d      }t        | d|       	 d  t        | d|       y # t        | d|       w xY ww)Nexists)getattrsetattr)modulemock_implementationunmocked_existss      r   _exists_mocked_in_moduler   '   s?     FH-/	&(/0/	FHo.GFHo.s   A/ A>Ac                       e Zd Zd Zd Zd Zd Zd Z ej                  e
j                  d      d        Zd Zd	 Zd
 Zy)GetExcludePatternsForDirc                 6    t        j                         | _        y r   tempfilemkdtemptest_tmpdirselfs    r   setUpzGetExcludePatternsForDir.setUp3       '')D    c                 B    t        j                  | j                         y r   shutilrmtreer   r   s    r   tearDownz!GetExcludePatternsForDir.tearDown6       
MM$""#r"   c                 d   t         j                  j                  | j                  d      }ddg}t	        |d      5 }|j                  dj                  |             d d d        | j                  t        t        j                  | j                              t        |             y # 1 sw Y   KxY w)N.yapfignoretemp/**/*.py
temp2/*.pyw
)
r	   pathjoinr   open
writelinesassertEqualsortedr   r   r   local_ignore_fileignore_patternsfs       r   .test_get_exclude_file_patterns_from_yapfignorezGGetExcludePatternsForDir.test_get_exclude_file_patterns_from_yapfignore9   s    T%5%5}E%|4O		% /ll499_-./ 	~66t7G7GHI!/ /s   !B&&B/c                    t         j                  j                  | j                  d      }ddg}t	        |d      5 }|j                  dj                  |             d d d        | j                  t        j                        5  t        j                  | j                         d d d        y # 1 sw Y   QxY w# 1 sw Y   y xY w)Nr*   r+   ./wrong/syntax/*.pyr-   r.   )r	   r/   r0   r   r1   r2   assertRaisesr   	YapfErrorr   r   r5   s       r   @test_get_exclude_file_patterns_from_yapfignore_with_wrong_syntaxzYGetExcludePatternsForDir.test_get_exclude_file_patterns_from_yapfignore_with_wrong_syntaxC   s    T%5%5}E%'<=O		% /ll499_-./ 
		6++	, @--d.>.>?@ @/ /@ @s   !B, B8,B58Cc                 6   	 dd l }t        j                  j	                  | j
                  d      }ddg}t        |d      5 }|j                  d       |j                  d       |j                  dj	                  |D cg c]  }d	j                  |       c}             |j                  d
       d d d        | j                  t        t        j                  | j
                              t        |             y # t        $ r Y y w xY wc c}w # 1 sw Y   _xY w)Nr   pyproject.tomlr+   r,   r-   [tool.yapfignore]
ignore_patterns=[
,"{}"])tomliImportErrorr	   r/   r0   r   r1   writer2   formatr3   r4   r   r   r   rF   r6   r7   r8   ps         r   -test_get_exclude_file_patterns_from_pyprojectzFGetExcludePatternsForDir.test_get_exclude_file_patterns_from_pyprojectL   s     T%5%57GH%|4O		% gg#$gg!"ll5::IAv}}Q/IJKggcl	 	~66t7G7GHI!   J s/   C;  =D=D
D;	DD
DDzRequires Python 3.6c                 Z   	 dd l }t        j                  j	                  | j
                  d      }ddg}t        |d      5 }|j                  d       |j                  d       |j                  dj	                  |D cg c]  }d	j                  |       c}             |j                  d
       d d d        | j                  t        j                        5  t        j                  | j
                         d d d        y # t        $ r Y y w xY wc c}w # 1 sw Y   exY w# 1 sw Y   y xY w)Nr   r@   r+   r;   r-   rA   rB   rC   rD   rE   )rF   rG   r	   r/   r0   r   r1   rH   r2   rI   r<   r   r=   r   r   rJ   s         r   ?test_get_exclude_file_patterns_from_pyproject_with_wrong_syntaxzXGetExcludePatternsForDir.test_get_exclude_file_patterns_from_pyproject_with_wrong_syntax]   s    T%5%57GH%'<=O		% gg#$gg!"ll5::IAv}}Q/IJKggcl	 
		6++	, @--d.>.>?@ @   J @ @s;   D  =D=DD D!	DDDD!D*c                 :   	 dd l }t        j                  j	                  | j
                  d      }g }t        |d      j                          | j                  t        t        j                  | j
                              t        |             y # t        $ r Y y w xY w)Nr   r@   r-   )rF   rG   r	   r/   r0   r   r1   closer3   r4   r   r   )r   rF   r6   r7   s       r   ?test_get_exclude_file_patterns_from_pyproject_no_ignore_sectionzXGetExcludePatternsForDir.test_get_exclude_file_patterns_from_pyproject_no_ignore_sectionn   s     T%5%57GHO	C &&(~66t7G7GHI!  s   B 	BBc                 j   	 dd l }t        j                  j	                  | j
                  d      }g }t        |d      5 }|j                  d       d d d        | j                  t        t        j                  | j
                              t        |             y # t        $ r Y y w xY w# 1 sw Y   ZxY w)Nr   r@   r-   rA   )rF   rG   r	   r/   r0   r   r1   rH   r3   r4   r   r   )r   rF   r6   r7   r8   s        r   Btest_get_exclude_file_patterns_from_pyproject_ignore_section_emptyz[GetExcludePatternsForDir.test_get_exclude_file_patterns_from_pyproject_ignore_section_empty{   s     T%5%57GHO		% %gg#$% 	~66t7G7GHI!  % %s   B B)	B&%B&)B2c                     g }| j                  t        t        j                  | j                              t        |             y r   )r3   r4   r   r   r   )r   r7   s     r   3test_get_exclude_file_patterns_with_no_config_fileszLGetExcludePatternsForDir.test_get_exclude_file_patterns_with_no_config_files   s6    O~66t7G7GHI!r"   N)__name__
__module____qualname__r    r'   r9   r>   rL   unittest
skipUnlessr   PY36rN   rQ   rS   rU    r"   r   r   r   1   sU    *$!@!" 8y~~'<=@ >@ !!!r"   r   c                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
GetDefaultStyleForDirTestc                 6    t        j                         | _        y r   r   r   s    r   r    zGetDefaultStyleForDirTest.setUp   r!   r"   c                 B    t        j                  | j                         y r   r$   r   s    r   r'   z"GetDefaultStyleForDirTest.tearDown   r(   r"   c                     t         j                  j                  | j                  d      }t	        j
                  |      }| j                  |d       y )Nfile.pypep8r	   r/   r0   r   r   GetDefaultStyleForDirr3   r   	test_file
style_names      r   test_no_local_stylez-GetDefaultStyleForDirTest.test_no_local_style   s<    T--y9I55i@JZ(r"   c                     t         j                  j                  | j                  d      }t	        j
                  |d      }| j                  |d       y )Nrb   zcustom-default)default_stylerd   rf   s      r   "test_no_local_style_custom_defaultz<GetDefaultStyleForDirTest.test_no_local_style_custom_default   sC    T--y9I55!13JZ!12r"   c                    t         j                  j                  | j                  d      }t	        |d      j                          t         j                  j                  | j                  d      }| j                  |t        j                  |             t         j                  j                  | j                  dd      }| j                  |t        j                  |             y )N.style.yapfr-   rb   dir1)	r	   r/   r0   r   r1   rP   r3   r   re   )r   
style_filetest_filenames      r   test_with_local_stylez/GetDefaultStyleForDirTest.test_with_local_style   s    d..>JS!GGLL!1!19=MZ#99-HJ GGLL!1!169EMZ#99-HJr"   c                    t         j                  j                  | j                  d      }t	        |d      j                          t         j                  j                  | j                  d      }t        j                  |      }| j                  |d       t	        |d      5 }|j                  d       d d d        | j                  |t        j                  |             y # 1 sw Y   /xY w)Nz	setup.cfgr-   ro   rc   z[yapf]
)
r	   r/   r0   r   r1   rP   r   re   r3   rH   )r   setup_configtest_dirrh   r8   s        r   test_setup_configz+GetDefaultStyleForDirTest.test_setup_config   s    77<< 0 0+>Ls!!#ww||D,,f5H55h?JZ( 
lC	  Aggj\#99(CE s   "C""C+c                    	 dd l }t        j                  j	                  | j
                  d      }t        |d      j                          t        j                  j	                  | j
                  d      }t        j                  |      }| j                  |d       t        |d      5 }|j                  d       d d d        | j                  |t        j                  |             y # t        $ r Y y w xY w# 1 sw Y   >xY w)Nr   r@   r-   ro   rc   z[tool.yapf]
)rF   rG   r	   r/   r0   r   r1   rP   r   re   r3   rH   )r   rF   pyproject_tomlru   rh   r8   s         r   test_pyproject_tomlz-GetDefaultStyleForDirTest.test_pyproject_toml   s     WW\\$"2"24DEN##%ww||D,,f5H55h?JZ( 
nc	" aggo^#99(CE   s   C' 'C6'	C32C36C?c                 N   t         j                  j                  t         j                  j                        }t         j                  j	                  |d      }t         j                  j	                  |dd      }t         j                  j	                  |d      fd}t        t        j                   j                  |      5  t        j                  |      }| j                  |       t        j                  |      }| j                  |       d d d        y # 1 sw Y   y xY w)Nro   dir2rn   c                     | k(  S r   r\   )r/   rp   s    r   mock_exists_implementationzVGetDefaultStyleForDirTest.test_local_style_at_root.<locals>.mock_exists_implementation   s    Zr"   )	r	   r/   abspathsepr0   r   r   re   r3   )r   rootdirtest_dir_at_roottest_dir_under_rootr}   default_style_at_rootdefault_style_under_rootrp   s          @r   test_local_style_at_rootz2GetDefaultStyleForDirTest.test_local_style_at_root   s    ggoobggkk*Gww||GV4'',,w? g}5J  
"."3"3"8"8"<
> = -BB

z#89!/!E!E
"
z#;<= = =s   ADD$N)rV   rW   rX   r    r'   ri   rl   rr   rv   ry   r   r\   r"   r   r^   r^      s-    *$)
3JEE(=r"   r^   c                 F    | D ]  }t        |d      j                           y )Na)r1   rP   )	filenamesnames     r   _touch_filesr      s#     dsOr"   c                   N    e 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y)GetCommandLineFilesTestc                 h    t        j                         | _        t        j                         | _        y r   )r   r   r   r	   r
   old_dirr   s    r   r    zGetCommandLineFilesTest.setUp   s     '')D99;DLr"   c                     t        j                  | j                         t        j                  | j
                         y r   )r	   r   r   r%   r&   r   r   s    r   r'   z GetCommandLineFilesTest.tearDown   s$    HHT\\
MM$""#r"   c                     t         j                  j                  t         j                  j                  | j                  |            }t        j
                  |       |S r   )r	   r/   normpathr0   r   makedirs)r   r   fullpaths      r   _make_test_dirz&GetCommandLineFilesTest._make_test_dir   s<    wwT-=-=t DEHKKOr"   c                    | j                  d      }| j                  d      }t        j                  j                  |d      }t        j                  j                  |d      }t	        ||g       | j                  t        j                  ||gdd       ||g       | j                  t        j                  ||gdd       ||g       y )Ntest1test2testfile1.pytestfile2.pyF	recursiveexcludeT)r   r	   r/   r0   r   r3   r   GetCommandLineFilesr   tdir1tdir2file1file2s        r   test_find_files_not_dirsz0GetCommandLineFilesTest.test_find_files_not_dirs   s    (E(EGGLL/EGGLL/E% **E5>5:37	9;@%.J 	**E5>5937	9;@%.Jr"   c                 H   | j                  d      }| j                  d      }t        j                  j                  |d      }t        j                  j                  |d      }t	        ||g       | j                  t        j                  t        j                  |gdd        y )Nr   z	test1/foor   r   F)command_line_file_listr   r   )
r   r	   r/   r0   r   r<   r   r=   r   r   r   s        r   test_nonrecursive_find_in_dirz5GetCommandLineFilesTest.test_nonrecursive_find_in_dir  s    (E,EGGLL/EGGLL/E% ** %w  r"   c           	         | j                  d      }| j                  d      }| j                  d      }t        j                  j                  |d      t        j                  j                  |d      t        j                  j                  |d      g}t	        |       | j                  t        t        j                  | j                  gdd             t        |             y )	Nr   test2/testinner/test3/foo/bar/bas/xxxr   r   testfile3.pyTr   
r   r	   r/   r0   r   r3   r4   r   r   r   r   r   r   tdir3filess        r   test_recursive_find_in_dirz2GetCommandLineFilesTest.test_recursive_find_in_dir  s    (E 23E 78E
UN+
UN+
UN+E
 ..0@0@/A9=7;=	> @Fe}	Nr"   c           
      F   | j                  d      }| j                  d      }| j                  d      }t        j                  j                  |d      t        j                  j                  |d      t        j                  j                  |d      g}t	        |       | j                  t        t        j                  | j                  gddg	            t        t        j                  j                  |d      t        j                  j                  |d      g             y )
Nr   r   r   r   r   r   Tz
*test*3.pyr   r   r   s        r   'test_recursive_find_in_dir_with_excludez?GetCommandLineFilesTest.test_recursive_find_in_dir_with_exclude.  s    (E 23E 78E
UN+
UN+
UN+E
 ..0@0@/A9=8D~G	H 	GGLL/GGLL/
 	r"   c           
      J   | j                  d      }| j                  d      }| j                  d      }t        j                  j                  |d      t        j                  j                  |d      t        j                  j                  |d      g}t	        |       t        j                  | j                  gddg	      }| j                  t        |      t        t        j                  j                  |d      t        j                  j                  |d      g             y )
N.test1test_2test.3r   r   r   T*.test1*r   )
r   r	   r/   r0   r   r   r   r   r3   r4   r   r   r   r   r   actuals         r   #test_find_with_excluded_hidden_dirsz;GetCommandLineFilesTest.test_find_with_excluded_hidden_dirsC  s    )E)E)E
UN+
UN+
UN+E
 //1A1A0B:>9CFF 	vGGLL/GGLL/
 	r"   c                    | j                  d      }| j                  d      }| j                  d      }t        j                  j                  |d      t        j                  j                  |d      t        j                  j                  |d      g}t	        |       t               5  t        j                  | j                         t        j                  t        j                  j                  | j                        gddg	      }| j                  t        |      t        t        j                  j                  t        j                  j                  | j                        t        j                  j                  |      d      t        j                  j                  t        j                  j                  | j                        t        j                  j                  |      d      g             d
d
d
       y
# 1 sw Y   y
xY w)a  Test find with excluded hidden dirs.

    A regression test against a specific case where a hidden directory (one
    beginning with a period) is being excluded, but it is also an immediate
    child of the current directory which has been specified in a relative
    manner.

    At its core, the bug has to do with overzealous stripping of "./foo" so that
    it removes too much from "./.foo" .
    r   r   r   r   r   r   Tr   r   N)r   r	   r/   r0   r   r   r   r   r   r   relpathr3   r4   basenamer   s         r   ,test_find_with_excluded_hidden_dirs_relativezDGetCommandLineFilesTest.test_find_with_excluded_hidden_dirs_relativeY  su    )E)E)E
UN+
UN+
UN+E
  
	 hht 1177??4++,
-, f
 
.
ggll''//$"2"23RWW5E5Ee5L " ggll''//$"2"23RWW5E5Ee5L "	 	  s   (EG>>Hc                    | j                  d      }| j                  d      }| j                  d      }t        j                  j                  |d      t        j                  j                  |d      t        j                  j                  |d      g}t	        |       t        j
                  | j                         t        t        j                  g ddddg	            }| j                  |d
j                  dt        j                  j                        g       t        t        j                  dgdddg	            }| j                  |dj                  dt        j                  j                        g       y )Nr   r   r   r   r   r   )r   r   test3Tr   z"test3/foo/bar/bas/xxx/testfile3.py/.r   z./test2/testinner/testfile2.py)r   r	   r/   r0   r   r   r   r4   r   r   r3   replacer   )r   r   r   r   r   founds         r   test_find_with_excluded_dirsz4GetCommandLineFilesTest.test_find_with_excluded_dirs  s@   (E 23E 78E
UN+
UN+
UN+E
 HHT**+F59/6/A4-	./E 	4<<S"''++NOQ **C559/6/64-	./E 	088bggkkJKMr"   c                     | j                  t        j                        5  t        j                  g ddg       d d d        y # 1 sw Y   y xY w)NFz./z)r   )r<   r   r=   r   r   r   s    r   #test_find_with_excluded_current_dirz;GetCommandLineFilesTest.test_find_with_excluded_current_dir  sC    			6++	, E((UUGDE E Es   AAN)rV   rW   rX   r    r'   r   r   r   r   r   r   r   r   r   r\   r"   r   r   r      s?    $
J N"*,(T!MFEr"   r   c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	IsPythonFileTestc                 6    t        j                         | _        y r   r   r   s    r   r    zIsPythonFileTest.setUp  r!   r"   c                 B    t        j                  | j                         y r   r$   r   s    r   r'   zIsPythonFileTest.tearDown  r(   r"   c                     t         j                  j                  | j                  d      }| j	                  t        j                  |             y )Nr   )r	   r/   r0   r   
assertTruer   IsPythonFile)r   r   s     r   test_with_py_extensionz'IsPythonFileTest.test_with_py_extension  s3    GGLL))>:EOON//67r"   c                 <   t         j                  j                  | j                  d      }| j	                  t        j                  |             t         j                  j                  | j                  d      }| j	                  t        j                  |             y )N	testfile1ztestfile1.rb)r	   r/   r0   r   assertFalser   r   )r   r   r   s      r   test_empty_without_py_extensionz0IsPythonFileTest.test_empty_without_py_extension  sh    GGLL));7E^0078GGLL))>:E^0078r"   c                    t         j                  j                  | j                  d      }t	        |d      5 }|j                  d       d d d        | j                  t        j                  |             t         j                  j                  | j                  d      }t	        |d      5 }|j                  d       d d d        | j                  t        j                  |             y # 1 sw Y   xY w# 1 sw Y   :xY w)Nr   r-   z#!/usr/bin/python
ztestfile2.run#! /bin/python2
)	r	   r/   r0   r   r1   rH   r   r   r   )r   r   r8   r   s       r   test_python_shebangz$IsPythonFileTest.test_python_shebang  s    GGLL));7E	eS	 &Qgg$%&OON//67GGLL))?;E	eS	 $Qgg"#$OON//67& &
$ $s   C*+C6*C36C?c                    t         j                  j                  | j                  d      }t	        j
                  |dd      5 }|j                  d       d d d        | j                  t        j                  |             y # 1 sw Y   .xY w)Nr   r-   zlatin-1)modeencodingr   )
r	   r/   r0   r   r   open_with_encodingrH   r   r   r   r   r   r8   s      r   test_with_latin_encodingz)IsPythonFileTest.test_with_latin_encoding  si    GGLL));7E		%	%e#		J $agg"#$OON//67$ $s   BBc                 &   t         j                  j                  | j                  d      }t	        |d      5 }|j                  d       |j                  d       d d d        | j                  t        j                  |             y # 1 sw Y   .xY w)Nr   r-   r   z# -*- coding: iso-3-14159 -*-
)	r	   r/   r0   r   r1   rH   r   r   r   r   s      r   test_with_invalid_encodingz+IsPythonFileTest.test_with_invalid_encoding  sr    GGLL));7E	eS	 2Qgg"#gg012 	^00782 2s   #BBN)
rV   rW   rX   r    r'   r   r   r   r   r   r\   r"   r   r   r     s%    *$89	889r"   r   c                       e Zd Zd Zd Zd Zy)IsIgnoredTestc                     | j                  t        j                  ddg             | j                  t        j                  ddg             y )Nmediamedia/*)r   r   	IsIgnoredr   r   s    r   test_root_pathzIsIgnoredTest.test_root_path  s:    OON,,Wwi@A^--g	{CDr"   c                     | j                  t        j                  ddg             | j                  t        j                  ddg             | j                  t        j                  ddg             y )Nzmedia/az*/azmedia/br   z	media/b/cz*/*/c)r   r   r   r   s    r   test_sub_pathzIsIgnoredTest.test_sub_path  sS    OON,,Y@AOON,,YDEOON,,[7)DEr"   c                     | j                  t        j                  ddg             | j                  t        j                  ddt        j                  j
                  z   g             y )Nz)r   r   r   r	   r/   r   r   s    r   test_trailing_slashz!IsIgnoredTest.test_trailing_slash  sF    OON,,S3%89OON,,S33D2EFGr"   N)rV   rW   rX   r   r   r   r\   r"   r   r   r     s    EF
Hr"   r   c                   (    e Zd Zd Zd Zed        Zy)BufferedByteStreamc                 6    t        j                         | _        y r   )r   BytesIOstreamr   s    r   __init__zBufferedByteStream.__init__  s    ##%DKr"   c                 T    | j                   j                         j                  d      S )Nutf-8)r   getvaluedecoder   s    r   r   zBufferedByteStream.getvalue  s     ;;!((11r"   c                     | j                   S r   )r   r   s    r   bufferzBufferedByteStream.buffer  s    ;;r"   N)rV   rW   rX   r   r   propertyr   r\   r"   r   r   r     s     &2  r"   r   c                   >    e Zd Zed        Zed        Zd Zd Zd Zy)WriteReformattedCodeTestc                 6    t        j                         | _        y r   r   clss    r   
setUpClassz#WriteReformattedCodeTest.setUpClass  s    &&(COr"   c                 B    t        j                  | j                         y r   r$   r   s    r   tearDownClassz&WriteReformattedCodeTest.tearDownClass  s    
MM#//"r"   c                 J   d}t        j                  | j                        5 \  }}t        j                  ||dd       |j                          t        |      5 }| j                  |j                         |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nzfoobar
)dirnameTr   in_placer   )	r   NamedTempFiler   r   WriteReformattedCodeflushr1   r3   read)r   sr8   fnamef2s        r   test_write_to_filez+WriteReformattedCodeTest.test_write_to_file  s    A			T%5%5	6 '*1e))
TG5ggi; '"A&'' '
' '' 's#   8B!B<BB	BB"c                 *   d}t         j                  r
t               nt        j                         }t	        j
                  |      5  t        j                  d |dd       d d d        | j                  |j                         |       y # 1 sw Y   *xY w)NfoobarFr   r  
r   PY3r   StringIOr   stdout_redirectorr   r  r3   r   r   r  r   s      r   test_write_to_stdoutz-WriteReformattedCodeTest.test_write_to_stdout  st    A%.]]!	8J8J8LF		 	 	( 5))
EG55 	V__&*5 5   B		Bc                 *   d}t         j                  r
t               nt        j                         }t	        j
                  |      5  t        j                  d |dd       d d d        | j                  |j                         |       y # 1 sw Y   *xY w)Nu-   ﻿# -*- coding: utf-8 -*-
result = "passed"
Fr   r  r  r  s      r   test_write_encoded_to_stdoutz5WriteReformattedCodeTest.test_write_encoded_to_stdout  st    <A%.]]!	8J8J8LF		 	 	( 5))
EG55 	V__&*5 5r  N)	rV   rW   rX   classmethodr   r   r
  r  r  r\   r"   r   r   r     s7    ) ) # #'++r"   r   c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	LineEndingTestc                 Z    ddg}t        j                  |      }| j                  |d       y )Nspam
r.   r   
LineEndingr3   r   linesr   s      r   test_line_ending_linefeedz(LineEndingTest.test_line_ending_linefeed  ,    x E&&u-FVT"r"   c                 Z    ddg}t        j                  |      }| j                  |d       y )Nspamr  r  s      r    test_line_ending_carriage_returnz/LineEndingTest.test_line_ending_carriage_return  r   r"   c                 Z    ddg}t        j                  |      }| j                  |d       y )Nspam
z
r  r  s      r   test_line_ending_comboz%LineEndingTest.test_line_ending_combo$  s,    $E&&u-FVV$r"   c                 Z    g d}t        j                  |      }| j                  |d       y )N)r  r  r"  r&  r.   r  r  s      r   test_line_ending_weightedz(LineEndingTest.test_line_ending_weighted)  +    E &&u-FVT"r"   c                 V    g }t        j                  |      }| j                  |d       y )Nr.   r  r  s      r   test_line_ending_emptyz%LineEndingTest.test_line_ending_empty3  s'    E&&u-FVT"r"   c                 X    dg}t        j                  |      }| j                  |d       y )Nspamr.   r  r  s      r   test_line_ending_no_newlinez*LineEndingTest.test_line_ending_no_newline8  s)    HE&&u-FVT"r"   c                 Z    g d}t        j                  |      }| j                  |d       y )N)r  r  r&  r&  r.   r  r  s      r   test_line_ending_tiez#LineEndingTest.test_line_ending_tie=  r*  r"   N)
rV   rW   rX   r  r$  r'  r)  r,  r/  r1  r\   r"   r   r  r    s%    #
#
%
##
#
#r"   r  __main__)__doc__
contextlibr	   r%   r   rY   yapf.yapflibr   r   r   	yapftestsr   contextmanagerr   r   TestCaser   r^   r   r   r   r   objectr   r   r  rV   mainr\   r"   r   <module>r;     s   %  	     ' "    / /]!x00 ]!@W= 1 1 W=t
xEh// xEv(9x(( (9VHH%% H 
 
"+x00 "+J-#X&& -#` z(--/ r"   