#NEWLINE# def testCommentBeforeDedentTwoLevelImproperlyIndented( self ) : #NEWLINE# #INDENT# code = textwrap . dedent ( '\n      if foo:\n        if bar:\n          z = 1\n         # comment 2\n      y = 1\n      ' ) #NEWLINE# tree = pytree_utils . ParseCodeToTree ( code ) #NEWLINE# comment_splicer . SpliceComments ( tree ) #NEWLINE# if_suite = tree . children [ 0 ] . children [ 3 ] #NEWLINE# self . _AssertNodeIsComment ( if_suite . children [ ( - 2 ) ] ) #NEWLINE# self . _AssertNodeType ( 'DEDENT' , if_suite . children [ ( - 1 ) ] )