mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
[python] PY-81424 update message for keyword unpack inspection
GitOrigin-RevId: 24234b4936031a19d08f58fbf871bc1749853745
This commit is contained in:
committed by
intellij-monorepo-bot
parent
50995c2812
commit
2be8cd044b
@@ -572,7 +572,7 @@ INSP.parameter(s).unfilled=Parameter(s) unfilled
|
||||
INSP.incorrect.arguments=Incorrect argument(s)
|
||||
INSP.possible.callees=Possible callees
|
||||
INSP.function.lacks.positional.argument=Function ''{0}'' lacks a positional argument
|
||||
INSP.expected.dict.got.type=Expected a dictionary, got {0}
|
||||
INSP.expected.dict.got.type=Expected a mapping, got {0}
|
||||
INSP.expected.iterable.got.type=Expected an iterable, got {0}
|
||||
|
||||
# PyMethodParametersInspection
|
||||
|
||||
@@ -201,6 +201,7 @@ public final class PyArgumentListInspection extends PyInspection {
|
||||
if (inside_type != null && !PyTypeChecker.isUnknown(inside_type, context)) {
|
||||
if (((PyStarArgument)arg).isKeyword()) {
|
||||
if (!PyABCUtil.isSubtype(inside_type, PyNames.MAPPING, context)) {
|
||||
// TODO: check that the key type is compatible with `str`
|
||||
holder.registerProblem(arg, PyPsiBundle.message("INSP.expected.dict.got.type", inside_type.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,4 +476,16 @@ public class Py3ArgumentListInspectionTest extends PyInspectionTestCase {
|
||||
c = MyClass(1)
|
||||
""");
|
||||
}
|
||||
|
||||
public void testKeywordUnpack() {
|
||||
doTestByText("""
|
||||
from collections.abc import Mapping
|
||||
|
||||
class M(Mapping[str, str]): pass
|
||||
|
||||
dict(**M())
|
||||
|
||||
dict(<warning descr="Expected a mapping, got int">**1</warning>)
|
||||
""");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user