PY-46099 Fix ClassCastException in FlaskSQLAlchemyTypeProvider

(cherry picked from commit f939dd3ae0b9811a7389c82408f8e973bf5ef2a3)

IJ-MR-5058

GitOrigin-RevId: 6b1b00fe2b7c31756a213d7729bd273095cfc9b6
This commit is contained in:
andrey.matveev
2021-03-15 13:15:38 +00:00
committed by intellij-monorepo-bot
parent 6f4b5c57c1
commit 0763dc23f0
3 changed files with 30 additions and 0 deletions
@@ -0,0 +1,14 @@
class Foo:
def foo(self):
pass
class Bar:
@staticmethod
def baz():
foo = Foo()
foo.foo()
class Baz(Bar):
pass
@@ -0,0 +1,10 @@
class Foo:
def foo(self):
pass
class Baz:
@staticmethod
def baz():
foo = Foo()
foo.foo()
@@ -239,4 +239,10 @@ public class PyExtractSuperclassTest extends PyClassRefactoringTest {
String expected = psi_mgr.findFile(LocalFileSystem.getInstance().findFileByIoFile(expected_file)).getText().trim();
assertEquals(expected, result);
}
// PY-46099
public void testNoClassCastExceptionInCopiedFunctionWithClassInitAndMethodCall() {
runWithLanguageLevel(LanguageLevel.getLatest(),
() -> doSimpleTest("Baz", "Bar", null, true, false, ".baz"));
}
}