nebius/SWE-bench-extra huggingface dataset:
Repository: google-research/arxiv-latex-cleaner

Issue:
[Unexpected Behavior] Comments Not Removed on Lines with "auto-ignore"
While fixing issue #91, I discovered that comments in lines containing the word `auto-ignore` are not being removed as expected. This behavior is not documented in either the README or the help message, which may lead to unexpected outcomes for users. 
I suppose there is a specific reason for this behavior as it is also being tested 🤔

## Example
### Input:
```latex
Foo auto-ignore Bar ... % Top Secret Comment
```
### Output:
```latex
Foo auto-ignore Bar ... % Top Secret Comment
```
### Expected Output:
```latex
Foo auto-ignore Bar ... %
```

Comments:

Patch:
diff --git a/arxiv_latex_cleaner/arxiv_latex_cleaner.py b/arxiv_latex_cleaner/arxiv_latex_cleaner.py
index 2b83c54..296e698 100644
--- a/arxiv_latex_cleaner/arxiv_latex_cleaner.py
+++ b/arxiv_latex_cleaner/arxiv_latex_cleaner.py
@@ -212,8 +212,10 @@ def _remove_iffalse_block(text):
 
 def _remove_comments_inline(text):
   """Removes the comments from the string 'text' and ignores % inside \\url{}."""
-  if 'auto-ignore' in text:
-    return text
+  auto_ignore_pattern = r'(%\s*auto-ignore).*'
+  if regex.search(auto_ignore_pattern, text):
+    return regex.sub(auto_ignore_pattern, r'\1', text)
+
   if text.lstrip(' ').lstrip('\t').startswith('%'):
     return ''
 


Test patch:
diff --git a/arxiv_latex_cleaner/tests/arxiv_latex_cleaner_test.py b/arxiv_latex_cleaner/tests/arxiv_latex_cleaner_test.py
index 8540e75..34e9488 100644
--- a/arxiv_latex_cleaner/tests/arxiv_latex_cleaner_test.py
+++ b/arxiv_latex_cleaner/tests/arxiv_latex_cleaner_test.py
@@ -278,6 +278,16 @@ class UnitTests(parameterized.TestCase):
           'line_in': '%auto-ignore\n',
           'true_output': '%auto-ignore\n',
       },
+      {
+          'testcase_name': 'auto_ignore_middle',
+          'line_in': 'Foo % auto-ignore Comment\n',
+          'true_output': 'Foo % auto-ignore\n',
+      },
+      {
+          'testcase_name': 'auto_ignore_text_with_comment',
+          'line_in': 'Foo auto-ignore % Comment\n',
+          'true_output': 'Foo auto-ignore %\n',
+      },
       {
           'testcase_name': 'percent',
           'line_in': r'100\% accurate\n',
Repository: google/docker-explorer

Issue:
Go from overlayFS ID to container ID
It would be useful to find a way to map an overlayFS ID to the container that actually used it.

e.g. given this path on a server running Docker:

`/mnt/docker/var/lib/docker/overlay2/6688ce711806faead06aae3ff534ab21183a087241d3a890741f0c3b437b179c/diff/var/tmp/malware`

Find out in which container 6688ce711806faead06aae3ff534ab21183a087241d3a890741f0c3b437b179c is being used.

Comments:

Patch:
diff --git a/docker_explorer/de.py b/docker_explorer/de.py
index d558e9c..286966f 100644
--- a/docker_explorer/de.py
+++ b/docker_explorer/de.py
@@ -257,6 +257,9 @@ class DockerExplorer(object):
           container_object.start_timestamp)
       container_json['image_name'] = container_object.config_image_name
 
+      if container_object.mount_id:
+        container_json['mount_id'] = container_object.mount_id
+
       result.append(container_json)
 
     return result


