mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-21692 Fixed: Return type of sum(List[Decimal]) is 'Any' (should be 'Decimal')
Add skeletons for builtin sum function
This commit is contained in:
@@ -229,6 +229,16 @@ def max(*args, key=None, default=None):
|
||||
pass
|
||||
|
||||
|
||||
def sum(iterable, start=0):
|
||||
"""Sums start and the items of an iterable from left to right and returns
|
||||
the total.
|
||||
|
||||
:type iterable: collections.Iterable[T]
|
||||
:rtype: T
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def next(iterator, default=None):
|
||||
"""Return the next item from the iterator.
|
||||
|
||||
|
||||
@@ -232,6 +232,16 @@ def max(*args, key=None, default=None):
|
||||
pass
|
||||
|
||||
|
||||
def sum(iterable, start=0):
|
||||
"""Sums start and the items of an iterable from left to right and returns
|
||||
the total.
|
||||
|
||||
:type iterable: collections.Iterable[T]
|
||||
:rtype: T
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def next(iterator, default=None):
|
||||
"""Return the next item from the iterator.
|
||||
|
||||
|
||||
@@ -475,6 +475,12 @@ public class Py3TypeTest extends PyTestCase {
|
||||
"expr = max(1, 2, 3)");
|
||||
}
|
||||
|
||||
// PY-21692
|
||||
public void testSumResult() {
|
||||
doTest("int",
|
||||
"expr = sum([1, 2, 3])");
|
||||
}
|
||||
|
||||
private void doTest(final String expectedType, final String text) {
|
||||
myFixture.configureByText(PythonFileType.INSTANCE, text);
|
||||
final PyExpression expr = myFixture.findElementByText("expr", PyExpression.class);
|
||||
|
||||
@@ -1524,6 +1524,12 @@ public class PyTypeTest extends PyTestCase {
|
||||
"expr = max(1, 2, 3)");
|
||||
}
|
||||
|
||||
// PY-21692
|
||||
public void testSumResult() {
|
||||
doTest("int",
|
||||
"expr = sum([1, 2, 3])");
|
||||
}
|
||||
|
||||
private static List<TypeEvalContext> getTypeEvalContexts(@NotNull PyExpression element) {
|
||||
return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
|
||||
TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());
|
||||
|
||||
Reference in New Issue
Block a user