summaryrefslogtreecommitdiff
path: root/python/testData
diff options
context:
space:
mode:
Diffstat (limited to 'python/testData')
-rw-r--r--python/testData/formatter/commentBetweenClasses_after.py1
-rw-r--r--python/testData/formatter/continuationIndentInIndentingStatement.py31
-rw-r--r--python/testData/formatter/continuationIndentInIndentingStatement_after.py31
-rw-r--r--python/testData/formatter/indentParensInImport.py3
-rw-r--r--python/testData/formatter/indentParensInImport_after.py3
-rw-r--r--python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment.py18
-rw-r--r--python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment_after.py22
-rw-r--r--python/testData/inspections/FieldFromUnusedParameterKeyword.py3
-rw-r--r--python/testData/inspections/FieldFromUnusedParameterKeyword_after.py4
-rw-r--r--python/testData/inspections/FieldFromUnusedParameter_after.py4
-rw-r--r--python/testData/inspections/PyArgumentListInspection/decoratorsPy3K.py7
-rw-r--r--python/testData/inspections/PyUnresolvedReferencesInspection/contextManagerSubclass.py12
-rw-r--r--python/testData/inspections/PyUnresolvedReferencesInspection/ivarInDocstring.py10
-rw-r--r--python/testData/inspections/PyUnresolvedReferencesInspection/returnSelfInSuperClass.py13
-rw-r--r--python/testData/inspections/PyUnusedLocalVariableInspection/test.py13
-rw-r--r--python/testData/inspections/ReplaceNotEqOperator.py2
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance_after.py3
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py2
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter.py (renamed from python/testData/inspections/FieldFromUnusedParameter.py)0
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword.py3
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword_after.py4
-rw-r--r--python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter_after.py4
-rw-r--r--python/testData/quickFixes/AddMethodQuickFixTest/addMethodFromMethod_after.py1
-rw-r--r--python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/addPass_after.py2
-rw-r--r--python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/moveToInit_after.py2
-rw-r--r--python/testData/refactoring/introduceField/py4437.after.py2
26 files changed, 182 insertions, 18 deletions
diff --git a/python/testData/formatter/commentBetweenClasses_after.py b/python/testData/formatter/commentBetweenClasses_after.py
index b8523949c0b6..e97c76b04590 100644
--- a/python/testData/formatter/commentBetweenClasses_after.py
+++ b/python/testData/formatter/commentBetweenClasses_after.py
@@ -2,6 +2,7 @@ class T1(object):
def m1(self):
pass
+
# comment about T2
class T2(object):
diff --git a/python/testData/formatter/continuationIndentInIndentingStatement.py b/python/testData/formatter/continuationIndentInIndentingStatement.py
new file mode 100644
index 000000000000..5822bc4971bb
--- /dev/null
+++ b/python/testData/formatter/continuationIndentInIndentingStatement.py
@@ -0,0 +1,31 @@
+if True \
+ or False:
+ pass
+elif \
+ False:
+ pass
+
+for i in \
+ range(1, 100):
+ pass
+
+with open('file1') as file1, \
+ open('file2') as file2:
+ pass
+
+
+class \
+ A(object):
+ pass
+
+
+def \
+ foo():
+ pass
+
+
+try:
+ pass
+except \
+ AttributeError:
+ pass \ No newline at end of file
diff --git a/python/testData/formatter/continuationIndentInIndentingStatement_after.py b/python/testData/formatter/continuationIndentInIndentingStatement_after.py
new file mode 100644
index 000000000000..f38dd5199edd
--- /dev/null
+++ b/python/testData/formatter/continuationIndentInIndentingStatement_after.py
@@ -0,0 +1,31 @@
+if True \
+ or False:
+ pass
+elif \
+ False:
+ pass
+
+for i in \
+ range(1, 100):
+ pass
+
+with open('file1') as file1, \
+ open('file2') as file2:
+ pass
+
+
+class \
+ A(object):
+ pass
+
+
+def \
+ foo():
+ pass
+
+
+try:
+ pass
+except \
+ AttributeError:
+ pass \ No newline at end of file
diff --git a/python/testData/formatter/indentParensInImport.py b/python/testData/formatter/indentParensInImport.py
new file mode 100644
index 000000000000..ab20f1b5571b
--- /dev/null
+++ b/python/testData/formatter/indentParensInImport.py
@@ -0,0 +1,3 @@
+from some.module import (
+ thing
+ ) \ No newline at end of file
diff --git a/python/testData/formatter/indentParensInImport_after.py b/python/testData/formatter/indentParensInImport_after.py
new file mode 100644
index 000000000000..2ad9216af71c
--- /dev/null
+++ b/python/testData/formatter/indentParensInImport_after.py
@@ -0,0 +1,3 @@
+from some.module import (
+ thing
+) \ No newline at end of file
diff --git a/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment.py b/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment.py
new file mode 100644
index 000000000000..a0f52904114e
--- /dev/null
+++ b/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment.py
@@ -0,0 +1,18 @@
+class A(object):
+ pass
+
+#comment
+def one():
+ pass
+
+# comment
+def two():
+ pass
+
+#comment
+class B(object):
+ pass
+
+#comment
+class C(object):
+ pass \ No newline at end of file
diff --git a/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment_after.py b/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment_after.py
new file mode 100644
index 000000000000..d582036d8654
--- /dev/null
+++ b/python/testData/formatter/twoLinesBetweenTopLevelDeclarationsWithComment_after.py
@@ -0,0 +1,22 @@
+class A(object):
+ pass
+
+
+#comment
+def one():
+ pass
+
+
+# comment
+def two():
+ pass
+
+
+#comment
+class B(object):
+ pass
+
+
+#comment
+class C(object):
+ pass \ No newline at end of file
diff --git a/python/testData/inspections/FieldFromUnusedParameterKeyword.py b/python/testData/inspections/FieldFromUnusedParameterKeyword.py
deleted file mode 100644
index 35851f0f87df..000000000000
--- a/python/testData/inspections/FieldFromUnusedParameterKeyword.py
+++ /dev/null
@@ -1,3 +0,0 @@
-class A:
- def __init__(self, <weak_warning descr="Parameter 'foo' value is not used">f<caret>oo=True</weak_warning>):
- print('hello') \ No newline at end of file
diff --git a/python/testData/inspections/FieldFromUnusedParameterKeyword_after.py b/python/testData/inspections/FieldFromUnusedParameterKeyword_after.py
deleted file mode 100644
index 7e0d6627cc00..000000000000
--- a/python/testData/inspections/FieldFromUnusedParameterKeyword_after.py
+++ /dev/null
@@ -1,4 +0,0 @@
-class A:
- def __init__(self, foo=True):
- print('hello')
- self.foo = foo \ No newline at end of file
diff --git a/python/testData/inspections/FieldFromUnusedParameter_after.py b/python/testData/inspections/FieldFromUnusedParameter_after.py
deleted file mode 100644
index 7405ba3ec789..000000000000
--- a/python/testData/inspections/FieldFromUnusedParameter_after.py
+++ /dev/null
@@ -1,4 +0,0 @@
-class A:
- def __init__(self, foo):
- print('hello')
- self.foo = foo \ No newline at end of file
diff --git a/python/testData/inspections/PyArgumentListInspection/decoratorsPy3K.py b/python/testData/inspections/PyArgumentListInspection/decoratorsPy3K.py
new file mode 100644
index 000000000000..07e9942700b1
--- /dev/null
+++ b/python/testData/inspections/PyArgumentListInspection/decoratorsPy3K.py
@@ -0,0 +1,7 @@
+
+def deco(func, *args):
+ return func
+
+@deco # <= Here is a false positive.
+def myfunc(a, b):
+ print(a, b) \ No newline at end of file
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/contextManagerSubclass.py b/python/testData/inspections/PyUnresolvedReferencesInspection/contextManagerSubclass.py
new file mode 100644
index 000000000000..f7406dedbb6f
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/contextManagerSubclass.py
@@ -0,0 +1,12 @@
+class C(object):
+ def __enter__(self):
+ return self
+
+
+class D(C):
+ def foo(self):
+ pass
+
+
+with D() as cm:
+ cm.foo() # pass
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/ivarInDocstring.py b/python/testData/inspections/PyUnresolvedReferencesInspection/ivarInDocstring.py
new file mode 100644
index 000000000000..1fec85f8b63b
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/ivarInDocstring.py
@@ -0,0 +1,10 @@
+
+class SomeClass(object):
+ """ Awesome class
+
+ @ivar someVar: great stuff
+ @type someVar: string
+ """
+
+ def __init__(self):
+ self.someVar = None \ No newline at end of file
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/returnSelfInSuperClass.py b/python/testData/inspections/PyUnresolvedReferencesInspection/returnSelfInSuperClass.py
new file mode 100644
index 000000000000..79c56a020033
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/returnSelfInSuperClass.py
@@ -0,0 +1,13 @@
+class C(object):
+ def get_self(self):
+ return self
+
+
+class D(C):
+ def foo(self):
+ pass
+
+
+d = D()
+print(d.foo())
+print(d.get_self().foo()) # pass
diff --git a/python/testData/inspections/PyUnusedLocalVariableInspection/test.py b/python/testData/inspections/PyUnusedLocalVariableInspection/test.py
index 5edffda057d2..65913e27c745 100644
--- a/python/testData/inspections/PyUnusedLocalVariableInspection/test.py
+++ b/python/testData/inspections/PyUnusedLocalVariableInspection/test.py
@@ -303,3 +303,16 @@ def test_unused_condition_local_with_last_if_in_cycle(c):
x = False #pass
if c:
x = True
+
+
+# PY-7527
+def test_unused_empty_init_parameter():
+ class C(object):
+ def __init__(self, <weak_warning descr="Parameter 'foo' value is not used">foo</weak_warning>):
+ pass
+
+ def f(self, bar):
+ pass
+
+ return C
+
diff --git a/python/testData/inspections/ReplaceNotEqOperator.py b/python/testData/inspections/ReplaceNotEqOperator.py
index c0c6300b8e1f..790a765f19ca 100644
--- a/python/testData/inspections/ReplaceNotEqOperator.py
+++ b/python/testData/inspections/ReplaceNotEqOperator.py
@@ -1 +1 @@
-print(<warning descr="Python version 3.0, 3.1, 3.2, 3.3, 3.4 do not support <>, use != instead.">a <> b</warning>) \ No newline at end of file
+print(<warning descr="Python version 3.0, 3.1, 3.2, 3.3, 3.4 do not support <>, use != instead.">a<caret> <> b</warning>) \ No newline at end of file
diff --git a/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance_after.py b/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance_after.py
index 686290338cf5..7027a3993765 100644
--- a/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance_after.py
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance_after.py
@@ -1,8 +1,7 @@
class A:
def __init__(self):
- self.x = 1
self.y = None
-
+ self.x = 1
a = A()
a.y+1
diff --git a/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py b/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py
index 3ac2f7ecd201..c0ce40fe9e03 100644
--- a/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromMethod_after.py
@@ -1,7 +1,7 @@
class A:
def __init__(self):
- self.x = 1
self.y = None
+ self.x = 1
def foo(self):
a = self.y
diff --git a/python/testData/inspections/FieldFromUnusedParameter.py b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter.py
index a9b802bb0136..a9b802bb0136 100644
--- a/python/testData/inspections/FieldFromUnusedParameter.py
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter.py
diff --git a/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword.py b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword.py
new file mode 100644
index 000000000000..27f1600fe718
--- /dev/null
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword.py
@@ -0,0 +1,3 @@
+class A:
+ def __init__(self, fo<caret>o=True):
+ print('hello') \ No newline at end of file
diff --git a/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword_after.py b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword_after.py
new file mode 100644
index 000000000000..3f86fa418459
--- /dev/null
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameterKeyword_after.py
@@ -0,0 +1,4 @@
+class A:
+ def __init__(self, foo=True):
+ self.foo = foo
+ print('hello') \ No newline at end of file
diff --git a/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter_after.py b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter_after.py
new file mode 100644
index 000000000000..58785edcedea
--- /dev/null
+++ b/python/testData/quickFixes/AddFieldQuickFixTest/fromUnusedParameter_after.py
@@ -0,0 +1,4 @@
+class A:
+ def __init__(self, foo):
+ self.foo = foo
+ print('hello') \ No newline at end of file
diff --git a/python/testData/quickFixes/AddMethodQuickFixTest/addMethodFromMethod_after.py b/python/testData/quickFixes/AddMethodQuickFixTest/addMethodFromMethod_after.py
index 978acaf15275..5c47b58a48dc 100644
--- a/python/testData/quickFixes/AddMethodQuickFixTest/addMethodFromMethod_after.py
+++ b/python/testData/quickFixes/AddMethodQuickFixTest/addMethodFromMethod_after.py
@@ -8,6 +8,7 @@ class A:
def y(self, param, a):
pass
+
# Some comment
class B:
diff --git a/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/addPass_after.py b/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/addPass_after.py
index da65a030ea4d..040de7386118 100644
--- a/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/addPass_after.py
+++ b/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/addPass_after.py
@@ -3,8 +3,8 @@ __author__ = 'ktisha'
class A:
def __init__(self):
- self._a = 1
self.b = 1
+ self._a = 1
def foo(self):
pass
diff --git a/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/moveToInit_after.py b/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/moveToInit_after.py
index 2dc80743d949..9a83f676bfdc 100644
--- a/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/moveToInit_after.py
+++ b/python/testData/quickFixes/PyMoveAttributeToInitQuickFixTest/moveToInit_after.py
@@ -3,8 +3,8 @@ __author__ = 'ktisha'
class A:
def __init__(self):
- self._a = 1
self.b = 1
+ self._a = 1
def foo(self):
c = 1 \ No newline at end of file
diff --git a/python/testData/refactoring/introduceField/py4437.after.py b/python/testData/refactoring/introduceField/py4437.after.py
index e9c7d7535699..07a1331b604a 100644
--- a/python/testData/refactoring/introduceField/py4437.after.py
+++ b/python/testData/refactoring/introduceField/py4437.after.py
@@ -1,7 +1,7 @@
class SomeClass():
def __init__(self):
- self.x = 1
self.a = ''
+ self.x = 1
def foo(self):
self.a