Test patch:
diff --git a/tests.py b/tests.py
index 48fef64..70363c4 100644
--- a/tests.py
+++ b/tests.py
@@ -176,6 +176,8 @@ class TestAufsStorage(DockerTestCase):
          '7968321274dc6b6171697c33df7815310468e694ac5be0ec03ff053bb135e768',
          'container_id':
          '7b02fb3e8a665a63e32b909af5babb7d6ba0b64e10003b2d9534c7d5f2af8966',
+         'mount_id':
+         'b16a494082bba0091e572b58ff80af1b7b5d28737a3eedbe01e73cd7f4e01d23',
          'start_date': '2017-02-13T16:45:05.785658',
          'image_name': 'busybox'}
     ]
@@ -339,6 +341,8 @@ class TestOverlayStorage(DockerTestCase):
          '5b0d59026729b68570d99bc4f3f7c31a2e4f2a5736435641565d93e7c25bd2c3',
          'container_id':
          '5dc287aa80b460652a5584e80a5c8c1233b0c0691972d75424cf5250b917600a',
+         'mount_id':
+         '974e2b994f9db74e1ddd6fc546843bc65920e786612a388f25685acf84b3fed1',
          'start_date': '2018-01-26T14:55:56.574924',
          'image_name': 'busybox:latest'}
     ]
@@ -494,6 +498,8 @@ class TestOverlay2Storage(DockerTestCase):
          '8ac48589692a53a9b8c2d1ceaa6b402665aa7fe667ba51ccc03002300856d8c7',
          'container_id':
          '8e8b7f23eb7cbd4dfe7e91646ddd0e0f524218e25d50113559f078dfb2690206',
+         'mount_id':
+         '92fd3b3e7d6101bb701743c9518c45b0d036b898c8a3d7cae84e1a06e6829b53',
          'start_date': '2018-05-16T10:51:39.625989',
          'image_name': 'busybox'}
     ]
Repository: google/docker-explorer

Issue:
overlay mount error: mount: special device overlay does not exist
> de.py mount 6f51d96cdd2c /root/docker/docker-explorer/mnt
/bin/mount -t overlay overlay -o ro,lowerdir="/var/lib/docker/overlay2/44bbbf57e9be5c160d9addac59b51a83c35d90955b4179ca4d893ae2942ef8e1/diff:/var/lib/docker/overlay2/l/F74KTIZFM3OJPZ44L4Y5OMLQRY:/var/lib/docker/overlay2/l/MULY352PDKNLWPYT22DFGHCJXA:/var/lib/docker/overlay2/l/ZH325HA5PVVFXEPQCWG6VTKIZ3:/var/lib/docker/overlay2/l/HFQVPV3GII75YHNJBJAJBMOMIZ:/var/lib/docker/overlay2/l/BXKFWQ4WPHOZMZHHD6TFT3ITZ7:/var/lib/docker/overlay2/l/KABGVLKHDM2RBUJKGPGWN3X7RU" /root/docker/docker-explorer/mnt
Do you want to mount this container ID: 6f51d96cdd2cff0601c5922917d4a62e593917cd5358d710a344111db1c1e354 on /root/docker/docker-explorer/mnt ?
(ie: run these commands) [Y/n]
Y
**mount: special device overlay does not exist**


OS: CentOS 7.5.1804
Kernel:  3.10.0-862.14.4.el7.x86_64
Docker: 1.13.1

> docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
6f51d96cdd2c        atmoz/sftp          "/entrypoint foo:p..."   4 days ago          Up 4 days           0.0.0.0:4444->22/tcp   sftp


Comments:

Patch:
diff --git a/docker_explorer/storage.py b/docker_explorer/storage.py
index 390a212..9e84a68 100644
--- a/docker_explorer/storage.py
+++ b/docker_explorer/storage.py
@@ -211,7 +211,7 @@ class OverlayStorage(BaseStorage):
 
     cmd = [
         '/bin/mount', '-t', 'overlay', 'overlay', '-o',
-        'ro,lowerdir="{0:s}:{1:s}"'.format(upper_dir, lower_dir), mount_dir]
+        'ro,lowerdir={0:s}:{1:s}'.format(upper_dir, lower_dir), mount_dir]
     return [cmd]
 
 


