Snapshot idea/138.1696 from git://git.jetbrains.org/idea/community.git
Change-Id: I50c97b83a815ce635e49a38380ba5b8765e4b16a
diff --git a/python/testData/MockSdk2.7/python_stubs/__builtin__.py b/python/testData/MockSdk2.7/python_stubs/__builtin__.py
index ca174bb..5ef056b 100644
--- a/python/testData/MockSdk2.7/python_stubs/__builtin__.py
+++ b/python/testData/MockSdk2.7/python_stubs/__builtin__.py
@@ -652,6 +652,19 @@
self.__name__ = ''
+class __method(object):
+ '''A mock class representing method type.'''
+
+ def __init__(self):
+
+ self.im_class = None
+ self.im_self = None
+ self.im_func = None
+
+ self.__func__ = None
+ self.__self__ = None
+
+
class __namedtuple(tuple):
'''A mock base class for named tuples.'''
diff --git a/python/testData/MockSdk3.2/python_stubs/builtins.py b/python/testData/MockSdk3.2/python_stubs/builtins.py
index 88b74ab..58fcaac 100644
--- a/python/testData/MockSdk3.2/python_stubs/builtins.py
+++ b/python/testData/MockSdk3.2/python_stubs/builtins.py
@@ -613,14 +613,24 @@
self.__dict__ = ''
self.__module__ = ''
- self.__annotations__ = {}
self.__defaults__ = {}
self.__globals__ = {}
- self.__kwdefaults__ = {}
self.__closure__ = None
self.__code__ = None
self.__name__ = ''
+ self.__annotations__ = {}
+ self.__kwdefaults__ = {}
+
+
+class __method(object):
+ '''A mock class representing method type.'''
+
+ def __init__(self):
+
+ self.__func__ = None
+ self.__self__ = None
+
class __namedtuple(tuple):
'''A mock base class for named tuples.'''
diff --git a/python/testData/__init__.py b/python/testData/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/addImport/localFromImport.after.py b/python/testData/addImport/localFromImport.after.py
new file mode 100644
index 0000000..92920f7
--- /dev/null
+++ b/python/testData/addImport/localFromImport.after.py
@@ -0,0 +1,6 @@
+def func():
+ for _ range(10):
+ from package.module import foo
+
+ foo
+# <ref>
\ No newline at end of file
diff --git a/python/testData/addImport/localFromImport.py b/python/testData/addImport/localFromImport.py
new file mode 100644
index 0000000..e93e2d1
--- /dev/null
+++ b/python/testData/addImport/localFromImport.py
@@ -0,0 +1,4 @@
+def func():
+ for _ range(10):
+ foo
+# <ref>
\ No newline at end of file
diff --git a/python/testData/addImport/localImport.after.py b/python/testData/addImport/localImport.after.py
new file mode 100644
index 0000000..883e080
--- /dev/null
+++ b/python/testData/addImport/localImport.after.py
@@ -0,0 +1,8 @@
+def func():
+ try:
+ import module
+
+ module
+# <ref>
+ except:
+ pass
diff --git a/python/testData/addImport/localImport.py b/python/testData/addImport/localImport.py
new file mode 100644
index 0000000..9428584
--- /dev/null
+++ b/python/testData/addImport/localImport.py
@@ -0,0 +1,6 @@
+def func():
+ try:
+ module
+# <ref>
+ except:
+ pass
diff --git a/python/testData/addImport/localImportInlineBranch.after.py b/python/testData/addImport/localImportInlineBranch.after.py
new file mode 100644
index 0000000..c7f7d38
--- /dev/null
+++ b/python/testData/addImport/localImportInlineBranch.after.py
@@ -0,0 +1,6 @@
+def func():
+ if True:
+ import module
+
+ module
+# <ref>
\ No newline at end of file
diff --git a/python/testData/addImport/localImportInlineBranch.py b/python/testData/addImport/localImportInlineBranch.py
new file mode 100644
index 0000000..89d4935
--- /dev/null
+++ b/python/testData/addImport/localImportInlineBranch.py
@@ -0,0 +1,3 @@
+def func():
+ if True: module
+# <ref>
\ No newline at end of file
diff --git a/python/testData/addImport/localImportInlineFunctionBody.after.py b/python/testData/addImport/localImportInlineFunctionBody.after.py
new file mode 100644
index 0000000..13d2a1e
--- /dev/null
+++ b/python/testData/addImport/localImportInlineFunctionBody.after.py
@@ -0,0 +1,5 @@
+def func():
+ import module
+
+ module
+# <ref>
\ No newline at end of file
diff --git a/python/testData/addImport/localImportInlineFunctionBody.py b/python/testData/addImport/localImportInlineFunctionBody.py
new file mode 100644
index 0000000..b76c830
--- /dev/null
+++ b/python/testData/addImport/localImportInlineFunctionBody.py
@@ -0,0 +1,2 @@
+def func(): module
+# <ref>
\ No newline at end of file
diff --git a/python/testData/completion/boundMethodSpecialAttributes.py b/python/testData/completion/boundMethodSpecialAttributes.py
new file mode 100644
index 0000000..02afa56
--- /dev/null
+++ b/python/testData/completion/boundMethodSpecialAttributes.py
@@ -0,0 +1,5 @@
+class MyClass(object):
+ def method(self):
+ pass
+
+MyClass().method.__<caret>
\ No newline at end of file
diff --git a/python/testData/completion/lambdaSpecialAttributes.py b/python/testData/completion/lambdaSpecialAttributes.py
new file mode 100644
index 0000000..0b0465e
--- /dev/null
+++ b/python/testData/completion/lambdaSpecialAttributes.py
@@ -0,0 +1 @@
+(lambda: 42).__<caret>
\ No newline at end of file
diff --git a/python/testData/completion/reassignedMethodSpecialAttributes.py b/python/testData/completion/reassignedMethodSpecialAttributes.py
new file mode 100644
index 0000000..faf25e0
--- /dev/null
+++ b/python/testData/completion/reassignedMethodSpecialAttributes.py
@@ -0,0 +1,6 @@
+class MyClass(object):
+ def method(self):
+ pass
+
+m = MyClass().method
+m.__<caret>
\ No newline at end of file
diff --git a/python/testData/completion/staticMethodSpecialAttributes.py b/python/testData/completion/staticMethodSpecialAttributes.py
new file mode 100644
index 0000000..84b0e75
--- /dev/null
+++ b/python/testData/completion/staticMethodSpecialAttributes.py
@@ -0,0 +1,6 @@
+class MyClass(object):
+ @staticmethod
+ def method(self):
+ pass
+
+MyClass().method.__<caret>
\ No newline at end of file
diff --git a/python/testData/completion/unboundMethodSpecialAttributes.py b/python/testData/completion/unboundMethodSpecialAttributes.py
new file mode 100644
index 0000000..b7e9b52
--- /dev/null
+++ b/python/testData/completion/unboundMethodSpecialAttributes.py
@@ -0,0 +1,5 @@
+class MyClass(object):
+ def method(self):
+ pass
+
+MyClass.method.__<caret>
\ No newline at end of file
diff --git a/python/testData/completion/weakQualifierBoundMethodAttributes.py b/python/testData/completion/weakQualifierBoundMethodAttributes.py
new file mode 100644
index 0000000..2433cfb
--- /dev/null
+++ b/python/testData/completion/weakQualifierBoundMethodAttributes.py
@@ -0,0 +1,10 @@
+class MyClass(object):
+ def method(self):
+ pass
+
+if True:
+ inst = MyClass()
+else:
+ inst = unresolved
+
+inst.method.__<caret>
\ No newline at end of file
diff --git a/python/testData/debug/Adder-0.1.egg b/python/testData/debug/Adder-0.1.egg
new file mode 100644
index 0000000..eb98b6a
--- /dev/null
+++ b/python/testData/debug/Adder-0.1.egg
Binary files differ
diff --git a/python/testData/debug/Test_Resume.py b/python/testData/debug/Test_Resume.py
new file mode 100644
index 0000000..dcec51c
--- /dev/null
+++ b/python/testData/debug/Test_Resume.py
@@ -0,0 +1,8 @@
+def foo(x):
+ print(x)
+
+foo(1)
+foo(2)
+
+
+
diff --git a/python/testData/debug/__init__.py b/python/testData/debug/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/debug/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/debug/pycharm-debug.egg b/python/testData/debug/pycharm-debug.egg
new file mode 100644
index 0000000..5a17292
--- /dev/null
+++ b/python/testData/debug/pycharm-debug.egg
Binary files differ
diff --git a/python/testData/debug/test1.py b/python/testData/debug/test1.py
new file mode 100644
index 0000000..f654959
--- /dev/null
+++ b/python/testData/debug/test1.py
@@ -0,0 +1,5 @@
+i = 0
+while True:
+ print(i)
+ i = i + 1
+
diff --git a/python/testData/debug/test2.py b/python/testData/debug/test2.py
new file mode 100644
index 0000000..246363a
--- /dev/null
+++ b/python/testData/debug/test2.py
@@ -0,0 +1,8 @@
+def foo(x):
+ y = x + 2
+ print(y)
+
+z = 1
+foo(z)
+z += 1
+print(z)
diff --git a/python/testData/debug/test3.py b/python/testData/debug/test3.py
new file mode 100644
index 0000000..6122a53
--- /dev/null
+++ b/python/testData/debug/test3.py
@@ -0,0 +1,26 @@
+class A:
+ def __init__(self, z):
+ self.z = z
+
+ def foo(self, x):
+ y = 2 * x + self.z
+ return 1 + y
+
+
+def zoo(x):
+ y = int((x - 2) / (x - 1))
+
+ return A(y)
+
+print(zoo(2).foo(2))
+
+try:
+ try:
+ print(zoo(1).foo(2)) #we got ZeroDivision here
+ finally:
+ print(zoo(0).foo(2))
+except:
+ pass
+
+a = zoo(-1)
+print(a.foo(2))
\ No newline at end of file
diff --git a/python/testData/debug/test4.py b/python/testData/debug/test4.py
new file mode 100644
index 0000000..b8b7e91
--- /dev/null
+++ b/python/testData/debug/test4.py
@@ -0,0 +1,5 @@
+xval = 0
+xvalue1 = 1
+xvalue2 = 2
+print(xvalue1 + xvalue2)
+
diff --git a/python/testData/debug/test_continuation.py b/python/testData/debug/test_continuation.py
new file mode 100644
index 0000000..5957e3d
--- /dev/null
+++ b/python/testData/debug/test_continuation.py
@@ -0,0 +1,16 @@
+class Boo:
+ def bu(self, y):
+ return 1 + y
+
+
+class Foo:
+ def fu(self):
+ return Boo()
+
+x = 0
+print(x)
+x = Foo().fu()\
+.bu(x)
+print(x)
+x=2
+print(x)
\ No newline at end of file
diff --git a/python/testData/debug/test_continuation2.py b/python/testData/debug/test_continuation2.py
new file mode 100644
index 0000000..3b0246d
--- /dev/null
+++ b/python/testData/debug/test_continuation2.py
@@ -0,0 +1,8 @@
+x = 0
+print(x)
+x = 1+\
+2+\
+3
+print(x)
+x=2
+print(x)
\ No newline at end of file
diff --git a/python/testData/debug/test_egg.py b/python/testData/debug/test_egg.py
new file mode 100644
index 0000000..82bec29
--- /dev/null
+++ b/python/testData/debug/test_egg.py
@@ -0,0 +1,4 @@
+from adder import adder
+
+x = adder.add(7, 9)
+print(x)
\ No newline at end of file
diff --git a/python/testData/debug/test_exceptbreak.py b/python/testData/debug/test_exceptbreak.py
new file mode 100644
index 0000000..46b0ebc
--- /dev/null
+++ b/python/testData/debug/test_exceptbreak.py
@@ -0,0 +1,8 @@
+def foo(x):
+ return 1/x
+
+def zoo(x):
+ res = foo(x)
+ return res
+
+print(zoo(0))
diff --git a/python/testData/debug/test_input.py b/python/testData/debug/test_input.py
new file mode 100644
index 0000000..5ac9bac
--- /dev/null
+++ b/python/testData/debug/test_input.py
@@ -0,0 +1,7 @@
+while True:
+ promt = "print command > "
+ try:
+ string = raw_input(promt)
+ except :
+ string = input(promt)
+ print ("command was " + string)
\ No newline at end of file
diff --git a/python/testData/debug/test_multiprocess.py b/python/testData/debug/test_multiprocess.py
new file mode 100644
index 0000000..5fc6be4
--- /dev/null
+++ b/python/testData/debug/test_multiprocess.py
@@ -0,0 +1,13 @@
+from concurrent.futures import ProcessPoolExecutor
+def my_foo(arg_):
+ return arg_
+
+def main():
+ arg = ['Result:OK']
+ with ProcessPoolExecutor(1) as exec:
+ result = exec.map(my_foo, arg)
+ for i in result:
+ print(i)
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git a/python/testData/debug/test_multithread.py b/python/testData/debug/test_multithread.py
new file mode 100644
index 0000000..03c0811
--- /dev/null
+++ b/python/testData/debug/test_multithread.py
@@ -0,0 +1,24 @@
+try:
+ import thread
+except :
+ import _thread as thread
+
+import threading
+
+def bar(y):
+ z = 100 + y
+ print("Z=%d"%z)
+
+def foo(x):
+ y = x + 1
+ print("Y=%d"%y)
+
+ t = threading.Thread(target=bar, args=(y,))
+ t.start()
+
+
+id = thread.start_new_thread(foo, (1,))
+
+while True:
+ pass
+
diff --git a/python/testData/debug/test_remote.py b/python/testData/debug/test_remote.py
new file mode 100644
index 0000000..8bccbeb
--- /dev/null
+++ b/python/testData/debug/test_remote.py
@@ -0,0 +1,19 @@
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ sys.stderr.write("Not enough arguments")
+ sys.exit(1)
+
+ port = int(sys.argv[1])
+
+ x = 0
+
+ from pydev import pydevd
+ pydevd.settrace('localhost', port=port, stdoutToServer=True, stderrToServer=True)
+
+ x = 1
+ x = 2
+ x = 3
+
+ print("OK")
diff --git a/python/testData/debug/test_runtoline.py b/python/testData/debug/test_runtoline.py
new file mode 100644
index 0000000..804c56c
--- /dev/null
+++ b/python/testData/debug/test_runtoline.py
@@ -0,0 +1,8 @@
+x = 0
+print(x)
+while x<2:
+ x+=1
+ print(x)
+
+x+=10
+print("x = %d" % x)
\ No newline at end of file
diff --git a/python/testData/debug/test_stepOverCondition.py b/python/testData/debug/test_stepOverCondition.py
new file mode 100644
index 0000000..1b41c60
--- /dev/null
+++ b/python/testData/debug/test_stepOverCondition.py
@@ -0,0 +1,4 @@
+x = 1
+y = 2
+y = x + y
+print(y)
\ No newline at end of file
diff --git a/python/testData/debug/zipped_lib.zip b/python/testData/debug/zipped_lib.zip
new file mode 100644
index 0000000..fe2ac04
--- /dev/null
+++ b/python/testData/debug/zipped_lib.zip
Binary files differ
diff --git a/python/testData/dotNet/PythonLibs.dll b/python/testData/dotNet/PythonLibs.dll
new file mode 100644
index 0000000..cfdfa74
--- /dev/null
+++ b/python/testData/dotNet/PythonLibs.dll
Binary files differ
diff --git a/python/testData/dotNet/SingleNameSpace.dll b/python/testData/dotNet/SingleNameSpace.dll
new file mode 100644
index 0000000..da6dacb
--- /dev/null
+++ b/python/testData/dotNet/SingleNameSpace.dll
Binary files differ
diff --git a/python/testData/dotNet/__init__.py b/python/testData/dotNet/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/dotNet/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/dotNet/expected.skeleton.Deep.py b/python/testData/dotNet/expected.skeleton.Deep.py
new file mode 100644
index 0000000..52abbf6
--- /dev/null
+++ b/python/testData/dotNet/expected.skeleton.Deep.py
@@ -0,0 +1,17 @@
+# encoding: utf-8
+# module SingleNameSpace.Some.Deep calls itself Deep
+# from SingleNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+# by generator 1.135
+# no doc
+# no imports
+
+# no functions
+# classes
+
+from object import object
+
+class WeHaveClass(object):
+ """ WeHaveClass() """
+ MyClass = None
+
+
diff --git a/python/testData/dotNet/expected.skeleton.SingleNameSpace.py b/python/testData/dotNet/expected.skeleton.SingleNameSpace.py
new file mode 100644
index 0000000..b2048fd
--- /dev/null
+++ b/python/testData/dotNet/expected.skeleton.SingleNameSpace.py
@@ -0,0 +1,22 @@
+# encoding: utf-8
+# module SingleNameSpace
+# from SingleNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+# by generator 1.135
+# no doc
+# no imports
+
+# no functions
+# classes
+
+from object import object
+
+class AnotherClass(object):
+ """ AnotherClass() """
+
+from object import object
+
+class MyClass(object):
+ """ MyClass() """
+
+# variables with complex values
+
diff --git a/python/testData/dotNet/expected.skeleton.java.py b/python/testData/dotNet/expected.skeleton.java.py
new file mode 100644
index 0000000..1ba6b3a
--- /dev/null
+++ b/python/testData/dotNet/expected.skeleton.java.py
@@ -0,0 +1,24 @@
+# encoding: utf-8
+# module com.just.like.java calls itself java
+# from PythonLibs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+# by generator 1.135
+# no doc
+# no imports
+
+# no functions
+# classes
+
+from object import object
+
+class LikeJavaClass(object):
+ """ LikeJavaClass() """
+ def likeJavaInstanceMethod(self, i):
+ """ likeJavaInstanceMethod(self: LikeJavaClass, i: int) -> int """
+ pass
+
+ @staticmethod
+ def likeJavaStaticMethod(i):
+ """ likeJavaStaticMethod(i: int) """
+ pass
+
+
diff --git a/python/testData/dotNet/import_class_from_module.py b/python/testData/dotNet/import_class_from_module.py
new file mode 100644
index 0000000..bf36d0e
--- /dev/null
+++ b/python/testData/dotNet/import_class_from_module.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("PythonLibs")
+
+from c<caret>om.just.like.java import LikeJavaClass
+print LikeJavaClass
\ No newline at end of file
diff --git a/python/testData/dotNet/import_class_from_module_alias.py b/python/testData/dotNet/import_class_from_module_alias.py
new file mode 100644
index 0000000..92d82f8
--- /dev/null
+++ b/python/testData/dotNet/import_class_from_module_alias.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("PythonLibs")
+
+from c<caret>om.just.like.java import LikeJavaClass as MyClass
+print MyClass
\ No newline at end of file
diff --git a/python/testData/dotNet/import_module_from_package.py b/python/testData/dotNet/import_module_from_package.py
new file mode 100644
index 0000000..c31e92e
--- /dev/null
+++ b/python/testData/dotNet/import_module_from_package.py
@@ -0,0 +1,7 @@
+import clr
+
+clr.AddReferenceByPartialName("PythonLibs")
+
+
+from c<caret>om.just.like import java
+print java.LikeJavaClass
\ No newline at end of file
diff --git a/python/testData/dotNet/import_several_classes_from_module.py b/python/testData/dotNet/import_several_classes_from_module.py
new file mode 100644
index 0000000..08ab814
--- /dev/null
+++ b/python/testData/dotNet/import_several_classes_from_module.py
@@ -0,0 +1,7 @@
+import clr
+
+clr.AddReferenceByPartialName("PythonLibs")
+
+from c<caret>om.just.like.java import LikeJavaClass
+
+print LikeJavaClass
\ No newline at end of file
diff --git a/python/testData/dotNet/import_system.py b/python/testData/dotNet/import_system.py
new file mode 100644
index 0000000..dbfc1fe
--- /dev/null
+++ b/python/testData/dotNet/import_system.py
@@ -0,0 +1,2 @@
+from S<caret>ystem.Web import AspNetHostingPermission
+print AspNetHostingPermission
\ No newline at end of file
diff --git a/python/testData/dotNet/inner_class.py b/python/testData/dotNet/inner_class.py
new file mode 100644
index 0000000..9a22cf5
--- /dev/null
+++ b/python/testData/dotNet/inner_class.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("SingleNameSpace")
+
+from <caret>SingleNameSpace.Some.Deep.WeHaveClass import MyClass
+print MyClass
\ No newline at end of file
diff --git a/python/testData/dotNet/single_class.py b/python/testData/dotNet/single_class.py
new file mode 100644
index 0000000..679e947
--- /dev/null
+++ b/python/testData/dotNet/single_class.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("SingleNameSpace")
+
+from S<caret>ingleNameSpace import MyClass
+print MyClass
\ No newline at end of file
diff --git a/python/testData/dotNet/testSkeleton.py b/python/testData/dotNet/testSkeleton.py
new file mode 100644
index 0000000..c501ddf
--- /dev/null
+++ b/python/testData/dotNet/testSkeleton.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("PythonLibs")
+import <caret>com.just.like.java
+
+com.just.like.java.LikeJavaClass.likeJavaStaticMethod(1)
diff --git a/python/testData/dotNet/whole_namespace.py b/python/testData/dotNet/whole_namespace.py
new file mode 100644
index 0000000..b07fa0e
--- /dev/null
+++ b/python/testData/dotNet/whole_namespace.py
@@ -0,0 +1,6 @@
+import clr
+
+clr.AddReferenceByPartialName("SingleNameSpace")
+
+<caret>ingleNameSpace
+print SingleNameSpace.MyClass
\ No newline at end of file
diff --git a/python/testData/inspections/PyStringFormatInspection/expected.xml b/python/testData/inspections/PyStringFormatInspection/expected.xml
index 62301ce..25e7028 100644
--- a/python/testData/inspections/PyStringFormatInspection/expected.xml
+++ b/python/testData/inspections/PyStringFormatInspection/expected.xml
@@ -160,4 +160,20 @@
<line>99</line>
<description>Too few arguments for format string</description>
</problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>103</line>
+ <description>Unexpected type</description>
+ </problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>104</line>
+ <description>Too few arguments for format string</description>
+ </problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>105</line>
+ <description>Too many arguments for format string</description>
+ </problem>
+
</problems>
diff --git a/python/testData/inspections/PyStringFormatInspection/src/string-format.py b/python/testData/inspections/PyStringFormatInspection/src/string-format.py
index e60e4bb..972aaed 100644
--- a/python/testData/inspections/PyStringFormatInspection/src/string-format.py
+++ b/python/testData/inspections/PyStringFormatInspection/src/string-format.py
@@ -96,4 +96,26 @@
my_tuple = (1,2,3,4,5,6,7,8)
print '%d, %d' % my_tuple[:7:3]
print '%d, %d, %d' % my_tuple[:7:3]
-print '%d, %d, %d, %d' % my_tuple[:7:3]
\ No newline at end of file
+print '%d, %d, %d, %d' % my_tuple[:7:3]
+
+# PY-12801
+print '%d %s' % ((42,) + ('spam',))
+print '%d %s' % (('ham',) + ('spam',))
+print '%d %s' % ((42,) + ())
+print '%d' % ((42,) + ('spam',))
+
+# PY-11274
+import collections
+print '%(foo)s' % collections.OrderedDict(foo=None)
+
+class MyDict(collections.Mapping):
+ def __getitem__(self, key):
+ return 'spam'
+
+ def __iter__(self):
+ yield 'spam'
+
+ def __len__(self):
+ return 1
+
+print '%(foo)s' % MyDict()
diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection/methodSpecialAttributes.py b/python/testData/inspections/PyUnresolvedReferencesInspection/methodSpecialAttributes.py
new file mode 100644
index 0000000..7a60e53
--- /dev/null
+++ b/python/testData/inspections/PyUnresolvedReferencesInspection/methodSpecialAttributes.py
@@ -0,0 +1,25 @@
+class MyClass(object):
+ def method(self):
+ pass
+
+ @staticmethod
+ def static_method():
+ pass
+
+
+# Unbound method still treated as __method in Python 2
+MyClass.method.__func__
+MyClass.method.<warning descr="Cannot find reference '__defaults__' in 'function'">__defaults__</warning>
+
+# Bound method with qualifier
+inst = MyClass()
+inst.method.__func__
+inst.method.<warning descr="Cannot find reference '__defaults__' in 'function'">__defaults__</warning>
+
+# Reassigned bound method without qualifier
+m = inst.method
+
+# Static method
+# This reference should be marked as unresolved, but such warnings are suppressed for methods with decorators
+inst.static_method.__func__
+inst.static_method.__defaults__
diff --git a/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.after.py b/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.after.py
new file mode 100644
index 0000000..3f7191e
--- /dev/null
+++ b/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.after.py
@@ -0,0 +1,5 @@
+a = 1 + 2
+
+
+def func(x=a + 3):
+ pass
\ No newline at end of file
diff --git a/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.py b/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.py
new file mode 100644
index 0000000..507a2df
--- /dev/null
+++ b/python/testData/refactoring/introduceConstant/fromParameterDefaultValue.py
@@ -0,0 +1,2 @@
+def func(x=<selection>1 + 2</selection> + 3):
+ pass
\ No newline at end of file
diff --git a/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.after.py b/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.after.py
new file mode 100644
index 0000000..775927c
--- /dev/null
+++ b/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.after.py
@@ -0,0 +1,3 @@
+def foo():
+ a = 2 + 3
+ print 1 + a
\ No newline at end of file
diff --git a/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.py b/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.py
new file mode 100644
index 0000000..c5eee8c
--- /dev/null
+++ b/python/testData/refactoring/introduceVariable/selectionBreaksBinaryOperator.py
@@ -0,0 +1,2 @@
+def foo():
+ print 1 + <selection>2 + 3</selection>
\ No newline at end of file
diff --git a/python/testData/testRunner/__init__.py b/python/testData/testRunner/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/__init__.py b/python/testData/testRunner/env/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/doc/__init__.py b/python/testData/testRunner/env/doc/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/doc/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/doc/test1.py b/python/testData/testRunner/env/doc/test1.py
new file mode 100644
index 0000000..3fd0252
--- /dev/null
+++ b/python/testData/testRunner/env/doc/test1.py
@@ -0,0 +1,39 @@
+def factorial(n):
+ """Return the factorial of n, an exact integer >= 0.
+
+ If the result is small enough to fit in an int, return an int.
+ Else return a long.
+
+ >>> [factorial(n) for n in range(6)]
+ [1, 1, 2, 6, 24, 120]
+ """
+
+ import math
+ if not n >= 0:
+ raise ValueError("n must be >= 0")
+ if math.floor(n) != n:
+ raise ValueError("n must be exact integer")
+ if n+1 == n: # catch a value like 1e300
+ raise OverflowError("n too large")
+ result = 1
+ factor = 2
+ while factor <= n:
+ result *= factor
+ factor += 1
+ return result
+
+class FirstGoodTest:
+ """
+ >>> [factorial(n) for n in range(6)]
+ [1, 1, 2, 6, 24, 120]
+ """
+ def test_passes(self):
+ pass
+
+class SecondGoodTest:
+ def test_passes(self):
+ """
+ >>> [factorial(n) for n in range(6)]
+ [1, 1, 2, 6, 24, 120]
+ """
+ pass
\ No newline at end of file
diff --git a/python/testData/testRunner/env/doc/test2.py b/python/testData/testRunner/env/doc/test2.py
new file mode 100644
index 0000000..e0c4619
--- /dev/null
+++ b/python/testData/testRunner/env/doc/test2.py
@@ -0,0 +1,39 @@
+def factorial(n):
+ """Return the factorial of n, an exact integer >= 0.
+
+ If the result is small enough to fit in an int, return an int.
+ Else return a long.
+
+ >>> [factorial(n) for n in range(6)]
+ [1, 1, 2, 6, 24, 120]
+ """
+
+ import math
+ if not n >= 0:
+ raise ValueError("n must be >= 0")
+ if math.floor(n) != n:
+ raise ValueError("n must be exact integer")
+ if n+1 == n: # catch a value like 1e300
+ raise OverflowError("n too large")
+ result = 1
+ factor = 2
+ while factor <= n:
+ result *= factor
+ factor += 1
+ return result
+
+class FirstGoodTest:
+ """
+ >>> [factorial(n) for n in range(6)]
+ [1, 1]
+ """
+ def test_passes(self):
+ pass
+
+class SecondGoodTest:
+ def test_passes(self):
+ """
+ >>> [factorial(n) for n in range(6)]
+ [1, 1, 2, 6]
+ """
+ pass
\ No newline at end of file
diff --git a/python/testData/testRunner/env/nose/__init__.py b/python/testData/testRunner/env/nose/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/nose/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/nose/test1.py b/python/testData/testRunner/env/nose/test1.py
new file mode 100644
index 0000000..972270f
--- /dev/null
+++ b/python/testData/testRunner/env/nose/test1.py
@@ -0,0 +1,11 @@
+#from unittest import TestCase
+
+class TestNose:
+ def testOne(self):
+ assert 4 == 2*2
+
+ def testTwo(self):
+ assert True
+
+def testThree():
+ assert 4 == 2*2
diff --git a/python/testData/testRunner/env/nose/test2.py b/python/testData/testRunner/env/nose/test2.py
new file mode 100644
index 0000000..0a6f80e
--- /dev/null
+++ b/python/testData/testRunner/env/nose/test2.py
@@ -0,0 +1,18 @@
+#from unittest import TestCase
+
+class TestNose:
+ def testOne(self):
+ assert 5 == 2*2
+
+ def testTwo(self):
+ assert True
+
+def testThree():
+ assert 4 == 2*2
+
+def test_evens():
+ for i in range(0, 5):
+ yield check_even, i, i*3
+
+def check_even(n, nn):
+ assert n % 2 == 0 or nn % 2 == 0
\ No newline at end of file
diff --git a/python/testData/testRunner/env/pytest/__init__.py b/python/testData/testRunner/env/pytest/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/pytest/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/pytest/test1.py b/python/testData/testRunner/env/pytest/test1.py
new file mode 100644
index 0000000..6501634
--- /dev/null
+++ b/python/testData/testRunner/env/pytest/test1.py
@@ -0,0 +1,9 @@
+class TestPyTest:
+ def testOne(self):
+ assert 4 == 2*2
+
+ def testTwo(self):
+ assert True
+
+def testThree():
+ assert 4 == 2*2
diff --git a/python/testData/testRunner/env/pytest/test2.py b/python/testData/testRunner/env/pytest/test2.py
new file mode 100644
index 0000000..b6c7b08
--- /dev/null
+++ b/python/testData/testRunner/env/pytest/test2.py
@@ -0,0 +1,16 @@
+class TestPyTest:
+ def testOne(self):
+ assert 5 == 2*2
+
+ def testTwo(self):
+ assert True
+
+def testThree():
+ assert 4 == 2*2
+
+def test_evens():
+ for i in range(0, 5):
+ yield check_even, i, i*3
+
+def check_even(n, nn):
+ assert n % 2 == 0 or nn % 2 == 0
\ No newline at end of file
diff --git a/python/testData/testRunner/env/unit/__init__.py b/python/testData/testRunner/env/unit/__init__.py
new file mode 100644
index 0000000..7c7597a
--- /dev/null
+++ b/python/testData/testRunner/env/unit/__init__.py
@@ -0,0 +1 @@
+__author__ = 'ktisha'
diff --git a/python/testData/testRunner/env/unit/dependentTests/__init__.py b/python/testData/testRunner/env/unit/dependentTests/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/unit/dependentTests/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/unit/dependentTests/test_my_class.py b/python/testData/testRunner/env/unit/dependentTests/test_my_class.py
new file mode 100644
index 0000000..8c6a68e
--- /dev/null
+++ b/python/testData/testRunner/env/unit/dependentTests/test_my_class.py
@@ -0,0 +1,7 @@
+import unittest
+from testedCode.my_class import *
+
+class MyClassTest(unittest.TestCase):
+ def test_foo(self):
+ c = MyClass()
+ self.assertEquals("bar", c.foo())
diff --git a/python/testData/testRunner/env/unit/dependentTests/testedCode/__init__.py b/python/testData/testRunner/env/unit/dependentTests/testedCode/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/python/testData/testRunner/env/unit/dependentTests/testedCode/__init__.py
diff --git a/python/testData/testRunner/env/unit/dependentTests/testedCode/my_class.py b/python/testData/testRunner/env/unit/dependentTests/testedCode/my_class.py
new file mode 100644
index 0000000..fbf4632
--- /dev/null
+++ b/python/testData/testRunner/env/unit/dependentTests/testedCode/my_class.py
@@ -0,0 +1,4 @@
+class MyClass:
+ def foo(self):
+ return "bar"
+
\ No newline at end of file
diff --git a/python/testData/testRunner/env/unit/subfolder/__init__.py b/python/testData/testRunner/env/unit/subfolder/__init__.py
new file mode 100644
index 0000000..595e381
--- /dev/null
+++ b/python/testData/testRunner/env/unit/subfolder/__init__.py
@@ -0,0 +1 @@
+__author__ = 'traff'
diff --git a/python/testData/testRunner/env/unit/subfolder/test2.py b/python/testData/testRunner/env/unit/subfolder/test2.py
new file mode 100644
index 0000000..b2c21b2
--- /dev/null
+++ b/python/testData/testRunner/env/unit/subfolder/test2.py
@@ -0,0 +1,7 @@
+import unittest
+
+class SubTest(unittest.TestCase):
+ def test_in_subfolder(self):
+ self.assertEquals("foo", "fo" + "o")
+
+
\ No newline at end of file
diff --git a/python/testData/testRunner/env/unit/test1.py b/python/testData/testRunner/env/unit/test1.py
new file mode 100644
index 0000000..8b2daad
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test1.py
@@ -0,0 +1,8 @@
+from unittest import TestCase
+
+class UTests(TestCase):
+ def testOne(self):
+ self.assertEqual(4, 2*2)
+
+ def testTwo(self):
+ self.assertTrue(False or True)
diff --git a/python/testData/testRunner/env/unit/test2.py b/python/testData/testRunner/env/unit/test2.py
new file mode 100644
index 0000000..c819529
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test2.py
@@ -0,0 +1,11 @@
+from unittest import TestCase
+
+class UTests(TestCase):
+ def testOne(self):
+ self.assertEqual(5, 2*2)
+
+ def testTwo(self):
+ self.assertTrue(False)
+
+ def testThree(self):
+ self.assertTrue(True)
diff --git a/python/testData/testRunner/env/unit/test_file.py b/python/testData/testRunner/env/unit/test_file.py
new file mode 100644
index 0000000..9b2ed16
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test_file.py
@@ -0,0 +1,12 @@
+import unittest
+
+class GoodTest(unittest.TestCase):
+ def test_passes(self):
+ self.assertEqual(2+2, 4)
+
+class BadTest(unittest.TestCase):
+ def test_fails(self):
+ self.assertEqual(2+2, 5)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/python/testData/testRunner/env/unit/test_folder/__init__.py b/python/testData/testRunner/env/unit/test_folder/__init__.py
new file mode 100644
index 0000000..7c7597a
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test_folder/__init__.py
@@ -0,0 +1 @@
+__author__ = 'ktisha'
diff --git a/python/testData/testRunner/env/unit/test_folder/test1.py b/python/testData/testRunner/env/unit/test_folder/test1.py
new file mode 100644
index 0000000..8b2daad
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test_folder/test1.py
@@ -0,0 +1,8 @@
+from unittest import TestCase
+
+class UTests(TestCase):
+ def testOne(self):
+ self.assertEqual(4, 2*2)
+
+ def testTwo(self):
+ self.assertTrue(False or True)
diff --git a/python/testData/testRunner/env/unit/test_folder/test2.py b/python/testData/testRunner/env/unit/test_folder/test2.py
new file mode 100644
index 0000000..c819529
--- /dev/null
+++ b/python/testData/testRunner/env/unit/test_folder/test2.py
@@ -0,0 +1,11 @@
+from unittest import TestCase
+
+class UTests(TestCase):
+ def testOne(self):
+ self.assertEqual(5, 2*2)
+
+ def testTwo(self):
+ self.assertTrue(False)
+
+ def testThree(self):
+ self.assertTrue(True)