Skip to content

Commit

Permalink
Add reformatting test for a list comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
eliben committed Mar 26, 2015
1 parent 3256077 commit 3756f78
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions yapftests/reformatter_test.py
Expand Up @@ -343,6 +343,19 @@ def x(self):
uwlines = _ParseAndUnwrap(unformatted_code)
self.assertEqual(expected_formatted_code, reformatter.Reformat(uwlines))

def testListComprehension(self):
unformatted_code = textwrap.dedent("""\
def given(y):
[k for k in ()
if k in y]
""")
expected_formatted_code = textwrap.dedent("""\
def given(y):
[k for k in () if k in y]
""")
uwlines = _ParseAndUnwrap(unformatted_code)
self.assertEqual(expected_formatted_code, reformatter.Reformat(uwlines))

def testOpeningAndClosingBrackets(self):
unformatted_code = textwrap.dedent("""\
foo( ( 1, 2, 3, ) )
Expand Down

0 comments on commit 3756f78

Please sign in to comment.