Test patch:
diff --git a/tests.py b/tests.py
index 0b3a425..952778e 100644
--- a/tests.py
+++ b/tests.py
@@ -547,10 +547,10 @@ class TestOverlayStorage(DockerTestCase):
     commands = [' '.join(cmd) for cmd in commands]
     expected_commands = [(
         '/bin/mount -t overlay overlay -o ro,lowerdir='
-        '"test_data/docker/overlay/974e2b994f9db74e1ddd6fc546843bc65920e786612'
+        'test_data/docker/overlay/974e2b994f9db74e1ddd6fc546843bc65920e786612'
         'a388f25685acf84b3fed1/upper:'
         'test_data/docker/overlay/a94d714512251b0d8a9bfaacb832e0c6cb70f71cb71'
-        '976cca7a528a429336aae/root" '
+        '976cca7a528a429336aae/root '
         '/mnt')]
     self.assertEqual(expected_commands, commands)
 
@@ -704,10 +704,10 @@ class TestOverlay2Storage(DockerTestCase):
     commands = [' '.join(cmd) for cmd in commands]
     expected_commands = [(
         '/bin/mount -t overlay overlay -o ro,lowerdir='
-        '"test_data/docker/overlay2/'
+        'test_data/docker/overlay2/'
         '92fd3b3e7d6101bb701743c9518c45b0d036b898c8a3d7cae84e1a06e6829b53/diff:'
         'test_data/docker/overlay2/l/OTFSLJCXWCECIG6FVNGRTWUZ7D:'
-        'test_data/docker/overlay2/l/CH5A7XWSBP2DUPV7V47B7DOOGY" /mnt'
+        'test_data/docker/overlay2/l/CH5A7XWSBP2DUPV7V47B7DOOGY /mnt'
         )]
     self.assertEqual(expected_commands, commands)
Repository: google/gae-secure-scaffold-python3

Issue:
Preserve query params on redirect
## Issue
Currently, any query string set on the redirect path is not preserved when redirected.

## Behaviour

**Current**: `/?foo=bar` -> `/intl/en/`
**Expected**: `/?foo=bar` -> `/intl/en/?foo=bar`

## Setup
```py
# Follows github.com/google/gae-secure-scaffold-python3/blob/master/examples/language-redirect/main.py

app = securescaffold.create_app(__name__)
app.add_url_rule("/", "lang_redirect", securescaffold.views.lang_redirect)

app.config["LOCALES"] = ["en"]
app.config["LOCALES_REDIRECT_TO"] = "/intl/{locale}/"
```


Comments:

Patch:
diff --git a/src/securescaffold/views.py b/src/securescaffold/views.py
index b53c0aa..5de1852 100644
--- a/src/securescaffold/views.py
+++ b/src/securescaffold/views.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import urllib.parse
 from typing import Optional
 
 import flask
@@ -44,6 +45,17 @@ def best_match(requested_langs: LanguageAccept, supported_langs: list) -> Option
     return result
 
 
