
    `N`f                        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  G d dej	                  Z
ed	k    r ej                     dS dS )
z!Basic tests for yapf.reformatter.    N)	py3compat)reformatter)style)yapf_test_helperc                      e Zd Ze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 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- Z0d. Z1d/ Z2d0 Z3d1 Z4d2 Z5d3 Z6d4 Z7d5 Z8d6 Z9d7 Z:d8 Z;d9 Z<d: Z=d; Z>d< Z?d= Z@d> ZAd? ZBd@ ZCdA ZDdB ZEdC ZFdD ZGdE ZHdF ZIdG ZJdH ZKdI ZLdJ ZMdK ZNdL ZOdM ZPdN ZQdO ZRdP ZSdQ ZTdR ZUdS ZVdT ZWdU ZXdV ZYdW ZZdX Z[dY Z\dZ Z]d[ Z^d\ Z_d] Z`d^ Zad_ Zbd` Zcda Zddb Zedc Zfdd Zgde Zhdf Zidg Zjdh Zkdi Zldj Zmdk Zndl Zodm Zpdn Zqdo Zrdp Zsdq Ztdr Zuds Zvdt Zwdu Zxdv Zydw Zzdx Z{dy Z|dz Z}d{ Z~d| Zd} Zd~ Zd Z ej        ej         d          d             Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ej        ej        d          d             ZdS )BasicReformatterTestc                 P    t          j        t          j                               d S )N)r   SetGlobalStyleCreateYapfStyle)clss    @lib/python3.11/site-packages/yapftests/reformatter_basic_test.py
setUpClasszBasicReformatterTest.setUpClass   s"    	.0011111    c                    t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d	          }t          j        |          }|                     |t          j	        |                     t          j        d
          }t          j        d
          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     d S )Nz:{split_all_comma_separated_values: true, column_limit: 40}c          responseDict = {"timestamp": timestamp, "someValue":   value, "whatever": 120}
                    responseDict = {
              "timestamp": timestamp,
              "someValue": value,
              "whatever": 120
          }
          z8          yes = { 'yes': 'no', 'no': 'yes', }
          z^          yes = {
              'yes': 'no',
              'no': 'yes',
          }
                    def foo(long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args):
                pass
                    def foo(long_arg,
                  really_long_arg,
                  really_really_long_arg,
                  cant_keep_all_these_args):
            pass
          n          foo_tuple = [long_arg, really_long_arg, really_really_long_arg, cant_keep_all_these_args]
                    foo_tuple = [
              long_arg,
              really_long_arg,
              really_really_long_arg,
              cant_keep_all_these_args
          ]
          -          foo_tuple = [short, arg]
          w          someLongFunction(this_is_a_very_long_parameter,
              abc=(a, this_will_just_fit_xxxxxxx))
          z          someLongFunction(
              this_is_a_very_long_parameter,
              abc=(a,
                   this_will_just_fit_xxxxxxx))
          )
r   r
   CreateStyleFromConfigtextwrapdedentr   ParseAndUnwrapassertCodeEqualr   Reformatselfunformatted_codeexpected_formatted_codeuwliness       r   testSplittingAllArgsz)BasicReformatterTest.testSplittingAllArgs    s   	#H	J 	JK K K   (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP   (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                    t          j        t          j        d                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d	          }t          j        d
          }t          j        |          }t          j	        |          }| 
                    dt          |                                d                              |                     ||           t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j	        |                     d S )NzD{split_all_top_level_comma_separated_values: true, column_limit: 40}r   r   r   r   r   r   r   r   z          someLongFunction(
              this_is_a_very_long_parameter,
              abc=(a, this_will_just_fit_xxxxxxx))
          (   zx          someLongFunction(this_is_a_very_long_parameter,
              abc=(a, this_will_not_fit_xxxxxxxxx))
          z          someLongFunction(
              this_is_a_very_long_parameter,
              abc=(a,
                   this_will_not_fit_xxxxxxxxx))
          za          a, b = f(
              a_very_long_parameter, yet_another_one, and_another)
          z          KO = {
              'ABC': Abc, # abc
              'DEF': Def, # def
              'LOL': Lol, # wtf
              'GHI': Ghi,
              'JKL': Jkl,
          }
          z          KO = {
              'ABC': Abc,  # abc
              'DEF': Def,  # def
              'LOL': Lol,  # wtf
              'GHI': Ghi,
              'JKL': Jkl,
          }
          )r   r
   r   r   r   r   r   r   r   r   assertEquallen
splitlines)r    r!   r"   r#   actual_formatted_codes        r   testSplittingTopLevelAllArgsz1BasicReformatterTest.testSplittingTopLevelAllArgsm   s   	#R	
 	
  
   (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPP   (   'o /  
 -.>??G'099R2==??CDDEEE02GHHH (   'o /   -.>??G0+2Fw2O2OPPP   (   'o /   -.>??G0+2Fw2O2OPPP   (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          def g():  # Trailing comment
          if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and
              xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
            pass

        def f(  # Intermediate comment
        ):
          if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and
              xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
            pass
        a          def g():  # Trailing comment
          if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and
              xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
            pass


        def f(  # Intermediate comment
        ):
          if (xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0]) == 'aaaaaaaaaaa' and
              xxxxxxxxxxxx.yyyyyyyy(zzzzzzzzzzzzz[0].mmmmmmmm[0]) == 'bbbbbbb'):
            pass
        r   r   r   r   r   r   r   r   s       r   'testSimpleFunctionsWithTrailingCommentsz<BasicReformatterTest.testSimpleFunctionsWithTrailingComments   sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }	 t          j        t          j	        d                     t          j        |          }|                     |t          j        |                     t          j        t          j
                               n*# t          j        t          j
                               w xY wt          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d	          }t          j        |          }|                     |t          j        |                     t          j        d
          }t          j        d
          }t          j        |          }|                     |t          j        |                     d S )Nz6        import foo as bar
        VAR = 'baz'
        z7        import foo as bar

        VAR = 'baz'
        z8        import foo as bar


        VAR = 'baz'
        zN{based_on_style: yapf, blank_lines_between_top_level_imports_and_variables: 2}z9        import foo as bar
        # Some comment
        zF        import foo as bar
        class Baz():
          pass
        zH        import foo as bar


        class Baz():
          pass
        zG        import foo as bar
        def foobar():
          pass
        zI        import foo as bar


        def foobar():
          pass
        zP        def foobar():
          from foo import Bar
          Bar.baz()
        r   r   r   r   r   r   r   r   r
   r   r   r   s       r   0testBlankLinesBetweenTopLevelImportsAndVariableszEBasicReformatterTest.testBlankLinesBetweenTopLevelImportsAndVariables   s    (   'o /  
 -.>??G0+2Fw2O2OPPP (  
 'o /  	4

%^    !/0@AAg
2&/88: : : 50223333e50223333 (   'o /   -.>??G0+2Fw2O2OPPP (  
 'o /   -.>??G0+2Fw2O2OPPP (  
 'o /   -.>??G0+2Fw2O2OPPP (  
 'o /  
 -.>??G0+2Fw2O2OPPPPPs   A"D 'D=c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz5        def foobar(): # foo
         pass



        z4        def foobar():  # foo
          pass
        z9        x = {  'a':37,'b':42,

        'c':927}

        z1        x = {'a': 37, 'b': 42, 'c': 927}
        r.   r   s       r   testBlankLinesAtEndOfFilez.BasicReformatterTest.testBlankLinesAtEndOfFileY  s     (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                    t          j        d          }d}	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               n*# t          j        t          j
                               w xY w||}}t          j        |          }|                     |t          j	        |                     d S )Nz        class foo(object):

          def foobar(self):

            pass

          def barfoo(self, x, y):  # bar

            if x:

              return y


        def bar():

          return 0
        zclass foo(object):
  
  def foobar(self):
    
    pass
  
  def barfoo(self, x, y):  # bar
    
    if x:
      
      return y


def bar():
  
  return 0
