Fix checking for 'async def'
The old code was comparing a generator object against a tuple, which
will never be true. Also it was using token.name, instead of
token.value, for some reason.
Fixes #484
diff --git a/yapftests/reformatter_python3_test.py b/yapftests/reformatter_python3_test.py
index c6a3e99..6ed1bbb 100644
--- a/yapftests/reformatter_python3_test.py
+++ b/yapftests/reformatter_python3_test.py
@@ -209,6 +209,17 @@
uwlines = yapf_test_helper.ParseAndUnwrap(unformatted_code)
self.assertCodeEqual(expected_formatted_code, reformatter.Reformat(uwlines))
+ def testAsyncFunctionsNested(self):
+ if sys.version_info[1] < 5:
+ return
+ code = textwrap.dedent("""\
+ async def outer():
+ async def inner():
+ pass
+ """)
+ uwlines = yapf_test_helper.ParseAndUnwrap(code)
+ self.assertCodeEqual(code, reformatter.Reformat(uwlines))
+
def testKeepTypesIntact(self):
if sys.version_info[1] < 5:
return