+def add_query_to_url(path: str, qs: str) -> str:
+    """Add query params to a URL path, preserving existing path params."""
+    parsed = urllib.parse.urlsplit(path)
+    old_params = urllib.parse.parse_qsl(parsed.query, keep_blank_values=True)
+    new_params = urllib.parse.parse_qsl(qs, keep_blank_values=True)
+    query = urllib.parse.urlencode(old_params + new_params)
+    parsed = parsed._replace(query=query)
+
+    return urllib.parse.urlunsplit(parsed)
+
+
 def lang_redirect():
     """Redirects the user depending on the Accept-Language header.
 
@@ -63,4 +75,8 @@ def lang_redirect():
 
     redirect_to = locales_redirect_to.format(locale=locale)
 
+    if flask.request.query_string:
+        # Preserve query parameters on redirect.
+        redirect_to = add_query_to_url(redirect_to, flask.request.query_string)
+
     return flask.redirect(redirect_to)


Test patch:
diff --git a/src/securescaffold/tests/test_views.py b/src/securescaffold/tests/test_views.py
index 96ab8e0..92b5d4c 100644
--- a/src/securescaffold/tests/test_views.py
+++ b/src/securescaffold/tests/test_views.py
@@ -75,3 +75,18 @@ class RedirectTestCase(unittest.TestCase):
 
         self.assertEqual(response.status_code, 302)
         self.assertEqual(response.location, "/intl/en/")
+
+    def test_redirect_with_query(self):
+        client = demo_app.test_client()
+        response = client.get("/", query_string={"foo": "bar"})
+
+        self.assertEqual(response.status_code, 302)
+        self.assertEqual(response.location, "/intl/en/?foo=bar")
+
+    def test_redirect_with_query_preserves_original_query(self):
+        client = demo_app.test_client()
+        demo_app.config["LOCALES_REDIRECT_TO"] = "/test?baz=qux"
+        response = client.get("/", query_string={"foo": "bar"})
+
+        self.assertEqual(response.status_code, 302)
+        self.assertEqual(response.location, "/test?baz=qux&foo=bar")
Repository: google/importlab

Issue:
Incorrect inferred module name for __init__.py files
See google/pytype#154 for more detail.

`resolve.infer_module_name` calculates the wrong name for `__init__.py` files. For example, for `foo/bar/__init__.py`, it will return `foo.bar.__init__`. The module name should be `foo.bar`.

Comments:

Patch:
diff --git a/importlab/resolve.py b/importlab/resolve.py
index 23314bc..d55f34d 100644
--- a/importlab/resolve.py
+++ b/importlab/resolve.py
@@ -102,6 +102,9 @@ def infer_module_name(filename, fspath):
     for f in fspath:
         short_name = f.relative_path(filename)
         if short_name:
+            # The module name for __init__.py files is the directory.
+            if short_name.endswith(os.path.sep + "__init__"):
+                short_name = short_name[:short_name.rfind(os.path.sep)]
             return short_name.replace(os.path.sep, '.')
     # We have not found filename relative to anywhere in pythonpath.
     return ''


Test patch:
diff --git a/tests/test_resolve.py b/tests/test_resolve.py
index 2a217d3..9891764 100644
--- a/tests/test_resolve.py
+++ b/tests/test_resolve.py
@@ -293,6 +293,15 @@ class TestResolverUtils(unittest.TestCase):
                     resolve.infer_module_name("/some/random/file", fspath),
                     "")
 
+    def testInferInitModuleName(self):
+        with utils.Tempdir() as d:
+            os_fs = fs.OSFileSystem(d.path)
+            fspath = [os_fs]
+            py_file = d.create_file("foo/__init__.py")
+            self.assertEqual(
+                    resolve.infer_module_name(py_file, fspath),
+                    "foo")
+
     def testGetAbsoluteName(self):
         test_cases = [
                 ("x.y", "a.b", "x.y.a.b"),
Repository: google/mobly

Issue:
`AndroidDevice` adb logcat file name gets truncated
If device model name includes space, the output file name of adb logcat is incorrect.
For example, for model "aqua power hd-4g", we expect `adblog,aqua power hd-4g,usb:3-5.2.3.txt`, but we actually get `adblog,aqua`.

Comments:

Patch:
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py
index 5d7027e..e52e5fd 100644
--- a/mobly/controllers/android_device.py
+++ b/mobly/controllers/android_device.py
@@ -836,10 +836,8 @@ class AndroidDevice(object):
             extra_params = self.adb_logcat_param
         except AttributeError:
             extra_params = ''
-        cmd = '"%s" -s %s logcat -v threadtime %s >> %s' % (adb.ADB,
-                                                            self.serial,
-                                                            extra_params,
-                                                            logcat_file_path)
+        cmd = '"%s" -s %s logcat -v threadtime %s >> "%s"' % (
+            adb.ADB, self.serial, extra_params, logcat_file_path)
         process = utils.start_standing_subprocess(cmd, shell=True)
         self._adb_logcat_process = process
         self.adb_logcat_file_path = logcat_file_path


Test patch:
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index 1849496..59c5529 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -326,7 +326,7 @@ class AndroidDeviceTest(unittest.TestCase):
         creat_dir_mock.assert_called_with(os.path.dirname(expected_log_path))
         adb_cmd = '"adb" -s %s logcat -v threadtime  >> %s'
         start_proc_mock.assert_called_with(
-            adb_cmd % (ad.serial, expected_log_path), shell=True)
+            adb_cmd % (ad.serial, '"%s"' % expected_log_path), shell=True)
         self.assertEqual(ad.adb_logcat_file_path, expected_log_path)
         expected_msg = (
             'Logcat thread is already running, cannot start another'
@@ -373,7 +373,7 @@ class AndroidDeviceTest(unittest.TestCase):
         creat_dir_mock.assert_called_with(os.path.dirname(expected_log_path))
         adb_cmd = '"adb" -s %s logcat -v threadtime -b radio >> %s'
         start_proc_mock.assert_called_with(
-            adb_cmd % (ad.serial, expected_log_path), shell=True)
+            adb_cmd % (ad.serial, '"%s"' % expected_log_path), shell=True)
         self.assertEqual(ad.adb_logcat_file_path, expected_log_path)
 
     @mock.patch(
Repository: google/mobly

Issue:
AdbLogExcerpts filename is invalid on Windows
Windows filenames should not have colons in them:
https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names-fol

Comments:

Patch:
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py
index f1a4636..14828a4 100644
--- a/mobly/controllers/android_device.py
+++ b/mobly/controllers/android_device.py
@@ -436,9 +436,8 @@ class AndroidDevice(object):
         self._log_path = os.path.join(self._log_path_base,
                                       'AndroidDevice%s' % self._serial)
         self._debug_tag = self._serial
-        self.log = AndroidDeviceLoggerAdapter(logging.getLogger(), {
-            'tag': self.debug_tag
-        })
+        self.log = AndroidDeviceLoggerAdapter(logging.getLogger(),
+                                              {'tag': self.debug_tag})
         self.sl4a = None
         self.ed = None
         self._adb_logcat_process = None
@@ -937,6 +936,7 @@ class AndroidDevice(object):
         f_name = os.path.basename(self.adb_logcat_file_path)
         out_name = f_name.replace('adblog,', '').replace('.txt', '')
         out_name = ',%s,%s.txt' % (begin_time, out_name)
+        out_name = out_name.replace(':', '-')
         tag_len = utils.MAX_FILENAME_LEN - len(out_name)
         tag = tag[:tag_len]
         out_name = tag + out_name


Test patch:
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index b1428ec..f175f17 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -630,7 +630,7 @@ class AndroidDeviceTest(unittest.TestCase):
         ad.cat_adb_log('some_test', MOCK_ADB_LOGCAT_BEGIN_TIME)
         cat_file_path = os.path.join(
             ad.log_path, 'AdbLogExcerpts',
-            ('some_test,02-29 14:02:20.123,%s,%s.txt') % (ad.model, ad.serial))
+            ('some_test,02-29 14-02-20.123,%s,%s.txt') % (ad.model, ad.serial))
         with open(cat_file_path, 'r') as f:
             actual_cat = f.read()
         self.assertEqual(actual_cat, ''.join(MOCK_ADB_LOGCAT_CAT_RESULT))
diff --git a/tests/mobly/logger_test.py b/tests/mobly/logger_test.py
index b1cf839..1ac9f1d 100755
--- a/tests/mobly/logger_test.py
+++ b/tests/mobly/logger_test.py
@@ -1,11 +1,11 @@
 # Copyright 2016 Google Inc.
-# 
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Repository: google/yapf

Issue:
yapf returns an exit code of 2 on unformatted but valid input.
Hello there and thanks for developing this much appreciated python formatter.

I’m opening this issue as I’m not sure to understand the logic behind yapf's exit code return when applying it on unformatted and valid input. Indeed, yapf returns an exit code of 2 in such case (which implies something went wrong), yet a valid formatted output is returned. I would consider the operation successful, hence expect an exit code of 0.

Consequently, this behavior tends to break scripts where flow execution rely on the format's success.

I saw a related issue: https://github.com/google/yapf/issues/186 but I don't see the need to inform output has been modified compared to input (i.e. formatted) by returning a status code other than 0 as formatting is the purpose of the tool. Otherwise, _--diff_ option seems the right fit if this information is needed (not to mention UNIX tools can also answer this).

Am I missing something or is this behavior indeed odd? Thanks!

Comments:

Patch:
diff --git a/CHANGELOG b/CHANGELOG
index d331f8d..bb3ffdc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,11 @@
 - It's okay to split in the middle of a dotted name if the whole expression is
   going to go over the column limit.
 
+### Changed
+- Issue #228: Return exit code 0 on success, regardless of whether files were
+  changed.  (Previously, 0 meant success with no files
+  modified, and 2 meant success with at least one file modified.)
+
 ## [0.11.0] 2016-07-17
 ### Added
 - The COALESCE_BRACKETS knob prevents splitting consecutive brackets when
diff --git a/yapf/__init__.py b/yapf/__init__.py
index dfbb8ee..145d8f4 100644
--- a/yapf/__init__.py
+++ b/yapf/__init__.py
@@ -161,7 +161,7 @@ def main(argv):
         lines=lines,
         verify=args.verify)
     sys.stdout.write(reformatted_source)
-    return 2 if changed else 0
+    return 0
 
   files = file_resources.GetCommandLineFiles(args.files, args.recursive,
                                              args.exclude)
@@ -175,7 +175,7 @@ def main(argv):
       in_place=args.in_place,
       print_diff=args.diff,
       verify=args.verify)
-  return 2 if changed else 0
+  return 0
 
 
 def FormatFiles(filenames,


Test patch:
diff --git a/yapftests/main_test.py b/yapftests/main_test.py
index e5a5a74..42e6f9b 100644
--- a/yapftests/main_test.py
+++ b/yapftests/main_test.py
@@ -91,7 +91,7 @@ class MainTest(unittest.TestCase):
     with patched_input(code):
       with captured_output() as (out, err):
         ret = yapf.main(['-', '--style=chromium'])
-        self.assertEqual(ret, 2)
+        self.assertEqual(ret, 0)
         self.assertEqual(out.getvalue(), chromium_code)
 
   def testEchoBadInput(self):
@@ -116,3 +116,4 @@ class MainTest(unittest.TestCase):
       self.assertEqual(ret, 0)
       version = 'yapf {}\n'.format(yapf.__version__)
       self.assertEqual(version, out.getvalue())
+
Repository: google/yapf

Issue:
Regression in formatting nested 'async def' functions
My style file has `blank_line_before_nested_class_or_def=False`.

Yapf 0.19.0 formats like:

```python
async def foo():
    async def bar():
        pass
```

Yapf 0.20.0 changes this to:

```python
async def foo():

    async def bar():
        pass
```

According to `git bisect`, this was introduced by 58e36945be8978deb7ab3ad3681f5feccb0405fc, which seems like it must be a bug, since that commit wasn't intended to change python 3 formatting at all.

Comments:

Patch:
diff --git a/yapf/yapflib/reformatter.py b/yapf/yapflib/reformatter.py
index 7ed7a62..299fef8 100644
--- a/yapf/yapflib/reformatter.py
+++ b/yapf/yapflib/reformatter.py
@@ -439,7 +439,7 @@ def _IsClassOrDef(uwline):
   if uwline.first.value in {'class', 'def'}:
     return True
 
-  return (t.name for t in uwline.tokens[:2]) == ('async', 'def')
+  return [t.value for t in uwline.tokens[:2]] == ['async', 'def']
 
 
 def _CalculateNumberOfNewlines(first_token, indent_depth, prev_uwline,


Test patch:
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 @@ class TestsForPython3Code(yapf_test_helper.YAPFTest):
     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