Make python-latest project descriptor default in tests

Update test data and reduce manual language level setup

GitOrigin-RevId: d6ddec1b2b29a2b7f1a34cfb5982fd975de78d65
This commit is contained in:
Semyon Proshev
2021-03-15 17:33:04 +00:00
committed by intellij-monorepo-bot
parent f247cfde52
commit 56a1c00c2a
177 changed files with 1118 additions and 1508 deletions
@@ -1,6 +1,6 @@
print "Line 2"
print("Line 2")
class Test:
def __init__(self):
print "Line 2"
print("Line 2")
print "Line 1"
print("Line 1")
@@ -1,5 +1,5 @@
print "Line 2"
print("Line 2")
class Test:
def __init__(self):
<caret>
print "Line 1"
print("Line 1")
@@ -1,5 +1,5 @@
<selection>print "Line 2"
<selection>print("Line 2")
</selection><caret>
class Test:
def __init__(self):
print "Line 1"
print("Line 1")
@@ -5,4 +5,4 @@ class Adjunct:
def foo(): pass
class B: pass
print '239'
print('239')
@@ -12,4 +12,4 @@ class Adjunct:
class B: pass
print '239'
print('239')
+1 -1
View File
@@ -1,6 +1,6 @@
def foo(a):
if a == 5:
# a is 5
print 'no'
print('no')
foo(5)
+1 -1
View File
@@ -1,7 +1,7 @@
def foo(a):
if a == 5:
# a is 5
print 'no'
print('no')
foo(5)
@@ -1,4 +1,4 @@
spam( ham[ 1 ], { eggs: 2 } )
if x == 4 : print x , y ; x , y = y , x
if x == 4 : print(x , y) ; x , y = y , x
spam (1)
dict ['key'] = list [index]
@@ -1,4 +1,4 @@
spam(ham[1], {eggs: 2})
if x == 4: print x, y; x, y = y, x
if x == 4: print(x, y); x, y = y, x
spam(1)
dict['key'] = list[index]
+1 -1
View File
@@ -1,3 +1,3 @@
# Whole-line commend that starts with whitespace.
if True: #Trailing comment with no whitespace
print 'Spam' # Trailing comment with excess whitespace
print('Spam') # Trailing comment with excess whitespace
@@ -1,3 +1,3 @@
# Whole-line commend that starts with whitespace.
if True: # Trailing comment with no whitespace
print 'Spam' # Trailing comment with excess whitespace
print('Spam') # Trailing comment with excess whitespace
+3 -3
View File
@@ -1,8 +1,8 @@
def bad_autoformat_example():
a = 5
b = 10
print a, b
print(a, b)
(a, b) = b, a
print a, b
print(a, b)
a, b = b, a
print a, b
print(a, b)
@@ -1,8 +1,8 @@
def bad_autoformat_example():
a = 5
b = 10
print a, b
print(a, b)
(a, b) = b, a
print a, b
print(a, b)
a, b = b, a
print a, b
print(a, b)
@@ -1,5 +1,6 @@
<node text="SubclassTwo.a_method(self) (SubclassTwo in hierarchy.call.Static.Super.main)" base="true">
<node text="super.__init__(self, t, obj) (super in __builtin__)"/>
<node text="super.__init__(self, t) (super in __builtin__)"/>
<node text="super.__init__(self, t, obj) (super in builtins)"/>
<node text="super.__init__(self, t) (super in builtins)"/>
<node text="super.__init__(self) (super in builtins)"/>
<node text="SomeBaseClass.a_method(self) (SomeBaseClass in hierarchy.call.Static.Super.main)"/>
</node>
@@ -62,7 +62,7 @@ class Foo(object):
pass
for elt in range(10):
print elt
print(elt)
else:
for elt in range(10):
for <weak_warning descr="Variable 'elt' is already declared in 'for' loop or 'with' statement above">elt</weak_warning> in range(10):
@@ -58,20 +58,20 @@ for b in [1,2]:
for item in range(5):
want_to_import = False
print want_to_import
print(want_to_import)
want_to_import = 2 #No error should be here
if True:
pass
for ((a, b), (c, d)) in {(1, 2): (3, 4)}.items():
print b
print(b)
x = [1]
for x[0] in range(1,2):
print i
print(i)
for x[i] in range(1,2):
print i
print(i)
x = [[1]]
for x[0][0] in range(1,2):
@@ -93,7 +93,7 @@ def contains_even_number(l):
See: PY-12367
"""
for elt in range(10):
print elt
print(elt)
else:
for elt in range(10):
pass
@@ -3,6 +3,6 @@ bar = 1
def foo():
global bar
print bar
print(bar)
foo()
@@ -1,6 +1,6 @@
__author__ = 'ktisha'
def foo():
global <weak_warning descr="Global variable 'bar' is undefined at the module level">bar</weak_warning>
print bar
print(bar)
foo()
@@ -1,7 +1,7 @@
class Base(object):
def __init__(self, param):
print "Base", param
print("Base", param)
class Wrapper(object):
@@ -9,7 +9,7 @@ class Wrapper(object):
def __init__(self, param1, param2):
# Here PyCharm claims no super call
super(Wrapper.Child, self).__init__(param2)
print "Child", param1
print("Child", param1)
def __init__(self):
self.child = self.Child("aaa", "bbb")
@@ -1 +1 @@
def <weak_warning descr="Function name should be lowercase">doStuff</weak_warning>(a): print a
def <weak_warning descr="Function name should be lowercase">doStuff</weak_warning>(a): print(a)
@@ -12,4 +12,4 @@ class Upper(object):
pass
def foo(self):
print self.prop
print(self.prop)
@@ -8,4 +8,4 @@ class A:
self.b= 1
print <weak_warning descr="Access to a protected member _a of a class">A()._a</weak_warning>
print(<weak_warning descr="Access to a protected member _a of a class">A()._a</weak_warning>)
@@ -6,4 +6,4 @@ def g():
s = 1
return <weak_warning descr="Remove redundant parentheses">(s)</weak_warning>.bit_length()
print <weak_warning descr="Remove redundant parentheses">("2")</weak_warning>.capitalize()
print(<weak_warning descr="Remove redundant parentheses">("2")</weak_warning>.capitalize())
@@ -12,7 +12,7 @@ def bar():
class Printer(object):
def __lshift__(self, what):
print what
print(what)
cout = Printer()
cout << "Hello, world" # must not be reported
@@ -41,7 +41,7 @@ def is_good(a):
return a > 10
def do_something(a):
print a
print(a)
def process():
for a in range(20):
@@ -6,5 +6,5 @@ def foo(requestId):
with DbSession() as db:
req = db.query(ChartRequest).get(requestId)
assert req is not None, u"Invalid request"
print req
print(req)
@@ -3,4 +3,4 @@ foo = True
def bar():
if foo: #pass
print 1
print(1)
@@ -20,7 +20,7 @@ def buzz():
buzz()
print BLA_BLA_BLA #pass
print(BLA_BLA_BLA) #pass
if foo():
d = 1
@@ -116,7 +116,6 @@ def foo(<weak_warning descr="Parameter 'a' value is not used">a = 123</weak_warn
def loopie():
for x in range(5): pass
for y in xrange(10): pass
def locals_inside():
now = datetime.datetime.now() # pass
@@ -1,10 +1,10 @@
def foo():
for x, y in [(1, 2)]:
print x
print(x)
def test_vlu():
<error descr="Python version 2.6 does not support starred expressions as assignment targets">*<weak_warning descr="Local variable 'h' value is not used">h</weak_warning></error>, <weak_warning descr="Local variable 't' value is not used">t</weak_warning> = [1, 2, 3] # fail
*<weak_warning descr="Local variable 'h' value is not used">h</weak_warning>, <weak_warning descr="Local variable 't' value is not used">t</weak_warning> = [1, 2, 3] # fail
def test_vlu():
<error descr="Python version 2.6 does not support starred expressions as assignment targets">*h</error>, t = [1, 2, 3] # pass
*h, t = [1, 2, 3] # pass
print(t)
@@ -1,2 +1,2 @@
# noinspection PyUnresolvedReferences
print x<caret>xx
print(x<caret>xx)
@@ -1 +1 @@
print x<caret>xx
print(x<caret>xx)
@@ -1,3 +1,3 @@
# language=Python
print "# noinspection PyUnresolvedReferences\
print xxx"
print("# noinspection PyUnresolvedReferences\
print(xxx)")
@@ -1,3 +1,3 @@
# noinspection PyUnresolvedReferences
#language=Python
print "print xxx"
print("print(xxx)")
@@ -1,4 +1,4 @@
#noinspection PyUnresolvedReferences
class C:
def foo(self):
print xxx
print(xxx)
@@ -4,4 +4,4 @@ class C:
#noinspection PyUnresolvedReferences
def foo():
print xxx
print(xxx)
@@ -1,2 +1,2 @@
#noinspection PyUnresolvedReferences
print xxx
print(xxx)
@@ -1,4 +1,4 @@
import __builtin<caret>__ as b
import buil<caret>tins as b
quotient, rem = b.divmod(42, 3)
@@ -1,4 +1,4 @@
from __builtin__ import staticmethod, divmod
from builtins import staticmethod, divmod
quotient, rem = divmod(42, 3)
+3 -3
View File
@@ -1,5 +1,5 @@
if condition:
if condition2:
print "test"
prin<caret>t "test1"
print "test2"
print("test")
prin<caret>t("test1")
print("test2")
@@ -1,5 +1,5 @@
if condition:
if condition2:
print "test"
print "test1"
print "test2"
print("test")
print("test1")
print("test2")
+3 -3
View File
@@ -1,5 +1,5 @@
if condition:
if condition2:
print "test1"
print "test"
print "test2"
print("test1")
print("test")
print("test2")
@@ -4,7 +4,7 @@ from m1 import f, g, C, stub_only
def test_overloaded_function(x):
g(<warning descr="Expected type 'dict', got 'int' instead">f(10)</warning>)
g(<warning descr="Expected type 'dict', got 'str' instead">f('foo')</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">f(<warning descr="Unexpected type(s):(Dict[int, int])Possible type(s):(str)(int)">{1: 2}</warning>)</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">f(<warning descr="Unexpected type(s):(dict[int, int])Possible type(s):(str)(int)">{1: 2}</warning>)</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">f(x)</warning>)
@@ -12,18 +12,18 @@ def test_overloaded_subscription_operator_parameters():
c = C()
print(c[10])
print(c['foo'])
print(c[<warning descr="Unexpected type(s):(Dict[int, int])Possible type(s):(int)(str)">{1: 2}</warning>])
print(c[<warning descr="Unexpected type(s):(dict[int, int])Possible type(s):(int)(str)">{1: 2}</warning>])
def test_overloaded_binary_operator_parameters():
c = C()
print(c + 10)
print(c + 'foo')
print(c + <warning descr="Unexpected type(s):(Dict[int, int])Possible type(s):(int)(str)">{1: 2}</warning>)
print(c + <warning descr="Unexpected type(s):(dict[int, int])Possible type(s):(int)(str)">{1: 2}</warning>)
def test_stub_only_function(x):
g(<warning descr="Expected type 'dict', got 'int' instead">stub_only(10)</warning>)
g(<warning descr="Expected type 'dict', got 'str' instead">stub_only('foo')</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">stub_only(x)</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">stub_only(<warning descr="Unexpected type(s):(Dict[int, int])Possible type(s):(str)(int)">{1: 2}</warning>)</warning>)
g(<warning descr="Expected type 'dict', got 'Union[str, int]' instead">stub_only(<warning descr="Unexpected type(s):(dict[int, int])Possible type(s):(str)(int)">{1: 2}</warning>)</warning>)
@@ -1,6 +1,6 @@
class A:
def m<caret>(self):
print 1
print(1)
b = A()
a = b.m()
@@ -1,5 +1,5 @@
def m():
print 1
print(1)
class A:
@@ -1,5 +1,5 @@
class A:
def m<caret>(self, x):
print 1
print(1)
A.m(A(), 1)
@@ -1,5 +1,5 @@
def m(x):
print 1
print(1)
class A:
@@ -3,4 +3,4 @@ class A():
self.method2()
def metho<caret>d2(self):
print 1
print(1)
@@ -1,5 +1,5 @@
def method2():
print 1
print(1)
class A():
@@ -3,4 +3,4 @@ class A:
return x
print A.m(A(), 1)
print(A.m(A(), 1))
@@ -4,4 +4,4 @@ class A:
return x
print A.m(1)
print(A.m(1))
@@ -1,5 +1,5 @@
def f1(a, u<caret>p, c):
print a
print c
print(a)
print(c)
f1(1, 2, 3)
@@ -1,5 +1,5 @@
def f1(a, c):
print a
print c
print(a)
print(c)
f1(1, 3)
@@ -1,4 +1,4 @@
class B(object):
def __init__(self): # error
print ""
print("")
<warning descr="Cannot return a value from __init__">return <caret>1</warning>
@@ -1,3 +1,3 @@
class B(object):
def __init__(self): # error
print ""
print("")
@@ -5,7 +5,7 @@ class A:
self.foo()
def foo(self):
print 1
print(1)
def bar(self):
self.foo()
@@ -1,8 +1,8 @@
class A:
def baz(self):
print<caret> 1
print 1
print<caret>(1)
print(1)
def bar(self):
print 1
print(1)
@@ -5,4 +5,4 @@ def bar():
def foo():
a = 1
print a
print(a)
@@ -1,5 +1,5 @@
def bar():
<selection>a = 1
print a</selection>
print(a)</selection>
a = 1
print a
print(a)
@@ -7,4 +7,4 @@ def bar():
def foo(a_new):
print a_new
print(a_new)
@@ -2,5 +2,5 @@ def bar():
a = 1
b = 2
<selection>print a</selection>
print b
<selection>print(a)</selection>
print(b)
@@ -4,4 +4,4 @@ class C:
def bar(self):
for x in [1, 2]:
print x
print(x)
@@ -1,4 +1,4 @@
class C:
def foo(self):
<selection>for x in [1, 2]:
print x</selection>
print(x)</selection>
@@ -1,6 +1,6 @@
def foo():
for key in t_search['results']:
print texts.append(key['text'])
print(texts.append(key['text']))
foo()
@@ -1,2 +1,2 @@
<selection>for key in t_search['results']:
print texts.append(key['text'])</selection>
print(texts.append(key['text']))</selection>
@@ -5,4 +5,4 @@ class C:
@staticmethod
def baz():
print "hello world"
print("hello world")
@@ -1,4 +1,4 @@
class C:
@staticmethod
def foo():
<selection>print "hello world"</selection>
<selection>print("hello world")</selection>
@@ -1,6 +1,6 @@
def foo(a, b):
if a < b:
params = {'a': 'b'}
print params
print(params)
else:
print {'c': 'd'}
print({'c': 'd'})
@@ -1,7 +1,7 @@
def foo(a, b):
if a < b:
params = {'a': 'b'}
print params
print(params)
else:
params = {'c': 'd'}
print p<caret>arams
print(p<caret>arams)
@@ -1,3 +1,3 @@
print ('spam!' * 42)
print('spam!' * 42)
('spam!' * 42)
hex('spam!' * 42)
@@ -1,5 +1,5 @@
x<caret> = 'spam!' * 42
print (x)
print(x)
(x)
hex(x)
@@ -1,4 +1,4 @@
class DirectMeta(type):
def __init__(cls, arg1, arg2):
cls.a = arg1
print cls.a
print(cls.a)
@@ -1,3 +1,3 @@
class DirectMeta(type):
def __init__(cls, arg1, arg2):
print a<caret>rg1
print(a<caret>rg1)
@@ -3,4 +3,4 @@ class Foo:
self.a = ""
def bar(self):
print self.a
print(self.a)
@@ -1,4 +1,4 @@
class Foo:
def bar(self):
<selection>c</selection> = ""
print c
print(c)
+2 -2
View File
@@ -1,5 +1,5 @@
import os
def f(arg):
print <selection>a<caret>rg</selection>
print "a"
print(<selection>a<caret>rg</selection>)
print("a")
+2 -2
View File
@@ -1,5 +1,5 @@
import os
def f(arg):
<selection>print a<caret>rg</selection>
print "a"
print<selection>(a<caret>rg)</selection>
print("a")
+2 -2
View File
@@ -1,5 +1,5 @@
import os
def f(arg):
<selection> print a<caret>rg
</selection> print "a"
<selection>print(a<caret>rg)</selection>
print("a")
+2 -2
View File
@@ -1,5 +1,5 @@
import os
def f(arg):
<selection> print a<caret>rg
print "a"</selection>
<selection> print(a<caret>rg)
</selection> print("a")
+3 -3
View File
@@ -1,5 +1,5 @@
import os
<selection>def f(arg):
print a<caret>rg
print "a"</selection>
def f(arg):
<selection> print(a<caret>rg)
print("a")</selection>
@@ -0,0 +1,5 @@
import os
<selection>def f(arg):
print(a<caret>rg)
print("a")</selection>
+2 -2
View File
@@ -1,5 +1,5 @@
import os
def f(arg):
print a<caret>rg
print "a"
print(a<caret>rg)
print("a")
@@ -1 +1 @@
print [xyzzy for xyzzy in range(1, 10)]
print([xyzzy for xyzzy in range(1, 10)])
+1 -1
View File
@@ -1,3 +1,3 @@
def foo():
<selection>print "hello"</selection>
<selection>print("hello")</selection>
@@ -1,4 +1,4 @@
def foo():
if <selection>True</selection>:
print "hello"
print("hello")
@@ -1,2 +1,2 @@
def foo():
pr<caret>int "hello"
pr<caret>int("hello")
@@ -1,5 +1,5 @@
def foo():
try:
print "hello"
print("hello")
except:
<selection>pass</selection>
@@ -1,3 +1,3 @@
def foo():
<selection>print "hello"</selection>
<selection>print("hello")</selection>
@@ -1,4 +1,4 @@
def foo():
while <selection>True</selection>:
print "hello"
print("hello")
@@ -4,7 +4,6 @@ package com.jetbrains.python;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.openapi.module.Module;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.TestDataPath;
import com.intellij.testFramework.fixtures.TestLookupElementPresentation;
@@ -26,10 +25,6 @@ import java.util.List;
*/
@TestDataPath("$CONTENT_ROOT/../testData/completion")
public class Py3CompletionTest extends PyTestCase {
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
public void testPropertyDecorator() {
doTest();
@@ -1,22 +0,0 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.inspections.PyDeprecationInspection;
import org.jetbrains.annotations.Nullable;
public class Py3DeprecationTest extends PyTestCase {
public void testAbcDeprecatedAbstracts() {
myFixture.enableInspections(PyDeprecationInspection.class);
myFixture.configureByFile("deprecation/abcDeprecatedAbstracts.py");
myFixture.checkHighlighting(true, false, false);
}
@Nullable
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
}
@@ -15,22 +15,14 @@
*/
package com.jetbrains.python;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Py3HighlightingTest extends PyTestCase {
@NotNull
private static final String TEST_PATH = "/highlighting/";
@Nullable
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
// PY-20770
public void testNonEmptyReturnInsideAsyncDef() {
doTest(true, false);
@@ -1,47 +0,0 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyInspectionTestCase;
import com.jetbrains.python.inspections.PyInspection;
import com.jetbrains.python.inspections.PyMethodOverridingInspection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Py3MethodOverridingInspectionTest extends PyInspectionTestCase {
@Nullable
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
// PY-17828
public void testDunderPrepare() {
doTest();
}
@NotNull
@Override
protected Class<? extends PyInspection> getInspectionClass() {
return PyMethodOverridingInspection.class;
}
@Override
protected boolean isLowerCaseTestFile() {
return false;
}
}
@@ -16,7 +16,6 @@
package com.jetbrains.python;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.TestDataFile;
import com.intellij.testFramework.TestDataPath;
import com.jetbrains.python.fixtures.PyTestCase;
@@ -32,10 +31,6 @@ import java.util.List;
@TestDataPath("$CONTENT_ROOT/../testData/inspections/")
public class Py3QuickFixTest extends PyTestCase {
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
// PY-13685
public void testReplacePrintEnd() {
@@ -17,7 +17,6 @@ package com.jetbrains.python;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyResolveTestCase;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyBuiltinCache;
@@ -29,10 +28,6 @@ import com.jetbrains.python.pyi.PyiUtil;
* @author yole
*/
public class Py3ResolveTest extends PyResolveTestCase {
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
@Override
protected PsiElement doResolve() {
@@ -3,7 +3,6 @@ package com.jetbrains.python;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.psi.types.TypeEvalContext;
@@ -15,11 +14,6 @@ import org.jetbrains.annotations.NotNull;
public class Py3TypeTest extends PyTestCase {
public static final String TEST_DIRECTORY = "/types/";
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return ourPyLatestDescriptor;
}
// PY-6702
public void testYieldFromType() {
doTest("Union[str, int, float]",
@@ -3,6 +3,7 @@ package com.jetbrains.python;
import com.intellij.codeInsight.controlflow.ControlFlow;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.UsefulTestCase;
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
@@ -11,9 +12,15 @@ import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nullable;
public class PyControlFlowBuilderTest extends LightMarkedTestCase {
@Override
protected @Nullable LightProjectDescriptor getProjectDescriptor() {
return ourPy2Descriptor;
}
@Override
public String getTestDataPath() {
return PythonTestUtil.getTestDataPath() + "/codeInsight/controlflow/";
@@ -19,7 +19,6 @@ import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.LanguageLevel;
/**
* @author yole
@@ -451,7 +450,7 @@ public class PyCopyPasteTest extends PyTestCase {
// PY-19100
public void testAsyncFunctionWithBadSelection() {
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
doTest();
}
// PY-20138
@@ -83,4 +83,10 @@ public class PyDeprecationTest extends PyTestCase {
myFixture.configureByFile("a.py");
myFixture.checkHighlighting(true, false, false);
}
public void testAbcDeprecatedAbstracts() {
myFixture.enableInspections(PyDeprecationInspection.class);
myFixture.configureByFile("deprecation/abcDeprecatedAbstracts.py");
myFixture.checkHighlighting(true, false, false);
}
}
@@ -78,11 +78,9 @@ abstract class PyExternalDocTest : PyTestCase() {
val elementName = qname.substring(ind+1)
val p = PyStdlibDocumentationLinkProvider()
TestCase.assertEquals(expectedUrl,
"${p.webPageName(QualifiedName.fromDottedString(moduleName), projectDescriptor.sdk)}.html#${p.fragmentName(
"${p.webPageName(QualifiedName.fromDottedString(moduleName), projectDescriptor!!.sdk)}.html#${p.fragmentName(
moduleName)}.$elementName")
}
override fun getProjectDescriptor() = ourPyLatestDescriptor
}
class PyExternalDocTestPy3 : PyExternalDocTest() {
@@ -147,5 +145,5 @@ class PyExternalDocTestPy2 : PyExternalDocTest() {
doUrl("pyexpat.ErrorString", "pyexpat.html#xml.parsers.expat.ErrorString")
}
override fun getProjectDescriptor() = ourPyDescriptor
override fun getProjectDescriptor() = ourPy2Descriptor
}
@@ -78,11 +78,7 @@ public class PyFormatterTest extends PyTestCase {
}
public void testStarExpression() { // PY-1523
doTestPy3();
}
private void doTestPy3() {
runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest);
doTest();
}
public void testWrapTuple() { // PY-1792
@@ -308,7 +304,7 @@ public class PyFormatterTest extends PyTestCase {
" desired_impulse_response = {'dirac, 'gaussian', logistic_derivative'}\n" +
"return desired, o";
final PsiFile file = PyElementGenerator.getInstance(myFixture.getProject()).createDummyFile(LanguageLevel.PYTHON34, initial);
final PsiFile file = PyElementGenerator.getInstance(myFixture.getProject()).createDummyFile(LanguageLevel.getLatest(), initial);
final PsiElement reformatted = CodeStyleManager.getInstance(myFixture.getProject()).reformat(file);
String expected =
@@ -391,17 +387,17 @@ public class PyFormatterTest extends PyTestCase {
}
public void testLongWith() { // PY-8743
runWithLanguageLevel(LanguageLevel.PYTHON27, this::doTest);
doTest();
}
// PY-8961, PY-16050
public void testSpaceInAnnotations() {
doTestPy3();
doTest();
}
// PY-15791
public void testForceSpacesAroundEqualSignInAnnotatedParameter() {
doTestPy3();
doTest();
}
public void testWrapInBinaryExpression() { // PY-9032
@@ -903,7 +899,7 @@ public class PyFormatterTest extends PyTestCase {
// PY-20970
public void testSpacesAfterNonlocal() {
runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest);
doTest();
}
// PY-21515
@@ -912,7 +908,7 @@ public class PyFormatterTest extends PyTestCase {
}
public void testSpacesAfterFromInYieldFrom() {
runWithLanguageLevel(LanguageLevel.PYTHON34, this::doTest);
doTest();
}
// PY-24220
@@ -1019,7 +1015,7 @@ public class PyFormatterTest extends PyTestCase {
}
public void testVariableAnnotations() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
doTest();
}
// PY-27266
@@ -1033,7 +1029,7 @@ public class PyFormatterTest extends PyTestCase {
}
public void testMultilineFStringExpressions() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
doTest();
}
// PY-33656
@@ -1045,24 +1041,24 @@ public class PyFormatterTest extends PyTestCase {
public void testFStringFragmentWrappingSplitInsideExpression() {
getCodeStyleSettings().setRightMargin(PythonLanguage.getInstance(), 20);
getCommonCodeStyleSettings().WRAP_LONG_LINES = true;
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
doTest();
}
// PY-27615
public void testFStringFragmentWrappingSplitInsideNestedExpression() {
getCodeStyleSettings().setRightMargin(PythonLanguage.getInstance(), 20);
getCommonCodeStyleSettings().WRAP_LONG_LINES = true;
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
doTest();
}
// PY-40778
public void testFStringSpacesBetweenFragmentAndExpressionBracesPreserved() {
runWithLanguageLevel(LanguageLevel.getLatest(), this::doTest);
doTest();
}
// PY-31991
public void testSpacesAroundFStringFragmentExpressionStripped() {
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
doTest();
}
// PY-36009
@@ -1072,7 +1068,7 @@ public class PyFormatterTest extends PyTestCase {
// PY-35975
public void testSpacesAroundColonEqInAssignmentExpression() {
runWithLanguageLevel(LanguageLevel.PYTHON38, this::doTest);
doTest();
}
// PY-23475

Some files were not shown because too many files have changed in this diff Show More