PY-53643 Missing "async" statement when pulling method up as abstract

GitOrigin-RevId: fa2b7329d462abaf71eb61d33f6b30c931a26a2f
This commit is contained in:
chbndrhnns
2025-09-08 13:06:06 +00:00
committed by intellij-monorepo-bot
parent cf942d7405
commit 880f53d07f
6 changed files with 32 additions and 0 deletions
@@ -69,6 +69,9 @@ public class PyFunctionBuilder {
}
}
}
if (source.isAsync()) {
functionBuilder.makeAsync();
}
functionBuilder.myDocStringGenerator = PyDocstringGenerator.forDocStringOwner(source);
return functionBuilder;
}
@@ -0,0 +1,6 @@
from SuperClass import Parent
class Child(Parent):
async def async_method(self):
"""An async method that should be pulled up"""
return "result"
@@ -0,0 +1,6 @@
from SuperClass import Parent
class Child(Parent):
async def async_method(self):
"""An async method that should be pulled up"""
return "result"
@@ -0,0 +1,8 @@
from abc import ABCMeta, abstractmethod
class Parent(metaclass=ABCMeta):
@abstractmethod
async def async_method(self):
"""An async method that should be pulled up"""
pass
@@ -0,0 +1,2 @@
class Parent:
pass
@@ -143,6 +143,13 @@ public class PyPullUpTest extends PyClassRefactoringTest {
checkAbstract(".my_method", ".my_class_method");
}
/**
* Ensures that pulling async method up as abstract preserves the async keyword
*/
public void testAbstractAsyncMethod() {
checkAbstract(".async_method");
}
/**
* Moves methods fromn Child to Parent and make them abstract
* @param methodNames methods to check