
    `N`	                         d 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 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 ddlmZ  G d dej                  ZddZdS )z"Support module for tests for yapf.    N)blank_line_calculator)comment_splicer)continuation_splicer)identify_container)pytree_unwrapper)pytree_utils)pytree_visitor)split_penalty)style)subtype_assignerc                       e Zd Zd ZdS )YAPFTestc           	         ||k    rrddg}t          j        d          }|                                D ]F}t          |          |k    r|                    d|z             .|                    d|z             G|                    d           |                                D ]F}t          |          |k    r|                    d|z             .|                    d|z             G|                    d           |                    t          j        |                                |                                dd	d
                     |                     d	                    |                     d S d S )NzCode format mismatch:z	Expected:COLUMN_LIMITz!> %sz > %szActual:zDiff:actualexpected )fromfiletofilelineterm
)
r   Get
splitlineslenappendextenddifflibunified_difffailjoin)selfexpected_codecodemsglinelenls         :lib/python3.11/site-packages/yapftests/yapf_test_helper.pyassertCodeEqualzYAPFTest.assertCodeEqual"   s   }$k2c	.))g'')) " "!q66G
**Wq[
!
!
!
!
**Wq[
!
!
!
!	jj   " "!q66G
**Wq[
!
!
!
!
**Wq[
!
!
!
!	jj	jj

oo&&((     ii		#-     N)__name__
__module____qualname__r(    r)   r'   r   r       s#                 r)   r   Fc                    t          j        |           }t          j        |           t	          j        |           t          j        |           t          j	        |           t          j        |           t          j        |           |r t          j        |t           j                   t%          j        |          }|D ]}|                                 |S )aZ  Produces unwrapped lines from the given code.

  Parses the code into a tree, performs comment splicing and runs the
  unwrapper.

  Arguments:
    code: code to parse as a string
    dumptree: if True, the parsed pytree (after comment splicing) is dumped
              to stderr. Useful for debugging.

  Returns:
    List of unwrapped lines.
  )target_stream)r   ParseCodeToTreer   SpliceCommentsr   SpliceContinuationsr   AssignSubtypesr   IdentifyContainersr
   ComputeSplitPenaltiesr   CalculateBlankLinesr	   
DumpPyTreesysstderrr   UnwrapPyTreeCalculateFormattingInformation)r#   dumptreetreeuwlinesuwls        r'   ParseAndUnwrapr@   <   s     
	%d	+	+$ &&&*4000!$''''---%d++++D111 >d#*====)$//' ) )c&&((((	.r)   )F)__doc__r   r8   unittestyapf.yapflibr   r   r   r   r   r   r	   r
   r   r   TestCaser   r@   r-   r)   r'   <module>rE      s'   ) (  



  . . . . . . ( ( ( ( ( ( - - - - - - + + + + + + ) ) ) ) ) ) % % % % % % ' ' ' ' ' ' & & & & & &       ) ) ) ) ) )         x       8     r)   