z0{based_on_style: yapf, indent_blank_lines: true}r   r   r   r
   r   r   r   r   r   r   r   r   s       r   testIndentBlankLinesz)BasicReformatterTest.testIndentBlankLinest  s    (  $	4

%@B BC C C !/0@AAg
2&/88: : : 50223333e502233331H1A .-.>??G0+2Fw2O2OPPPPPs   A"B   'Cc                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nau          x = {  'a':37,'b':42,

        'c':927}

        y = 'hello ''world'
        z = 'hello '+'world'
        a = 'hello {}'.format('world')
        class foo  (     object  ):
          def f    (self   ):
            return       37*-+2
          def g(self, x,y=42):
              return y
        def f  (   a ) :
          return      37+-+a[42-x :  y**3]
        aW          x = {'a': 37, 'b': 42, 'c': 927}

        y = 'hello ' 'world'
        z = 'hello ' + 'world'
        a = 'hello {}'.format('world')


        class foo(object):

          def f(self):
            return 37 * -+2

          def g(self, x, y=42):
            return y


        def f(a):
          return 37 + -+a[42 - x:y**3]
        r.   r   s       r   testMultipleUglinessz)BasicReformatterTest.testMultipleUgliness  sm     (    'o /  ( -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          class Foo(object):
          pass

        # Attached comment
        class Bar(object):
          pass

        global_assignment = 42

        # Comment attached to class with decorator.
        # Comment attached to class with decorator.
        @noop
        @noop
        class Baz(object):
          pass

        # Intermediate comment

        class Qux(object):
          pass
        a          class Foo(object):
          pass


        # Attached comment
        class Bar(object):
          pass


        global_assignment = 42


        # Comment attached to class with decorator.
        # Comment attached to class with decorator.
        @noop
        @noop
        class Baz(object):
          pass


        # Intermediate comment


        class Qux(object):
          pass
        r.   r   s       r   testCommentsz!BasicReformatterTest.testComments  sm     (  , 'o /  6 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        # Thing 1
        r.   r    coder#   s      r   testSingleCommentz&BasicReformatterTest.testSingleComment  Q    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz4        # Thing 1    
        # Thing 2    
        z,        # Thing 1
        # Thing 2
        r.   r   s       r   testCommentsWithTrailingSpacesz3BasicReformatterTest.testCommentsWithTrailingSpaces  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          def f():
          return collections.OrderedDict({
              # First comment.
              'fnord': 37,

              # Second comment.
              # Continuation of second comment.
              'bork': 42,

              # Ending comment.
          })
        r.   r=   s      r   testCommentsInDataLiteralz.BasicReformatterTest.testCommentsInDataLiteral  sQ    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzF        import foo as bar
        # Thing 1
        # Thing 2
        r.   r=   s      r   (testEndingWhitespaceAfterSimpleStatementz=BasicReformatterTest.testEndingWhitespaceAfterSimpleStatement  Q    ?   D
 -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nah          u"""Module-level docstring."""
        import os
        class Foo(object):

          """Class-level docstring."""
          # A comment for qux.
          def qux(self):


            """Function-level docstring.

            A multiline function docstring.
            """
            print('hello {}'.format('world'))
            return 42
        ah          u"""Module-level docstring."""
        import os


        class Foo(object):
          """Class-level docstring."""

          # A comment for qux.
          def qux(self):
            """Function-level docstring.

            A multiline function docstring.
            """
            print('hello {}'.format('world'))
            return 42
        r.   r   s       r   testDocstringsz#BasicReformatterTest.testDocstrings%  sm     (  " 'o /  " -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na:          """Hello world"""
        # A multiline
        # comment
        class bar(object):
          """class docstring"""
          # class multiline
          # comment
          def foo(self):
            """Another docstring."""
            # Another multiline
            # comment
            pass
        a=          """Hello world"""


        # A multiline
        # comment
        class bar(object):
          """class docstring"""

          # class multiline
          # comment
          def foo(self):
            """Another docstring."""
            # Another multiline
            # comment
            pass
        r.   r   s       r    testDocstringAndMultilineCommentz5BasicReformatterTest.testDocstringAndMultilineCommentK  sm     (   'o /  " -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          """Hello world

        RIP Dennis Richie.
        """
        # A multiline
        # comment
        class bar(object):
          """class docstring

          A classy class.
          """
          # class multiline
          # comment
          def foo(self):
            """Another docstring.

            A functional function.
            """
            # Another multiline
            # comment
            pass
        a          """Hello world

        RIP Dennis Richie.
        """


        # A multiline
        # comment
        class bar(object):
          """class docstring

          A classy class.
          """

          # class multiline
          # comment
          def foo(self):
            """Another docstring.

            A functional function.
            """
            # Another multiline
            # comment
            pass
        r.   r   s       r   )testMultilineDocstringAndMultilineCommentz>BasicReformatterTest.testMultilineDocstringAndMultilineCommentn  sm     (  . 'o /  4 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        a = ( 1, )
        z        a = (1,)
        r.   r   s       r   testTupleCommaBeforeLastParenz2BasicReformatterTest.testTupleCommaBeforeLastParen  m     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzw        def f():
          assert port >= minimum, 'Unexpected port %d when minimum was %d.' % (port, minimum)
        z        def f():
          assert port >= minimum, 'Unexpected port %d when minimum was %d.' % (port,
                                                                               minimum)
        r.   r   s       r   testNoBreakOutsideOfBracketz0BasicReformatterTest.testNoBreakOutsideOfBracket  so       (  
 'o /  
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzz        @foo()
        class A(object):
          @bar()
          @baz()
          def x(self):
            pass
        z{        @foo()
        class A(object):

          @bar()
          @baz()
          def x(self):
            pass
        r.   r   s       r   testBlankLinesBeforeDecoratorsz3BasicReformatterTest.testBlankLinesBeforeDecorators  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz[        @foo()
        # frob
        @bar
        def x  (self):
            pass
        zW        @foo()
        # frob
        @bar
        def x(self):
          pass
        r.   r   s       r   testCommentBetweenDecoratorsz1BasicReformatterTest.testCommentBetweenDecorators  m     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzR        def given(y):
            [k for k in ()
              if k in y]
        zB        def given(y):
          [k for k in () if k in y]
        r.   r   s       r   testListComprehensionz*BasicReformatterTest.testListComprehension  sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def given(y):
            long_variable_name = [
                long_var_name + 1
                for long_var_name in ()
                if long_var_name == 2]
        z        def given(y):
          long_variable_name = [
              long_var_name + 1 for long_var_name in () if long_var_name == 2
          ]
        r.   r   s       r   "testListComprehensionPreferOneLinez7BasicReformatterTest.testListComprehensionPreferOneLine  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def given(used_identifiers):
          return (sum(len(identifier)
                      for identifier in used_identifiers) / len(used_identifiers))
        z        def given(used_identifiers):
          return (sum(len(identifier) for identifier in used_identifiers) /
                  len(used_identifiers))
        r.   r   s       r   5testListComprehensionPreferOneLineOverArithmeticSplitzJBasicReformatterTest.testListComprehensionPreferOneLineOverArithmeticSplit  m     (  
 'o /  
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def given(y):
            long_variable_name = [
                long_var_name + 1
                for long_var_name, number_two in ()
                if long_var_name == 2 and number_two == 3]
        z        def given(y):
          long_variable_name = [
              long_var_name + 1
              for long_var_name, number_two in ()
              if long_var_name == 2 and number_two == 3
          ]
        r.   r   s       r   0testListComprehensionPreferThreeLinesForLineWrapzEBasicReformatterTest.testListComprehensionPreferThreeLinesForLineWrap  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def given(y):
            long_variable_name = [
                long_var_name
                for long_var_name, number_two in ()
                if long_var_name == 2 and number_two == 3]
        z        def given(y):
          long_variable_name = [
              long_var_name for long_var_name, number_two in ()
              if long_var_name == 2 and number_two == 3
          ]
        r.   r   s       r   6testListComprehensionPreferNoBreakForTrivialExpressionzKBasicReformatterTest.testListComprehensionPreferNoBreakForTrivialExpression#  rW   r   c                     d}d}t          j        |          }|                     |t          j        |                     d S )Nz5foo( (1, ) )
foo( ( 1, 2, 3  ) )
foo( ( 1, 2, 3, ) )
z7foo((1,))
foo((1, 2, 3))
foo((
    1,
    2,
    3,
))
r   r   r   r   r   r   s       r   testOpeningAndClosingBracketsz2BasicReformatterTest.testOpeningAndClosingBrackets5  sM    
 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz&        def foo():  return 42
        z/        def foo():
          return 42
        r.   r   s       r   testSingleLineFunctionsz,BasicReformatterTest.testSingleLineFunctionsG  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     d}d}t          j        |          }|                     |t          j        |                     d S )NzUfind_symbol(node.type) + "< " + " ".join(find_pattern(n) for n in node.child) + " >"
zZfind_symbol(node.type) + "< " + " ".join(
    find_pattern(n) for n in node.child) + " >"
rd   r   s       r   !testNoQueueSeletionInMiddleOfLinez6BasicReformatterTest.testNoQueueSeletionInMiddleOfLineR  sM     -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz>        aaaaaaaaaa = bbbbbbbb.ccccccccc() [42] (a, 2)
        z<        aaaaaaaaaa = bbbbbbbb.ccccccccc()[42](a, 2)
        r.   r   s       r   %testNoSpacesBetweenSubscriptsAndCallsz:BasicReformatterTest.testNoSpacesBetweenSubscriptsAndCalls`  rP   r   c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz=        aaaaaaaaaa = bbbbbbbb.ccccccccc[ -1 ]( -42 )
        z9        aaaaaaaaaa = bbbbbbbb.ccccccccc[-1](-42)
        zp        aaaaaaaaaa = bbbbbbbb.ccccccccc( *varargs )
        aaaaaaaaaa = bbbbbbbb.ccccccccc( **kwargs )
        zl        aaaaaaaaaa = bbbbbbbb.ccccccccc(*varargs)
        aaaaaaaaaa = bbbbbbbb.ccccccccc(**kwargs)
        r.   r   s       r   4testNoSpacesBetweenOpeningBracketAndStartingOperatorzIBasicReformatterTest.testNoSpacesBetweenOpeningBracketAndStartingOperatorj  s     (   'o /   -.>??G0+2Fw2O2OPPP   (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzc        if True:
            # This is a multiline
            # comment.
            pass
        z]        if True:
          # This is a multiline
          # comment.
          pass
        r.   r   s       r   testMultilineCommentReformattedz4BasicReformatterTest.testMultilineCommentReformatted  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          _PYTHON_STATEMENTS = frozenset({
            lambda x, y: 'simple_stmt': 'small_stmt', 'expr_stmt': 'print_stmt', 'del_stmt':
            'pass_stmt', lambda: 'break_stmt': 'continue_stmt', 'return_stmt': 'raise_stmt',
            'yield_stmt': 'import_stmt', lambda: 'global_stmt': 'exec_stmt', 'assert_stmt':
            'if_stmt', 'while_stmt': 'for_stmt',
        })
        a          _PYTHON_STATEMENTS = frozenset({
            lambda x, y: 'simple_stmt': 'small_stmt',
            'expr_stmt': 'print_stmt',
            'del_stmt': 'pass_stmt',
            lambda: 'break_stmt': 'continue_stmt',
            'return_stmt': 'raise_stmt',
            'yield_stmt': 'import_stmt',
            lambda: 'global_stmt': 'exec_stmt',
            'assert_stmt': 'if_stmt',
            'while_stmt': 'for_stmt',
        })
        r.   r   s       r   testDictionaryMakerFormattingz2BasicReformatterTest.testDictionaryMakerFormatting  m     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if True:
          aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy, vvvvvvvvv)
          aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy, vvvvvvvvv)
        aA          if True:
          aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy,
                                                vvvvvvvvv)
          aaaaaaaaaaaaaa.bbbbbbbbbbbbbb.ccccccc(zzzzzzzzzzzz, xxxxxxxxxxx, yyyyyyyyyyyy,
                                                vvvvvvvvv)
        r.   r   s       r   testSimpleMultilineCodez,BasicReformatterTest.testSimpleMultilineCode  rW   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if Foo:
          # Hello world
          # Yo man.
          # Yo man.
          # Yo man.
          # Yo man.
          a = 42
        r.   r=   s      r   testMultilineCommentz)BasicReformatterTest.testMultilineComment  Q    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz"        b = '0' ('hello')
        r.   r=   s      r   $testSpaceBetweenStringAndParenthesesz9BasicReformatterTest.testSpaceBetweenStringAndParentheses  r@   r   c                 n   t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        code = textwrap.dedent('''            if Foo:
              # Hello world
              # Yo man.
              # Yo man.
              # Yo man.
              # Yo man.
              a = 42
            ''')
        aW          def f():
            email_text += """<html>This is a really long docstring that goes over the column limit and is multi-line.<br><br>
        <b>Czar: </b>"""+despot["Nicholas"]+"""<br>
        <b>Minion: </b>"""+serf["Dmitri"]+"""<br>
        <b>Residence: </b>"""+palace["Winter"]+"""<br>
        </body>
        </html>"""
        aa          def f():
          email_text += """<html>This is a really long docstring that goes over the column limit and is multi-line.<br><br>
        <b>Czar: </b>""" + despot["Nicholas"] + """<br>
        <b>Minion: </b>""" + serf["Dmitri"] + """<br>
        <b>Residence: </b>""" + palace["Winter"] + """<br>
        </body>
        </html>"""
        r.   )r    r>   r#   r!   r"   s        r   testMultilineStringz(BasicReformatterTest.testMultilineString  s    ? 
 
 
D -d33G{3G<<=== (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na           if (  # This is the first comment
            a and  # This is the second comment
            # This is the third comment
            b):  # A trailing comment
          # Whoa! A normal comment!!
          pass  # Another trailing comment
        r.   r=   s      r   testSimpleMultilineWithCommentsz4BasicReformatterTest.testSimpleMultilineWithComments  Q    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def f():
          raise RuntimeError('unable to find insertion point for target node',
                             (target,))
        r.   r   s       r   "testMatchingParenSplittingMatchingz7BasicReformatterTest.testMatchingParenSplittingMatching   r^   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          class F:
          def _ProcessArgLists(self, node):
            """Common method for processing argument lists."""
            for child in node.children:
              if isinstance(child, pytree.Leaf):
                self._SetTokenSubtype(
                    child, subtype=_ARGLIST_TOKEN_TO_SUBTYPE.get(
                        child.value, format_token.Subtype.NONE))
        a          class F:

          def _ProcessArgLists(self, node):
            """Common method for processing argument lists."""
            for child in node.children:
              if isinstance(child, pytree.Leaf):
                self._SetTokenSubtype(
                    child,
                    subtype=_ARGLIST_TOKEN_TO_SUBTYPE.get(child.value,
                                                          format_token.Subtype.NONE))
        r.   r   s       r   testContinuationIndentz+BasicReformatterTest.testContinuationIndent  sm     	( 	 	 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzD        a = { 42, }
        b = ( 42, )
        c = [ 42, ]
        zj        a = {
            42,
        }
        b = (42,)
        c = [
            42,
        ]
        r.   r   s       r   testTrailingCommaAndBracketz0BasicReformatterTest.testTrailingCommaAndBracket(  sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                 F   t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na           N_('Some years ago - never mind how long precisely - having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.')  # A comment is here.
        a          foo('Fake function call')  #. Some years ago - never mind how long precisely - having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.
        r.   r=   s      r   testI18nzBasicReformatterTest.testI18n:  s    ?   D -d33G{3G<<===?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def f():
          return collections.OrderedDict({
              #. First i18n comment.
              'bork': 'foo',

              #. Second i18n comment.
              'snork': 'bar#.*=\\0',
          })
        r.   r=   s      r   testI18nCommentsInDataLiteralz2BasicReformatterTest.testI18nCommentsInDataLiteralG  sQ    ? 	 	 	D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          def f():

          def g():
            while (xxxxxxxxxxxxxxxxxxxxx(yyyyyyyyyyyyy[zzzzz]) == 'aaaaaaaaaaa' and
                   xxxxxxxxxxxxxxxxxxxxx(
                       yyyyyyyyyyyyy[zzzzz].aaaaaaaa[0]) == 'bbbbbbb'):
              pass
        r.   r=   s      r   testClosingBracketIndentz-BasicReformatterTest.testClosingBracketIndentU  rw   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          class Foo(object):

          def bar(self):
            self.aaaaaaaa = xxxxxxxxxxxxxxxxxxx.yyyyyyyyyyyyy(
                self.cccccc.ddddddddd.eeeeeeee,
                options={
                    "forkforkfork": 1,
                    "borkborkbork": 2,
                    "corkcorkcork": 3,
                    "horkhorkhork": 4,
                    "porkporkpork": 5,
                    })
        a          class Foo(object):

          def bar(self):
            self.aaaaaaaa = xxxxxxxxxxxxxxxxxxx.yyyyyyyyyyyyy(
                self.cccccc.ddddddddd.eeeeeeee,
                options={
                    "forkforkfork": 1,
                    "borkborkbork": 2,
                    "corkcorkcork": 3,
                    "horkhorkhork": 4,
                    "porkporkpork": 5,
                })
        r.   r   s       r    testClosingBracketsInlinedInCallz5BasicReformatterTest.testClosingBracketsInlinedInCallb  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na           class A:

          def x(self, node, name, n=1):
            for i, child in enumerate(
                itertools.ifilter(lambda c: pytree_utils.NodeName(c) == name,
                                  node.pre_order())):
              pass
        r.   r=   s      r   testLineWrapInForExpressionz0BasicReformatterTest.testLineWrapInForExpression  rw   r   c                     d}t          j        |          }|                     |t          j        |                     d S )Nzclass foo:

  def bar(self, node, name, n=1):
    if True:
      if True:
        return [(aaaaaaaaaa,
                 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(
                     cccc, ddddddddddddddddddddddddddddddddddddd))]
rd   r=   s      r    testFunctionCallContinuationLinez5BasicReformatterTest.testFunctionCallContinuationLine  sB    	D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class F(object):

          def __init__(self, fieldname,
                       #. Error message indicating an invalid e-mail address.
                       message=N_('Please check your email address.'), **kwargs):
            pass
        r.   r=   s      r   testI18nNonFormattingz*BasicReformatterTest.testI18nNonFormatting  r~   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz-        if ~(a or b):
          pass
        r.   r=   s      r   (testNoSpaceBetweenUnaryOpAndOpeningParenz=BasicReformatterTest.testNoSpaceBetweenUnaryOpAndOpeningParen  Q    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NaH          class Foo(object):

          a = 42

          # This is a comment.
          def __init__(self,
                       xxxxxxx,
                       yyyyy=0,
                       zzzzzzz=None,
                       aaaaaaaaaaaaaaaaaa=False,
                       bbbbbbbbbbbbbbb=False):
            pass
        r.   r=   s      r   testCommentBeforeFuncDefz-BasicReformatterTest.testCommentBeforeFuncDef  sQ    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na8          class Fnord(object):
          def Moo(self):
            aaaaaaaaaaaaaaaa = self._bbbbbbbbbbbbbbbbbbbbbbb(
                ccccccccccccc=ccccccccccccc, ddddddd=ddddddd, eeee=eeee,
                fffff=fffff, ggggggg=ggggggg, hhhhhhhhhhhhh=hhhhhhhhhhhhh,
                iiiiiii=iiiiiiiiiiiiii)
        ay          class Fnord(object):

          def Moo(self):
            aaaaaaaaaaaaaaaa = self._bbbbbbbbbbbbbbbbbbbbbbb(
                ccccccccccccc=ccccccccccccc,
                ddddddd=ddddddd,
                eeee=eeee,
                fffff=fffff,
                ggggggg=ggggggg,
                hhhhhhhhhhhhh=hhhhhhhhhhhhh,
                iiiiiii=iiiiiiiiiiiiii)
        r.   r   s       r   &testExcessLineCountWithDefaultKeywordsz;BasicReformatterTest.testExcessLineCountWithDefaultKeywords  rr   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz7        if not (this and that):
          pass
        r.   r=   s      r   testSpaceAfterNotOperatorz.BasicReformatterTest.testSpaceAfterNotOperator  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def f():
          if True:
            if True:
              python_files.extend(
                  os.path.join(filename, f)
                  for f in os.listdir(filename)
                  if IsPythonFile(os.path.join(filename, f)))
        r.   r=   s      r   testNoPenaltySplittingz+BasicReformatterTest.testNoPenaltySplitting  rw   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      def f():
        if ((left.value == '(' and right.value == ')') or
            (left.value == '[' and right.value == ']') or
            (left.value == '{' and right.value == '}')):
          return False
        r.   r=   s      r   testExpressionPenaltiesz,BasicReformatterTest.testExpressionPenalties  Q    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        while True: continue
        for x in range(3): continue
        try: a = 42
        except: b = 42
        with open(a) as fd: a = fd.read()
        z        while True:
          continue
        for x in range(3):
          continue
        try:
          a = 42
        except:
          b = 42
        with open(a) as fd:
          a = fd.read()
        r.   r   s       r   "testLineDepthOfSingleLineStatementz7BasicReformatterTest.testLineDepthOfSingleLineStatement  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        FOO = ['bar', 'baz', 'mux', 'qux', 'quux', 'quuux', 'quuuux',
          'quuuuux', 'quuuuuux', 'quuuuuuux', lambda a, b: 37,]
        a          FOO = [
            'bar',
            'baz',
            'mux',
            'qux',
            'quux',
            'quuux',
            'quuuux',
            'quuuuux',
            'quuuuuux',
            'quuuuuuux',
            lambda a, b: 37,
        ]
        r.   r   s       r   !testSplitListWithTerminatingCommaz6BasicReformatterTest.testSplitListWithTerminatingComma  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nav          FOO = [
            'bar',  # bar
            'baz',  # baz
            'mux',  # mux
            'qux',  # qux
            'quux',  # quux
            'quuux',  # quuux
            'quuuux',  # quuuux
            'quuuuux',  # quuuuux
            'quuuuuux',  # quuuuuux
            'quuuuuuux',  # quuuuuuux
            lambda a, b: 37  # lambda
        ]
        r.   r=   s      r   %testSplitListWithInterspersedCommentsz:BasicReformatterTest.testSplitListWithInterspersedComments*  sQ    ?   D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz%        from ... import bork
        r.   r=   s      r   testRelativeImportStatementsz1BasicReformatterTest.testRelativeImportStatements=  r@   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = aaaaaaaaaaa(
            ("...", "."), "..",
            ".............................................."
        )
        z        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb = aaaaaaaaaaa(
            ("...", "."), "..", "..............................................")
        r.   r   s       r   testSingleLineListz'BasicReformatterTest.testSingleLineListD  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na5          import signal


        try:
          signal.SIGALRM
          # ..................................................................
          # ...............................................................


          def timeout(seconds=1):
            pass
        except:
          pass
        a5          import signal

        try:
          signal.SIGALRM

          # ..................................................................
          # ...............................................................


          def timeout(seconds=1):
            pass
        except:
          pass
        r.   r   s       r   ,testBlankLinesBeforeFunctionsNotInColumnZerozABasicReformatterTest.testBlankLinesBeforeFunctionsNotInColumnZeroS  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class A(object):

          def b(self):
            if self.aaaaaaaaaaaaaaaaaaaa not in self.bbbbbbbbbb(
                cccccccccccccccccccc=True):
              pass
        r.   r=   s      r   testNoKeywordArgumentBreakagez2BasicReformatterTest.testNoKeywordArgumentBreakageu  r~   r   c                     d}t          j        |          }|                     |t          j        |                     d S )Nzurlpatterns = patterns('', url(r'^$', 'homepage_view'),
                       url(r'^/login/$', 'login_view'),
                       url(r'^/login/$', 'logout_view'),
                       url(r'^/user/(?P<username>\w+)/$', 'profile_view'))
rd   r=   s      r   testTrailerOnSingleLinez,BasicReformatterTest.testTrailerOnSingleLine  sB    D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class Foo:

          def bar():
            if True:
              if (child.type == grammar_token.NAME and
                  child.value in substatement_names):
                pass
        r.   r=   s      r   testIfConditionalParensz,BasicReformatterTest.testIfConditionalParens  rw   r   c                    t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. "\
               "Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur "\
               "ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis "\
               "sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. "\
               "Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet"
        z        from __future__ import nested_scopes, generators, division, absolute_import, with_statement, \
            print_function, unicode_literals
        zl        if aaaaaaaaa == 42 and bbbbbbbbbbbbbb == 42 and \
           cccccccc == 42:
          pass
        r.   r=   s      r   testContinuationMarkersz,BasicReformatterTest.testContinuationMarkers  s    ?   D -d33G{3G<<===?   D -d33G{3G<<===?   D
 -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def fn(arg):
          v = fn2(key1=True,
                  #c1
                  key2=arg)\
                        .fn3()
        r.   r=   s      r   #testCommentsWithContinuationMarkersz8BasicReformatterTest.testCommentsWithContinuationMarkers  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz?        xyz = \
            \
            some_thing()
        r.   r=   s      r   testMultipleContinuationMarkersz4BasicReformatterTest.testMultipleContinuationMarkers  rG   r   c                     d}t          j        |          }|                     |t          j        |                     d S )Nz$s = 'foo \
    bar' \
    .format()
rd   r=   s      r   1testContinuationMarkerAfterStringWithContinuationzFBasicReformatterTest.testContinuationMarkerAfterStringWithContinuation  sB    D
 -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        flags.DEFINE_list(
            'output_dirs', [],
            'Lorem ipsum dolor sit amet, consetetur adipiscing elit. Donec a diam lectus. '
            'Sed sit amet ipsum mauris. Maecenas congue.')
        r.   r=   s      r   testEmptyContainersz(BasicReformatterTest.testEmptyContainers  Q    ?   D -d33G{3G<<=====r   c                 n   t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        a = foo.bar({'xxxxxxxxxxxxxxxxxxxxxxx' 'yyyyyyyyyyyyyyyyyyyyyyyyyy': baz[42]} + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' 'bbbbbbbbbbbbbbbbbbbbbbbbbb' 'cccccccccccccccccccccccccccccccc' 'ddddddddddddddddddddddddddddd')
        aP          a = foo.bar({'xxxxxxxxxxxxxxxxxxxxxxx'
                     'yyyyyyyyyyyyyyyyyyyyyyyyyy': baz[42]} +
                    'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
                    'bbbbbbbbbbbbbbbbbbbbbbbbbb'
                    'cccccccccccccccccccccccccccccccc'
                    'ddddddddddddddddddddddddddddd')
        z        a = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' 'bbbbbbbbbbbbbbbbbbbbbbbbbb' 'cccccccccccccccccccccccccccccccc' 'ddddddddddddddddddddddddddddd'
        r.   r    r!   r"   r#   r>   s        r   $testSplitStringsIfSurroundedByParensz9BasicReformatterTest.testSplitStringsIfSurroundedByParens  s     (   'o /   -.>??G0+2Fw2O2OPPP?   D
 -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        #!/bin/sh
        if "true" : ''''
        then

        export FOO=123
        exec /usr/bin/env python "$0" "$@"

        exit 127
        fi
        '''

        import os

        assert os.environ['FOO'] == '123'
        r.   r=   s      r   testMultilineShebangz)BasicReformatterTest.testMultilineShebang  Q    ?   D  -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        a_very_long_function_call_yada_yada_etc_etc_etc(long_arg1,
                                                        long_arg2 / long_arg3)
        r.   r=   s      r   "testNoSplittingAroundTermOperatorsz7BasicReformatterTest.testNoSplittingAroundTermOperators  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        somequitelongvariablename.somemember[(a, b)] = {
            'somelongkey': 1,
            'someotherlongkey': 2
        }
        r.   r=   s      r   "testNoSplittingWithinSubscriptListz7BasicReformatterTest.testNoSplittingWithinSubscriptList  r   r   c                 n   t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class foo:

          def bar(self):
            self.write(s=[
                '%s%s %s' % ('many of really', 'long strings', '+ just makes up 81')
            ])
        z        def _():
          if True:
            if True:
              if contract == allow_contract and attr_dict.get(if_attribute) == has_value:
                return True
        z        def _():
          if True:
            if True:
              if contract == allow_contract and attr_dict.get(
                  if_attribute) == has_value:
                return True
        r.   )r    r>   r#   r!   expected_codes        r   testExcessCharactersz)BasicReformatterTest.testExcessCharacters  s    ?   D -d33G{3G<<=== (   O %  M -.>??G(<W(E(EFFFFFr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        foo = {
            variable: 'hello world. How are you today?'
            for variable in fnord
            if variable != 37
        }
        r.   r=   s      r   testDictSetGeneratorz)BasicReformatterTest.testDictSetGenerator4  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzZ        beta = "123"

        test = {'alpha': beta[-1]}

        print(beta[-1])
        r.   r=   s      r   testUnaryOpInDictionaryValuez1BasicReformatterTest.testUnaryOpInDictionaryValue?  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if True:
          if True:
            if True:
              if True:
                remote_checksum = self.get_checksum(conn, tmp, dest, inject,
                                                    not directory_prepended, source)
        r.   r=   s      r   testUnaryNotOperatorz)BasicReformatterTest.testUnaryNotOperatorJ  r~   r   c                     d}t          j        |          }|                     |t          j        |                     d S )Na  class A(object):

  def f(self, aaaaaaaaa, bbbbbbbbbbbbb, row):
    if True:
      if True:
        if True:
          if True:
            if row[4] is None or row[5] is None:
              bbbbbbbbbbbbb[
                  '..............'] = row[5] if row[5] is not None else 5
rd   r=   s      r   testRelaxArraySubscriptAffinityz4BasicReformatterTest.testRelaxArraySubscriptAffinityV  sB    D -d33G{3G<<=====r   c                     d}t          j        |          }|                     |t          j        |                     d S )Nza = {'a': b(c=d, **e)}
rd   r=   s      r   testFunctionCallInDictz+BasicReformatterTest.testFunctionCallInDictf  s>    %D-d33G{3G<<=====r   c                     d}t          j        |          }|                     |t          j        |                     d S )Nz%a = {'a': {'a': {'a': b(c=d, **e)}}}
rd   r=   s      r   testFunctionCallInNestedDictz1BasicReformatterTest.testFunctionCallInNestedDictk  s>    3D-d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def test():
          if not "Foooooooooooooooooooooooooooooo" or "Foooooooooooooooooooooooooooooo" == "Foooooooooooooooooooooooooooooo":
            pass
        r.   r=   s      r   testUnbreakableNotz'BasicReformatterTest.testUnbreakableNotp  rG   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzU      a = [
          'a',
          'b',
          'c'  # hello world
      ]
      r.   r=   s      r   testSplitListWithCommentz-BasicReformatterTest.testSplitListWithCommenty  Q    ? 
  D -d33G{3G<<=====r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nag        class Test:

        def testSomething(self):
          expected = {
              ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc',
              ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc',
              ('aaaaaaaaaaaaa', 'bbbb'): 'ccccccccccccccccccccccccccccccccccccccccccc',
          }
        a        class Test:

        def testSomething(self):
          expected = {
              ('aaaaaaaaaaaaa', 'bbbb'):
                  'ccccccccccccccccccccccccccccccccccccccccccc',
              ('aaaaaaaaaaaaa', 'bbbb'):
                  'ccccccccccccccccccccccccccccccccccccccccccc',
              ('aaaaaaaaaaaaa', 'bbbb'):
                  'ccccccccccccccccccccccccccccccccccccccccccc',
          }
        r.   r   s       r   testOverColumnLimitz(BasicReformatterTest.testOverColumnLimit  sm     	( 	 	 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      a = f(
          a="something",
          b="something requiring comment which is quite long",  # comment about b (pushes line over 79)
          c="something else, about which comment doesn't make sense")
      r.   r=   s      r   testEndingCommentz&BasicReformatterTest.testEndingComment  Q    ? 
  D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      def fn():
        return module \
               .method(Object(data,
                   fn2(arg)
               ))
      r.   r=   s      r   testContinuationSpaceRetentionz3BasicReformatterTest.testContinuationSpaceRetention  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      if x or z.y(
          a,
          c,
          aaaaaaaaaaaaaaaaaaaaa=aaaaaaaaaaaaaaaaaa,
          bbbbbbbbbbbbbbbbbbbbb=bbbbbbbbbbbbbbbbbb):
        pass
      r.   r=   s      r    testIfExpressionWithFunctionCallz5BasicReformatterTest.testIfExpressionWithFunctionCall  sQ    ? 
  D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzi      def foo():
        com_text = \
      '''
      TEST
      ''' % (input_fname, output_fname)
      r.   r=   s      r   #testUnformattedAfterMultilineStringz8BasicReformatterTest.testUnformattedAfterMultilineString  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      sources = {
          'json': request.get_json(silent=True) or {},
          'json2': request.get_json(silent=True),
      }
      json = request.get_json(silent=True) or {}
      r.   r=   s      r   &testNoSpacesAroundKeywordDefaultValuesz;BasicReformatterTest.testNoSpacesAroundKeywordDefaultValues  r   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if True:
          if True:
            status = cf.describe_stacks(StackName=stackname)[u'Stacks'][0][u'StackStatus']
        z        if True:
          if True:
            status = cf.describe_stacks(
                StackName=stackname)[u'Stacks'][0][u'StackStatus']
        r.   r   s       r   +testNoSplittingBeforeEndingSubscriptBracketz@BasicReformatterTest.testNoSplittingBeforeEndingSubscriptBracket  sm     (  
 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          xxxxxxxxxxxxxx = (re.search(r'(\d+\.\d+\.\d+\.)\d+',
                                    aaaaaaa.bbbbbbbbbbbb).group(1) +
                          re.search(r'\d+\.\d+\.\d+\.(\d+)',
                                    ccccccc).group(1))
        xxxxxxxxxxxxxx = (re.search(r'(\d+\.\d+\.\d+\.)\d+',
                                    aaaaaaa.bbbbbbbbbbbb).group(a.b) +
                          re.search(r'\d+\.\d+\.\d+\.(\d+)',
                                    ccccccc).group(c.d))
        af          xxxxxxxxxxxxxx = (
            re.search(r'(\d+\.\d+\.\d+\.)\d+', aaaaaaa.bbbbbbbbbbbb).group(1) +
            re.search(r'\d+\.\d+\.\d+\.(\d+)', ccccccc).group(1))
        xxxxxxxxxxxxxx = (
            re.search(r'(\d+\.\d+\.\d+\.)\d+', aaaaaaa.bbbbbbbbbbbb).group(a.b) +
            re.search(r'\d+\.\d+\.\d+\.(\d+)', ccccccc).group(c.d))
        r.   r   s       r   testNoSplittingOnSingleArgumentz4BasicReformatterTest.testNoSplittingOnSingleArgument  sm     	( 	 	 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        while True:
          while True:
            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list['bbbbbbbbbbbbbbbbbbbbbbbbb'].split(',')
            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list('bbbbbbbbbbbbbbbbbbbbbbbbb').split(',')
        a          while True:
          while True:
            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list[
                'bbbbbbbbbbbbbbbbbbbbbbbbb'].split(',')
            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = list(
                'bbbbbbbbbbbbbbbbbbbbbbbbb').split(',')
        r.   r   s       r   testSplittingArraysSensiblyz0BasicReformatterTest.testSplittingArraysSensibly  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        class f:

          def __repr__(self):
            tokens_repr = ','.join(['{0}({1!r})'.format(tok.name, tok.value) for tok in self._tokens])
        z        class f:

          def __repr__(self):
            tokens_repr = ','.join(
                ['{0}({1!r})'.format(tok.name, tok.value) for tok in self._tokens])
        r.   r   s       r   testComprehensionForAndIfz.BasicReformatterTest.testComprehensionForAndIf  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          def f():
          if True:
            pytree_utils.InsertNodesBefore(_CreateCommentsFromPrefix(
                comment_prefix, comment_lineno, comment_column,
                standalone=True), ancestor_at_indent)
            pytree_utils.InsertNodesBefore(_CreateCommentsFromPrefix(
                comment_prefix, comment_lineno, comment_column,
                standalone=True))
        a          def f():
          if True:
            pytree_utils.InsertNodesBefore(
                _CreateCommentsFromPrefix(
                    comment_prefix, comment_lineno, comment_column, standalone=True),
                ancestor_at_indent)
            pytree_utils.InsertNodesBefore(
                _CreateCommentsFromPrefix(
                    comment_prefix, comment_lineno, comment_column, standalone=True))
        r.   r   s       r   testFunctionCallArgumentsz.BasicReformatterTest.testFunctionCallArguments  sm     	( 	 	 'o 
/ 
 
 -.>??G0+2Fw2O2OPPPPPr   c                 n   t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzX        a = b ** 37
        c = (20 ** -3) / (_GRID_ROWS ** (code_length - 10))
        zR        a = b**37
        c = (20**-3) / (_GRID_ROWS**(code_length - 10))
        a        def f():
        if True:
          if (self.stack[-1].split_before_closing_bracket and
              # FIXME(morbo): Use the 'matching_bracket' instead of this.
              # FIXME(morbo): Don't forget about tuples!
              current.value in ']}'):
            pass
      r.   r   s        r   testBinaryOperatorsz(BasicReformatterTest.testBinaryOperators7  s     (   'o /   -.>??G0+2Fw2O2OPPP? 
  D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      [retval1, retval2] = a_very_long_function(argument_1, argument2, argument_3,
                                                argument_4)
      r.   r=   s      r   testContiguousListz'BasicReformatterTest.testContiguousListO  sQ    ? 
  D -d33G{3G<<=====r   c                 F   t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      a(a=aaaaaaaaaaaaaaaaaaaaa,
        b=aaaaaaaaaaaaaaaaaaaaaaaa,
        c=aaaaaaaaaaaaaaaaaa,
        *d,
        **e)
      z      def foo():
        return [
            Bar(xxx='some string',
                yyy='another long string',
                zzz='a third long string')
        ]
      r.   r=   s      r   testArgsAndKwargsFormattingz0BasicReformatterTest.testArgsAndKwargsFormattingW  s    ? 
  D -d33G{3G<<===? 
  D -d33G{3G<<=====r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz      def f():
        if True:
          TaskManager.get_tags = MagicMock(
              name='get_tags_mock',
              return_value=[157031694470475],
              # side_effect=[(157031694470475), (157031694470475),],
          )
      r.   r=   s      r   testCommentColumnLimitOverflowz3BasicReformatterTest.testCommentColumnLimitOverflowm  sQ    ? 
  D -d33G{3G<<=====r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)NaH          class SomeClass(object):
          do_something = True

          def succeeded(self, dddddddddddddd):
            d = defer.succeed(None)

            if self.do_something:
              d.addCallback(lambda _: self.aaaaaa.bbbbbbbbbbbbbbbb.cccccccccccccccccccccccccccccccc(dddddddddddddd))
            return d
        ae          class SomeClass(object):
          do_something = True

          def succeeded(self, dddddddddddddd):
            d = defer.succeed(None)

            if self.do_something:
              d.addCallback(lambda _: self.aaaaaa.bbbbbbbbbbbbbbbb.
                            cccccccccccccccccccccccccccccccc(dddddddddddddd))
            return d
        z5{based_on_style: yapf, allow_multiline_lambdas: true}r6   r   s       r   testMultilineLambdasz)BasicReformatterTest.testMultilineLambdasz  s     
( 
 
 'o /  4

%EG GH H H !/0@AAg
2&/88: : : 502233333e50223333   A"B3 3'Cc                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)NaR          MAP_WITH_LONG_KEYS = {
            ('lorem ipsum', 'dolor sit amet'):
                1,
            ('consectetur adipiscing elit.', 'Vestibulum mauris justo, ornare eget dolor eget'):
                2,
            ('vehicula convallis nulla. Vestibulum dictum nisl in malesuada finibus.',):
                3
        }
        a_          MAP_WITH_LONG_KEYS = {
            ('lorem ipsum', 'dolor sit amet'):
                1,
            ('consectetur adipiscing elit.',
             'Vestibulum mauris justo, ornare eget dolor eget'):
                2,
            ('vehicula convallis nulla. Vestibulum dictum nisl in malesuada finibus.',):
                3
        }
        z={based_on_style: yapf, allow_multiline_dictionary_keys: true}r6   r   s       r   testMultilineDictionaryKeysz0BasicReformatterTest.testMultilineDictionaryKeys  s     	( 	 	 'o 
/ 
 
4

% 'O P PQ Q Q !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }	 t          j        t          j        d                     t          j        |          }t          j        |          }| 	                    ||           t          j        |          }t          j        |          }| 	                    ||           t          j        t          j
                               d S # t          j        t          j
                               w xY w)Na]          class A(object):
          def method(self):
            filters = {
                'expressions': [{
                    'field': {
                        'search_field': {
                            'user_field': 'latest_party__number_of_guests'
                        },
                    }
                }]
            }
        zd{based_on_style: pep8, indent_width: 2, continuation_indent_width: 4, indent_dictionary_value: True}r   r   r   r
   r   r   r   r   r   r   r   r    r>   r#   reformatted_codes       r   testStableDictionaryFormattingz3BasicReformatterTest.testStableDictionaryFormatting  s    ?   D4

%MN NO O O
 !/55g$-g66
4!1222 /0@AAg$-g66
4!1222502233333e50223333   B"C 'Dc                 8   	 t          j        t          j                               t          j        d          }t          j        d          }t          j        |          }t          j        |          }| 	                    ||           t          j        |          }t          j        |          }| 	                    ||           t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz          def _():
              url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format(
                  value, urllib.urlencode({'action': 'update', 'parameter': value}))
          z          def _():
              url = "http://{0}/axis-cgi/admin/param.cgi?{1}".format(
                  value, urllib.urlencode({
                      'action': 'update',
                      'parameter': value
                  }))
          )r   r
   CreatePEP8Styler   r   r   r   r   r   r   r   r    r!   r"   r#   r  s        r   %testStableInlinedDictionaryFormattingz:BasicReformatterTest.testStableInlinedDictionaryFormatting  s   45022333! *  
 !) 1 ! ! !/0@AAg$-g66
24DEEE /0@AAg$-g66
24DEEE502233333e50223333s   C	C2 2'Dc                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def mark_game_scored(gid):
          _connect.execute(_games.update().where(_games.c.gid == gid).values(
              scored=True))
        z        def mark_game_scored(gid):
          _connect.execute(
              _games.update().where(_games.c.gid == gid).values(scored=True))
        r.   r   s       r   "testDontSplitKeywordValueArgumentsz7BasicReformatterTest.testDontSplitKeywordValueArguments  r^   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzg      query = '''SELECT id
      FROM table
      WHERE day in {}'''
      days = ",".join(days)
      r.   r=   s      r   (testDontAddBlankLineAfterMultilineStringz=BasicReformatterTest.testDontAddBlankLineAfterMultilineString  r   r   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na$        def a():
        if True:
          if True:
            if True:
              columns = [
                  x for x, y in self._heap_this_is_very_long if x.route[0] == choice
              ]
              self._heap = [x for x in self._heap if x.route and x.route[0] == choice]
      r.   r=   s      r    testFormattingListComprehensionsz5BasicReformatterTest.testFormattingListComprehensions  sQ    ? 	
 	 	D -d33G{3G<<=====r   c                    t          j        d          }	 t          j        t          j        d                     t          j        |          }t          j        |          }| 	                    ||           t          j        |          }t          j        |          }| 	                    ||           t          j        t          j
                               d S # t          j        t          j
                               w xY w)Naj          a_very_long_function_name(
            long_argument_name_1=1,
            long_argument_name_2=2,
            long_argument_name_3=3,
            long_argument_name_4=4,
        )

        a_very_long_function_name(
            long_argument_name_1=1, long_argument_name_2=2, long_argument_name_3=3,
            long_argument_name_4=4
        )
        z{based_on_style: pep8, indent_width: 2, continuation_indent_width: 4, indent_dictionary_value: True, dedent_closing_brackets: True, split_before_named_assigns: False}r  r  s       r   testNoSplittingWhenBinPackingz2BasicReformatterTest.testNoSplittingWhenBinPacking  s    ?   D4

%34 45 5 5 !/55g$-g66
4!1222 /0@AAg$-g66
4!1222502233333e50223333r  c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        if not aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b(c == d[
                'eeeeee']).ffffff():
          pass
        z        if not aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.b(
            c == d['eeeeee']).ffffff():
          pass
        r.   r   s       r   testNotSplittingAfterSubscriptz3BasicReformatterTest.testNotSplittingAfterSubscript?  r^   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def _():
          if True:
            if True:
              if True:
                if True:
                  if True:
                    boxes[id_] = np.concatenate((points.min(axis=0), qoints.max(axis=0)))
        z        def _():
          if True:
            if True:
              if True:
                if True:
                  if True:
                    boxes[id_] = np.concatenate(
                        (points.min(axis=0), qoints.max(axis=0)))
        r.   r   s       r   testSplittingOneArgumentListz1BasicReformatterTest.testSplittingOneArgumentListM  sm     (   'o 	/ 	 	 -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          class _():
          @classmethod
          def _pack_results_for_constraint_or(cls, combination, constraints):
            if True:
              if True:
                if True:
                  return cls._create_investigation_result(
                          (
                                  clue for clue in combination if not clue == Verifier.UNMATCHED
                          ), constraints, InvestigationResult.OR
                  )
        a          class _():

          @classmethod
          def _pack_results_for_constraint_or(cls, combination, constraints):
            if True:
              if True:
                if True:
                  return cls._create_investigation_result(
                      (clue for clue in combination if not clue == Verifier.UNMATCHED),
                      constraints, InvestigationResult.OR)
        r.   r   s       r   +testSplittingBeforeFirstElementListArgumentz@BasicReformatterTest.testSplittingBeforeFirstElementListArgumentd  sm     (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                 :   t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }t          j        |          }| 	                    ||           t          j        |          }t          j        |          }| 	                    ||           t          j        t          j
                               d S # t          j        t          j
                               w xY w)Na          function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3)

        function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3,)

        a_very_long_function_name(long_argument_name_1=1, long_argument_name_2=2, long_argument_name_3=3, long_argument_name_4=4)

        a_very_long_function_name(long_argument_name_1, long_argument_name_2, long_argument_name_3, long_argument_name_4,)

        r =f0 (1,  2,3,)
        a          function_name(argument_name_1=1, argument_name_2=2, argument_name_3=3)

        function_name(
            argument_name_1=1,
            argument_name_2=2,
            argument_name_3=3,
        )

        a_very_long_function_name(
            long_argument_name_1=1,
            long_argument_name_2=2,
            long_argument_name_3=3,
            long_argument_name_4=4)

        a_very_long_function_name(
            long_argument_name_1,
            long_argument_name_2,
            long_argument_name_3,
            long_argument_name_4,
        )

        r = f0(
            1,
            2,
            3,
        )
        zC{based_on_style: yapf, split_arguments_when_comma_terminated: True}r  r  s        r   'testSplittingArgumentsTerminatedByCommaz<BasicReformatterTest.testSplittingArgumentsTerminatedByComma  s    
( 
 
 'o /  :4

%=> >? ? ?
 !/0@AAg$-g66
24DEEE /0@AAg$-g66
24DEEE502233333e50223333s   B"C3 3'Dc                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        from toto import titi, tata, tutu  # noqa
        from toto import titi, tata, tutu
        from toto import (titi, tata, tutu)
        r.   r=   s      r   testImportAsListz%BasicReformatterTest.testImportAsList  rG   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NaB          a = {
        'aaaaaaaaaaaaaaaaaaaaaaaa':
            Check('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ', '=', True),
        'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb':
            Check('YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY', '=', True),
        'ccccccccccccccc':
            Check('XXXXXXXXXXXXXXXXXXX', '!=', 'SUSPENDED'),
        'dddddddddddddddddddddddddddddd':
            Check('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', '=', False),
        'eeeeeeeeeeeeeeeeeeeeeeeeeeeee':
            Check('VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', '=', False),
        'ffffffffffffffffffffffffff':
            Check('UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU', '=', True),
        'ggggggggggggggggg':
            Check('TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT', '=', True),
        'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh':
            Check('SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', '=', True),
        'iiiiiiiiiiiiiiiiiiiiiiii':
            Check('RRRRRRRRRRRRRRRRRRRRRRRRRRR', '=', True),
        'jjjjjjjjjjjjjjjjjjjjjjjjjj':
            Check('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ', '=', False),
        }
        a          a = {
            'aaaaaaaaaaaaaaaaaaaaaaaa':
                Check('ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ', '=', True),
            'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb':
                Check('YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY', '=', True),
            'ccccccccccccccc':
                Check('XXXXXXXXXXXXXXXXXXX', '!=', 'SUSPENDED'),
            'dddddddddddddddddddddddddddddd':
                Check('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', '=', False),
            'eeeeeeeeeeeeeeeeeeeeeeeeeeeee':
                Check('VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', '=', False),
            'ffffffffffffffffffffffffff':
                Check('UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU', '=', True),
            'ggggggggggggggggg':
                Check('TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT', '=', True),
            'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh':
                Check('SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', '=', True),
            'iiiiiiiiiiiiiiiiiiiiiiii':
                Check('RRRRRRRRRRRRRRRRRRRRRRRRRRR', '=', True),
            'jjjjjjjjjjjjjjjjjjjjjjjjjj':
                Check('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ', '=', False),
        }
        r.   r   s       r   testDictionaryValuesOnOwnLinesz3BasicReformatterTest.testDictionaryValuesOnOwnLines  sm     (  0 'o /  0 -.>??G0+2Fw2O2OPPPPPr   c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        doc = test_utils.CreateTestDocumentViaController(
            content={ 'a': 'b' },
            branch_key=branch.key,
            collection_key=collection.key)
        z        doc = test_utils.CreateTestDocumentViaController(
            content={'a': 'b'}, branch_key=branch.key, collection_key=collection.key)
        z        doc = test_utils.CreateTestDocumentViaController(
            content={ 'a': 'b' },
            branch_key=branch.key,
            collection_key=collection.key,
            collection_key2=collection.key2)
        z        doc = test_utils.CreateTestDocumentViaController(
            content={'a': 'b'},
            branch_key=branch.key,
            collection_key=collection.key,
            collection_key2=collection.key2)
        r.   r   s       r   testDictionaryOnOwnLinez,BasicReformatterTest.testDictionaryOnOwnLine  s     (   'o /   -.>??G0+2Fw2O2OPPP (   'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na>          _A = {
            'cccccccccc': ('^^1',),
            'rrrrrrrrrrrrrrrrrrrrrrrrr': ('^7913',  # AAAAAAAAAAAAAA.
                                         ),
            'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': ('^6242',  # BBBBBBBBBBBBBBB.
                                                  ),
            'vvvvvvvvvvvvvvvvvvv': ('^27959',  # CCCCCCCCCCCCCCCCCC.
                                    '^19746',  # DDDDDDDDDDDDDDDDDDDDDDD.
                                    '^22907',  # EEEEEEEEEEEEEEEEEEEEEEEE.
                                    '^21098',  # FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.
                                    '^22826',  # GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.
                                    '^22769',  # HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH.
                                    '^22935',  # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.
                                    '^3982',  # JJJJJJJJJJJJJ.
                                   ),
            'uuuuuuuuuuuu': ('^19745',  # LLLLLLLLLLLLLLLLLLLLLLLLLL.
                             '^21324',  # MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.
                             '^22831',  # NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN.
                             '^17081',  # OOOOOOOOOOOOOOOOOOOOO.
                            ),
            'eeeeeeeeeeeeee': (
                '^9416',  # Reporter email. Not necessarily the reporter.
                '^^3',  # This appears to be the raw email field.
            ),
            'cccccccccc': ('^21109',  # PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP.
                          ),
        }
        ah          _A = {
            'cccccccccc': ('^^1',),
            'rrrrrrrrrrrrrrrrrrrrrrrrr': (
                '^7913',  # AAAAAAAAAAAAAA.
            ),
            'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': (
                '^6242',  # BBBBBBBBBBBBBBB.
            ),
            'vvvvvvvvvvvvvvvvvvv': (
                '^27959',  # CCCCCCCCCCCCCCCCCC.
                '^19746',  # DDDDDDDDDDDDDDDDDDDDDDD.
                '^22907',  # EEEEEEEEEEEEEEEEEEEEEEEE.
                '^21098',  # FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.
                '^22826',  # GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG.
                '^22769',  # HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH.
                '^22935',  # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII.
                '^3982',  # JJJJJJJJJJJJJ.
            ),
            'uuuuuuuuuuuu': (
                '^19745',  # LLLLLLLLLLLLLLLLLLLLLLLLLL.
                '^21324',  # MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.
                '^22831',  # NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN.
                '^17081',  # OOOOOOOOOOOOOOOOOOOOO.
            ),
            'eeeeeeeeeeeeee': (
                '^9416',  # Reporter email. Not necessarily the reporter.
                '^^3',  # This appears to be the raw email field.
            ),
            'cccccccccc': (
                '^21109',  # PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP.
            ),
        }
        r.   r   s       r   testNestedListsInDictionaryz0BasicReformatterTest.testNestedListsInDictionary	  sn     (  : 'o !/ ! !D -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NaO          class _():
          def _():
            breadcrumbs = [{'name': 'Admin',
                            'url': url_for(".home")},
                           {'title': title},]
            breadcrumbs = [{'name': 'Admin',
                            'url': url_for(".home")},
                           {'title': title}]
        ao          class _():
          def _():
            breadcrumbs = [
                {
                    'name': 'Admin',
                    'url': url_for(".home")
                },
                {
                    'title': title
                },
            ]
            breadcrumbs = [{'name': 'Admin', 'url': url_for(".home")}, {'title': title}]
        r.   r   s       r   testNestedDictionaryz)BasicReformatterTest.testNestedDictionaryY	  sm     	( 	 	 'o /   -.>??G0+2Fw2O2OPPPPPr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na          class _():

          @mock.patch.dict(
              os.environ,
              {'HTTP_' + xsrf._XSRF_TOKEN_HEADER.replace('-', '_'): 'atoken'})
          def _():
            pass


        AAAAAAAAAAAAAAAAAAAAAAAA = {
            Environment.XXXXXXXXXX: 'some text more text even more tex',
            Environment.YYYYYYY: 'some text more text even more text yet ag',
            Environment.ZZZZZZZZZZZ: 'some text more text even mor etext yet again tex',
        }
        r.   r=   s      r   testDictionaryElementsOnOneLinez4BasicReformatterTest.testDictionaryElementsOnOneLineu	  r   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nzi        list("a long line to break the line. a long line to break the brk a long lin", not True)
        zv        list("a long line to break the line. a long line to break the brk a long lin",
             not True)
        r.   r    r!   r   r#   s       r   testNotInParamsz$BasicReformatterTest.testNotInParams	  sk     (   O %  M -.>??G(<W(E(EFFFFFr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def _():
          if True:
            with py3compat.open_with_encoding(filename, mode='w',
                                              encoding=encoding) as fd:
              pass
        z        def _():
          if True:
            with py3compat.open_with_encoding(
                filename, mode='w', encoding=encoding) as fd:
              pass
        r.   r'  s       r   testNamedAssignNotAtEndOfLinez2BasicReformatterTest.testNamedAssignNotAtEndOfLine	  sk     (   O %  M -.>??G(<W(E(EFFFFFr   c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }	 t          j        t          j	        d                     t          j        |          }|                     |t          j        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz        class A:

          """Does something.

          Also, here are some details.
          """

          def __init__(self):
            pass
        z        class A:
          """Does something.

          Also, here are some details.
          """

          def __init__(self):
            pass
        z?{based_on_style: yapf, blank_line_before_class_docstring: True}r1   r    r!   r   r#   r"   s        r   !testBlankLineBeforeClassDocstringz6BasicReformatterTest.testBlankLineBeforeClassDocstring	  sB    
( 
 
 O 	% 	 	M -.>??G(<W(E(EFFF 
( 
 
 'o 
/ 
 

4

%9: :; ; ;
 !/0@AAg
2&/88: : : 502233333e50223333   A"D 'D>c                    t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     t          j        d          }t          j        d          }	 t          j        t          j	        d                     t          j        |          }|                     |t          j        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz        #!/usr/bin/env python
        # -*- coding: utf-8 name> -*-

        """Some module docstring."""


        def foobar():
          pass
        z        #!/usr/bin/env python
        # -*- coding: utf-8 name> -*-
        """Some module docstring."""


        def foobar():
          pass
        z        #!/usr/bin/env python
        # -*- coding: utf-8 name> -*-
        """Some module docstring."""


        def foobar():
            pass
        z        #!/usr/bin/env python
        # -*- coding: utf-8 name> -*-

        """Some module docstring."""


        def foobar():
            pass
        z@{based_on_style: pep8, blank_line_before_module_docstring: True}r1   r,  s        r   "testBlankLineBeforeModuleDocstringz7BasicReformatterTest.testBlankLineBeforeModuleDocstring	  sB    	( 	 	 O %  M -.>??G(<W(E(EFFF (   'o 	/ 	 	
4

%:; ;< < <
 !/0@AAg
2&/88: : : 502233333e50223333r.  c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        def f():
          this_is_a_very_long_function_name(an_extremely_long_variable_name, (
              'a string that may be too long %s' % 'M15'))
        z        def f():
          this_is_a_very_long_function_name(
              an_extremely_long_variable_name,
              ('a string that may be too long %s' % 'M15'))
        r.   r'  s       r   testTupleCohesionz&BasicReformatterTest.testTupleCohesion
  sk     (  
 O %  M -.>??G(<W(E(EFFFFFr   c                     t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz        foo = d[not a]
        r.   r=   s      r   testSubscriptExpressionz,BasicReformatterTest.testSubscriptExpression(
  r@   r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na]          def foo():
          return [
              Bar(
                  xxx='some string',
                  yyy='another long string',
                  zzz='a third long string'), Bar(
                      xxx='some string',
                      yyy='another long string',
                      zzz='a third long string')
          ]
        a9          def foo():
          return [
              Bar(xxx='some string',
                  yyy='another long string',
                  zzz='a third long string'),
              Bar(xxx='some string',
                  yyy='another long string',
                  zzz='a third long string')
          ]
        r.   r'  s       r   testListWithFunctionCallsz.BasicReformatterTest.testListWithFunctionCalls/
  sk     (   O 
% 
 
M -.>??G(<W(E(EFFFFFr   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Nz2        X=...
        Y = X if ... else X
        z4        X = ...
        Y = X if ... else X
        r.   r'  s       r   testEllipsesz!BasicReformatterTest.testEllipsesJ
  sk     (   O %  M -.>??G(<W(E(EFFFFFr   c                     d}d}t          j        |          }|                     |t          j        |                     d S )NzTmy_dict = {
    'key':  # Some comment about the key
        {'nested_key': 1, },
}
zimy_dict = {
    'key':  # Some comment about the key
        {
            'nested_key': 1,
        },
}
rd   r'  s       r   testPseudoParensz%BasicReformatterTest.testPseudoParensV
  sK    M -.>??G(<W(E(EFFFFFr   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               dS # t          j        t          j
                               w xY w)z5Tests split_before_first_argument on a function call.zo        a_very_long_function_name("long string with formatting {0:s}".format(
            "mystring"))
        zo        a_very_long_function_name(
            "long string with formatting {0:s}".format("mystring"))
        9{based_on_style: yapf, split_before_first_argument: True}Nr6   r   s       r   .testSplittingBeforeFirstArgumentOnFunctionCallzCBasicReformatterTest.testSplittingBeforeFirstArgumentOnFunctionCallh
  s     (   'o /  
	4

%IK KL L L !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               dS # t          j        t          j
                               w xY w)z;Tests split_before_first_argument on a function definition.z        def _GetNumberOfSecondsFromElements(year, month, day, hours,
                                            minutes, seconds, microseconds):
          return
        z        def _GetNumberOfSecondsFromElements(
            year, month, day, hours, minutes, seconds, microseconds):
          return
        r<  Nr6   r   s       r   4testSplittingBeforeFirstArgumentOnFunctionDefinitionzIBasicReformatterTest.testSplittingBeforeFirstArgumentOnFunctionDefinition~
  s     (  
 'o /  	4

%IK KL L L !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               dS # t          j        t          j
                               w xY w)z:Tests split_before_first_argument on a compound statement.z        if (long_argument_name_1 == 1 or
            long_argument_name_2 == 2 or
            long_argument_name_3 == 3 or
            long_argument_name_4 == 4):
          pass
        z        if (long_argument_name_1 == 1 or long_argument_name_2 == 2 or
            long_argument_name_3 == 3 or long_argument_name_4 == 4):
          pass
        r<  Nr6   r   s       r   3testSplittingBeforeFirstArgumentOnCompoundStatementzHBasicReformatterTest.testSplittingBeforeFirstArgumentOnCompoundStatement
  s     (   'o /  	4

%IK KL L L !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               dS # t          j        t          j
                               w xY w)z(Tests coalesce_brackets on a dictionary.a$          date_time_values = (
            {
                u'year': year,
                u'month': month,
                u'day_of_month': day_of_month,
                u'hours': hours,
                u'minutes': minutes,
                u'seconds': seconds
            }
        )
        z        date_time_values = ({
            u'year': year,
            u'month': month,
            u'day_of_month': day_of_month,
            u'hours': hours,
            u'minutes': minutes,
            u'seconds': seconds
        })
        z/{based_on_style: yapf, coalesce_brackets: True}Nr6   r   s       r   testCoalesceBracketsOnDictz/BasicReformatterTest.testCoalesceBracketsOnDict
  s     (   'o 	/ 	 		4

%?A AB B B !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz        if __name__ == "__main__":
          with another_resource:
            account = {
                "validUntil":
                    int(time() + (6 * 7 * 24 * 60 * 60))  # in 6 weeks time
            }
        zN{based_on_style: yapf, coalesce_brackets: True, dedent_closing_brackets: true}r6   r=   s      r   testSplitAfterCommentz*BasicReformatterTest.testSplitAfterComment
  s    ?   D4

%/0 01 1 1 !/55g
4!5g!>!>???502233333e50223333   A"B 'CzRequires Python 2.7c                    	 t          j        t          j                               t          j        d          }t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz          from util import async


          class A(object):
              def foo(self):
                  async.run()
          )r   r
   r  r   r   r   r   r   r   r   r   r=   s      r   testAsyncAsNonKeywordz*BasicReformatterTest.testAsyncAsNonKeyword
  s    45022333 _   d !/55g
4!5g!>!>???502233333e50223333s   A5B 'Cc                    t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz+        x = [1, 2, 3, 4, 5, 6, 7,]
        z<{based_on_style: yapf, disable_ending_comma_heuristic: True}r6   r=   s      r   testDisableEndingCommaHeuristicz4BasicReformatterTest.testDisableEndingCommaHeuristic
  s    ?   D4

% 'O P PQ Q Q !/55g
4!5g!>!>???502233333e50223333rF  c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)N        def function(first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None:
          pass


        def function(first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None) -> None:
          pass
        a          def function(
            first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None
        ) -> None:
          pass


        def function(
            first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None
        ) -> None:
          pass
        z5{based_on_style: yapf, dedent_closing_brackets: True}r6   r   s       r   >testDedentClosingBracketsWithTypeAnnotationExceedingLineLengthzSBasicReformatterTest.testDedentClosingBracketsWithTypeAnnotationExceedingLineLength       (   'o /  	4

% 'H I IJ J J !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)NrL  a          def function(
            first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None
            ) -> None:
          pass


        def function(
            first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_argument=None
            ) -> None:
          pass
        5{based_on_style: yapf, indent_closing_brackets: True}r6   r   s       r   >testIndentClosingBracketsWithTypeAnnotationExceedingLineLengthzSBasicReformatterTest.testIndentClosingBracketsWithTypeAnnotationExceedingLineLength,  rN  r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz        def function(first_argument_xxxxxxxxxxxxxxxx=(0,), second_argument=None, third_and_final_argument=True):
          pass


        def function(first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_and_last_argument=None):
          pass
        aG          def function(
            first_argument_xxxxxxxxxxxxxxxx=(0,),
            second_argument=None,
            third_and_final_argument=True
            ):
          pass


        def function(
            first_argument_xxxxxxxxxxxxxxxxxxxxxxx=(0,), second_and_last_argument=None
            ):
          pass
        rP  r6   r   s       r   'testIndentClosingBracketsInFunctionCallz<BasicReformatterTest.testIndentClosingBracketsInFunctionCallM  s     (   'o /  	4

% 'H I IJ J J !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Na          def function():
          some_var = ('a long element', 'another long element', 'short element', 'really really long element')
          return True

        def function():
          some_var = ('a couple', 'small', 'elemens')
          return False
        a8          def function():
          some_var = (
              'a long element', 'another long element', 'short element',
              'really really long element'
              )
          return True


        def function():
          some_var = ('a couple', 'small', 'elemens')
          return False
        rP  r6   r   s       r    testIndentClosingBracketsInTuplez5BasicReformatterTest.testIndentClosingBracketsInTuplep       (   'o /  	4

% 'H I IJ J J !/0@AAg
2&/88: : : 502233333e50223333r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Na          def function():
          some_var = ['a long element', 'another long element', 'short element', 'really really long element']
          return True

        def function():
          some_var = ['a couple', 'small', 'elemens']
          return False
        a8          def function():
          some_var = [
              'a long element', 'another long element', 'short element',
              'really really long element'
              ]
          return True


        def function():
          some_var = ['a couple', 'small', 'elemens']
          return False
        rP  r6   r   s       r   testIndentClosingBracketsInListz4BasicReformatterTest.testIndentClosingBracketsInList  rV  r   c                    t          j        d          }t          j        d          }	 t          j        t          j        d                     t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Naq          def function():
          some_var = {1: ('a long element', 'and another really really long element that is really really amazingly long'), 2: 'another long element', 3: 'short element', 4: 'really really long element'}
          return True

        def function():
          some_var = {1: 'a couple', 2: 'small', 3: 'elemens'}
          return False
        a          def function():
          some_var = {
              1:
                  (
                      'a long element',
                      'and another really really long element that is really really amazingly long'
                      ),
              2: 'another long element',
              3: 'short element',
              4: 'really really long element'
              }
          return True


        def function():
          some_var = {1: 'a couple', 2: 'small', 3: 'elemens'}
          return False
        rP  r6   r   s       r   testIndentClosingBracketsInDictz4BasicReformatterTest.testIndentClosingBracketsInDict  s     (   'o /  (	4

% 'H I IJ J J !/0@AAg
2&/88: : : 502233333e50223333r   c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )Na,          class A:
            def b():
                d = {
                    "123456": [
                        {
                            "12": "aa"
                        },
                        {
                            "12": "bb"
                        },
                        {
                            "12": "cc",
                            "1234567890": {
                                "1234567": [{
                                    "12": "dd",
                                    "12345": "text 1"
                                }, {
                                    "12": "ee",
                                    "12345": "text 2"
                                }]
                            }
                        }
                    ]
                }
        aI          class A:

          def b():
            d = {
                "123456": [{
                    "12": "aa"
                }, {
                    "12": "bb"
                }, {
                    "12": "cc",
                    "1234567890": {
                        "1234567": [{
                            "12": "dd",
                            "12345": "text 1"
                        }, {
                            "12": "ee",
                            "12345": "text 2"
                        }]
                    }
                }]
            }
        r.   r   s       r   testMultipleDictionariesInListz3BasicReformatterTest.testMultipleDictionariesInList  sm     (  4 'o /  . -.>??G0+2Fw2O2OPPPPPr   c                    	 t          j        t          j        d                     t          j        d          }t          j        |          }t          j        |          }t          j        d          }| 	                    ||           t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz{force_multiline_dict: true}z/responseDict = {'childDict': {'spam': 'eggs'}}
zq        responseDict = {
            'childDict': {
                'spam': 'eggs'
            }
        }
      )r   r
   r   r   r   r   r   r   r   r   r   )r    r!   r#   actualexpecteds        r   testForceMultilineDict_Truez0BasicReformatterTest.testForceMultilineDict_True  s    4

%&D
E
EG G G!
<> > /0@AAg#G,,f "
  h 8V,,,502233333e50223333s   BB5 5'Cc                    	 t          j        t          j        d                     t          j        d          }|}t          j        |          }|                     |t          j	        |                     t          j        t          j
                               d S # t          j        t          j
                               w xY w)Nz{force_multiline_dict: false}z=        responseDict = {'childDict': {'spam': 'eggs'}}
      )r   r
   r   r   r   r   r   r   r   r   r   r   s       r   testForceMultilineDict_Falsez1BasicReformatterTest.testForceMultilineDict_False'  s    4

%&E
F
FH H H! *
   !1 /0@AAg
2&/88: : : 502233333e50223333s   A8B! !'CzRequires Python 3.8c                     t          j        d          }t          j        d          }t          j        |          }|                     |t          j        |                     d S )NzN      if (x  :=  len([1]*1000)>100):
        print(f'{x} is pretty big' )
    zO      if (x := len([1] * 1000) > 100):
        print(f'{x} is pretty big')
    r.   )r    r!   r_  r#   s       r   
testWalruszBasicReformatterTest.testWalrus5  sk     ( 	 	    	 	H -.>??G;#7#@#@AAAAAr   N)__name__
__module____qualname__classmethodr   r$   r,   r/   r2   r4   r7   r9   r;   r?   rB   rD   rF   rI   rK   rM   rO   rR   rT   rV   rY   r[   r]   r`   rb   re   rg   ri   rk   rm   ro   rq   rt   rv   ry   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r	  r  r  r  r  r  r  r  r  r  r  r  r!  r#  r%  r(  r*  r-  r0  r2  r4  r6  r8  r:  r=  r?  rA  rC  rE  unittest
skipUnlessr   PY3rH  rJ  rM  rQ  rS  rU  rX  rZ  r\  r`  rb  PY38rd   r   r   r   r      si	       2 2 ;2KQ KQ KQZtQ tQ tQlQ Q Q:WQ WQ WQrQ Q Q6%Q %Q %QN&Q &Q &QP3Q 3Q 3Qj> > >
Q 
Q 
Q> > >"> > >$Q $Q $QL!Q !Q !QF3Q 3Q 3QjQ Q QQ Q Q Q Q Q*Q Q Q$Q Q QQ Q Q"Q Q QQ Q Q&Q Q Q$Q Q Q$	Q 	Q 	QQ Q QQ Q QQ Q Q.Q Q Q Q Q Q2Q Q Q$> > >> > >"Q "Q "QH
> 
> 
>Q Q QQ Q Q4Q Q Q$> > >> > >> > >Q Q Q@> > >> > >
> 
> 
>> > >> > >$Q Q Q2> > >> > >	> 	> 	>Q Q Q.Q Q Q.> > >&> > >Q Q Q Q  Q  QD
> 
> 
>> > >> > >> > >4	> 	> 	>> > >> > >> > >> > >.> > >(> > >> > >G G G<	> 	> 	>	> 	> 	>
> 
> 
>> > > > > >
> > >
> > >	> 	> 	>Q Q Q6> > >	> 	> 	>
> 
> 
>	> 	> 	>	> 	> 	>Q Q QQ Q Q,Q Q Q$Q Q Q"Q Q Q2> > >0> > >> > >,> > >!4 !4 !4F4 4 4B4 4 4>4 4 46Q Q Q> > >> > >4 4 4BQ Q QQ Q Q.Q Q Q:74 74 74r> > >2Q 2Q 2QhQ Q Q>AQ AQ AQFQ Q Q8> > >(	G 	G 	GG G G$:4 :4 :4x54 54 54nG G G> > >G G G6
G 
G 
GG G G$4 4 4,4 4 404 4 44"4 "4 "4H4 4 4( 89=(*?@@4 4 A@4&4 4 44 4 4B4 4 4B!4 !4 !4F!4 !4 !4F!4 !4 !4F'4 '4 '4R3Q 3Q 3Qj4 4 4&4 4 4 8y~'<==
B 
B >=
B 
B 
Br   r   __main__)__doc__r   ri  yapf.yapflibr   r   r   	yapftestsr   YAPFTestr   re  mainrm  r   r   <module>rt     s    ( '   " " " " " " $ $ $ $ $ $       & & & & & &f0B f0B f0B f0B f0B+4 f0B f0B f0BRa z(-///// r   