summaryrefslogtreecommitdiff
path: root/tests/testdata/python3
diff options
context:
space:
mode:
authorAshley Whetter <AWhetter@users.noreply.github.com>2019-10-15 01:49:26 -0700
committerClaudiu Popa <pcmanticore@gmail.com>2019-10-15 10:49:26 +0200
commit2f288598de485c6af25788fc917139b48c31c474 (patch)
tree3b52b2994c90018a2db2854adca0928c4bfe1162 /tests/testdata/python3
parent73babe3d536ffc4da94e59c705eb6a8c3e5822ef (diff)
downloadastroid-git-2f288598de485c6af25788fc917139b48c31c474.tar.gz
Moved tests out of package directory (#704)
Diffstat (limited to 'tests/testdata/python3')
-rw-r--r--tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.eggbin0 -> 1222 bytes
-rw-r--r--tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zipbin0 -> 1222 bytes
-rw-r--r--tests/testdata/python3/data/SSL1/Connection1.py5
-rw-r--r--tests/testdata/python3/data/SSL1/__init__.py1
-rw-r--r--tests/testdata/python3/data/__init__.py1
-rw-r--r--tests/testdata/python3/data/absimp/__init__.py5
-rw-r--r--tests/testdata/python3/data/absimp/sidepackage/__init__.py3
-rw-r--r--tests/testdata/python3/data/absimp/string.py3
-rw-r--r--tests/testdata/python3/data/absimport.py3
-rw-r--r--tests/testdata/python3/data/all.py9
-rw-r--r--tests/testdata/python3/data/appl/__init__.py3
-rw-r--r--tests/testdata/python3/data/appl/myConnection.py11
-rw-r--r--tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py1
-rw-r--r--tests/testdata/python3/data/descriptor_crash.py11
-rw-r--r--tests/testdata/python3/data/email.py1
-rw-r--r--tests/testdata/python3/data/find_test/__init__.py0
-rw-r--r--tests/testdata/python3/data/find_test/module.py0
-rw-r--r--tests/testdata/python3/data/find_test/module2.py0
-rw-r--r--tests/testdata/python3/data/find_test/noendingnewline.py0
-rw-r--r--tests/testdata/python3/data/find_test/nonregr.py0
-rw-r--r--tests/testdata/python3/data/foogle/fax/__init__.py0
-rw-r--r--tests/testdata/python3/data/foogle/fax/a.py1
-rw-r--r--tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth2
-rw-r--r--tests/testdata/python3/data/format.py34
-rw-r--r--tests/testdata/python3/data/invalid_encoding.py1
-rw-r--r--tests/testdata/python3/data/lmfp/__init__.py2
-rw-r--r--tests/testdata/python3/data/lmfp/foo.py6
-rw-r--r--tests/testdata/python3/data/module.py89
-rw-r--r--tests/testdata/python3/data/module1abs/__init__.py4
-rw-r--r--tests/testdata/python3/data/module1abs/core.py1
-rw-r--r--tests/testdata/python3/data/module2.py144
-rw-r--r--tests/testdata/python3/data/namespace_pep_420/module.py1
-rw-r--r--tests/testdata/python3/data/noendingnewline.py36
-rw-r--r--tests/testdata/python3/data/nonregr.py57
-rw-r--r--tests/testdata/python3/data/notall.py8
-rw-r--r--tests/testdata/python3/data/notamodule/file.py0
-rw-r--r--tests/testdata/python3/data/operator_precedence.py27
-rw-r--r--tests/testdata/python3/data/package/__init__.py4
-rw-r--r--tests/testdata/python3/data/package/absimport.py6
-rw-r--r--tests/testdata/python3/data/package/hello.py2
-rw-r--r--tests/testdata/python3/data/package/import_package_subpackage_module.py49
-rw-r--r--tests/testdata/python3/data/package/subpackage/__init__.py1
-rw-r--r--tests/testdata/python3/data/package/subpackage/module.py1
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py1
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_1/package/foo.py0
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py1
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_2/package/bar.py0
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py1
-rw-r--r--tests/testdata/python3/data/path_pkg_resources_3/package/baz.py0
-rw-r--r--tests/testdata/python3/data/path_pkgutil_1/package/__init__.py2
-rw-r--r--tests/testdata/python3/data/path_pkgutil_1/package/foo.py0
-rw-r--r--tests/testdata/python3/data/path_pkgutil_2/package/__init__.py2
-rw-r--r--tests/testdata/python3/data/path_pkgutil_2/package/bar.py0
-rw-r--r--tests/testdata/python3/data/path_pkgutil_3/package/__init__.py2
-rw-r--r--tests/testdata/python3/data/path_pkgutil_3/package/baz.py0
-rw-r--r--tests/testdata/python3/data/recursion.py3
-rw-r--r--tests/testdata/python3/data/tmp__init__.py0
-rw-r--r--tests/testdata/python3/data/unicode_package/__init__.py1
-rw-r--r--tests/testdata/python3/data/unicode_package/core/__init__.py0
59 files changed, 546 insertions, 0 deletions
diff --git a/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg b/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg
new file mode 100644
index 00000000..f62599c7
--- /dev/null
+++ b/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg
Binary files differ
diff --git a/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip b/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip
new file mode 100644
index 00000000..f62599c7
--- /dev/null
+++ b/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip
Binary files differ
diff --git a/tests/testdata/python3/data/SSL1/Connection1.py b/tests/testdata/python3/data/SSL1/Connection1.py
new file mode 100644
index 00000000..1307b239
--- /dev/null
+++ b/tests/testdata/python3/data/SSL1/Connection1.py
@@ -0,0 +1,5 @@
+
+class Connection:
+
+ def __init__(self, ctx, sock=None):
+ print('init Connection')
diff --git a/tests/testdata/python3/data/SSL1/__init__.py b/tests/testdata/python3/data/SSL1/__init__.py
new file mode 100644
index 00000000..c83ededc
--- /dev/null
+++ b/tests/testdata/python3/data/SSL1/__init__.py
@@ -0,0 +1 @@
+from .Connection1 import Connection
diff --git a/tests/testdata/python3/data/__init__.py b/tests/testdata/python3/data/__init__.py
new file mode 100644
index 00000000..332e2e72
--- /dev/null
+++ b/tests/testdata/python3/data/__init__.py
@@ -0,0 +1 @@
+__revision__="$Id: __init__.py,v 1.1 2005-06-13 20:55:20 syt Exp $"
diff --git a/tests/testdata/python3/data/absimp/__init__.py b/tests/testdata/python3/data/absimp/__init__.py
new file mode 100644
index 00000000..b98444df
--- /dev/null
+++ b/tests/testdata/python3/data/absimp/__init__.py
@@ -0,0 +1,5 @@
+"""a package with absolute import activated
+"""
+
+from __future__ import absolute_import
+
diff --git a/tests/testdata/python3/data/absimp/sidepackage/__init__.py b/tests/testdata/python3/data/absimp/sidepackage/__init__.py
new file mode 100644
index 00000000..239499a6
--- /dev/null
+++ b/tests/testdata/python3/data/absimp/sidepackage/__init__.py
@@ -0,0 +1,3 @@
+"""a side package with nothing in it
+"""
+
diff --git a/tests/testdata/python3/data/absimp/string.py b/tests/testdata/python3/data/absimp/string.py
new file mode 100644
index 00000000..e68e7496
--- /dev/null
+++ b/tests/testdata/python3/data/absimp/string.py
@@ -0,0 +1,3 @@
+from __future__ import absolute_import, print_function
+import string
+print(string)
diff --git a/tests/testdata/python3/data/absimport.py b/tests/testdata/python3/data/absimport.py
new file mode 100644
index 00000000..88f9d955
--- /dev/null
+++ b/tests/testdata/python3/data/absimport.py
@@ -0,0 +1,3 @@
+
+import email
+from email import message
diff --git a/tests/testdata/python3/data/all.py b/tests/testdata/python3/data/all.py
new file mode 100644
index 00000000..587765b5
--- /dev/null
+++ b/tests/testdata/python3/data/all.py
@@ -0,0 +1,9 @@
+
+name = 'a'
+_bla = 2
+other = 'o'
+class Aaa: pass
+
+def func(): print('yo')
+
+__all__ = 'Aaa', '_bla', 'name'
diff --git a/tests/testdata/python3/data/appl/__init__.py b/tests/testdata/python3/data/appl/__init__.py
new file mode 100644
index 00000000..d652ffd9
--- /dev/null
+++ b/tests/testdata/python3/data/appl/__init__.py
@@ -0,0 +1,3 @@
+"""
+Init
+"""
diff --git a/tests/testdata/python3/data/appl/myConnection.py b/tests/testdata/python3/data/appl/myConnection.py
new file mode 100644
index 00000000..49269534
--- /dev/null
+++ b/tests/testdata/python3/data/appl/myConnection.py
@@ -0,0 +1,11 @@
+from data import SSL1
+class MyConnection(SSL1.Connection):
+
+ """An SSL connection."""
+
+ def __init__(self, dummy):
+ print('MyConnection init')
+
+if __name__ == '__main__':
+ myConnection = MyConnection(' ')
+ input('Press Enter to continue...')
diff --git a/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py b/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py
new file mode 100644
index 00000000..6fbcff41
--- /dev/null
+++ b/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py
@@ -0,0 +1 @@
+var = 42 \ No newline at end of file
diff --git a/tests/testdata/python3/data/descriptor_crash.py b/tests/testdata/python3/data/descriptor_crash.py
new file mode 100644
index 00000000..11fbb4a2
--- /dev/null
+++ b/tests/testdata/python3/data/descriptor_crash.py
@@ -0,0 +1,11 @@
+
+import urllib
+
+class Page(object):
+ _urlOpen = staticmethod(urllib.urlopen)
+
+ def getPage(self, url):
+ handle = self._urlOpen(url)
+ data = handle.read()
+ handle.close()
+ return data
diff --git a/tests/testdata/python3/data/email.py b/tests/testdata/python3/data/email.py
new file mode 100644
index 00000000..dc593564
--- /dev/null
+++ b/tests/testdata/python3/data/email.py
@@ -0,0 +1 @@
+"""fake email module to test absolute import doesn't grab this one"""
diff --git a/tests/testdata/python3/data/find_test/__init__.py b/tests/testdata/python3/data/find_test/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/find_test/__init__.py
diff --git a/tests/testdata/python3/data/find_test/module.py b/tests/testdata/python3/data/find_test/module.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/find_test/module.py
diff --git a/tests/testdata/python3/data/find_test/module2.py b/tests/testdata/python3/data/find_test/module2.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/find_test/module2.py
diff --git a/tests/testdata/python3/data/find_test/noendingnewline.py b/tests/testdata/python3/data/find_test/noendingnewline.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/find_test/noendingnewline.py
diff --git a/tests/testdata/python3/data/find_test/nonregr.py b/tests/testdata/python3/data/find_test/nonregr.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/find_test/nonregr.py
diff --git a/tests/testdata/python3/data/foogle/fax/__init__.py b/tests/testdata/python3/data/foogle/fax/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/foogle/fax/__init__.py
diff --git a/tests/testdata/python3/data/foogle/fax/a.py b/tests/testdata/python3/data/foogle/fax/a.py
new file mode 100644
index 00000000..3d2b4b14
--- /dev/null
+++ b/tests/testdata/python3/data/foogle/fax/a.py
@@ -0,0 +1 @@
+x = 1 \ No newline at end of file
diff --git a/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth b/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth
new file mode 100644
index 00000000..eeb7ecac
--- /dev/null
+++ b/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth
@@ -0,0 +1,2 @@
+import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('foogle',));ie = os.path.exists(os.path.join(p,'__init__.py'));m = not ie and sys.modules.setdefault('foogle', types.ModuleType('foogle'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
+import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('foogle','crank'));ie = os.path.exists(os.path.join(p,'__init__.py'));m = not ie and sys.modules.setdefault('foogle.crank', types.ModuleType('foogle.crank'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
diff --git a/tests/testdata/python3/data/format.py b/tests/testdata/python3/data/format.py
new file mode 100644
index 00000000..73797061
--- /dev/null
+++ b/tests/testdata/python3/data/format.py
@@ -0,0 +1,34 @@
+"""A multiline string
+"""
+
+function('aeozrijz\
+earzer', hop)
+# XXX write test
+x = [i for i in range(5)
+ if i % 4]
+
+fonction(1,
+ 2,
+ 3,
+ 4)
+
+def definition(a,
+ b,
+ c):
+ return a + b + c
+
+class debile(dict,
+ object):
+ pass
+
+if aaaa: pass
+else:
+ aaaa,bbbb = 1,2
+ aaaa,bbbb = bbbb,aaaa
+# XXX write test
+hop = \
+ aaaa
+
+
+__revision__.lower();
+
diff --git a/tests/testdata/python3/data/invalid_encoding.py b/tests/testdata/python3/data/invalid_encoding.py
new file mode 100644
index 00000000..dddd208e
--- /dev/null
+++ b/tests/testdata/python3/data/invalid_encoding.py
@@ -0,0 +1 @@
+# -*- coding: lala -*- \ No newline at end of file
diff --git a/tests/testdata/python3/data/lmfp/__init__.py b/tests/testdata/python3/data/lmfp/__init__.py
new file mode 100644
index 00000000..74b26b82
--- /dev/null
+++ b/tests/testdata/python3/data/lmfp/__init__.py
@@ -0,0 +1,2 @@
+# force a "direct" python import
+from . import foo
diff --git a/tests/testdata/python3/data/lmfp/foo.py b/tests/testdata/python3/data/lmfp/foo.py
new file mode 100644
index 00000000..8f7de1e8
--- /dev/null
+++ b/tests/testdata/python3/data/lmfp/foo.py
@@ -0,0 +1,6 @@
+import sys
+if not getattr(sys, 'bar', None):
+ sys.just_once = []
+# there used to be two numbers here because
+# of a load_module_from_path bug
+sys.just_once.append(42)
diff --git a/tests/testdata/python3/data/module.py b/tests/testdata/python3/data/module.py
new file mode 100644
index 00000000..25913cbf
--- /dev/null
+++ b/tests/testdata/python3/data/module.py
@@ -0,0 +1,89 @@
+"""test module for astroid
+"""
+
+__revision__ = '$Id: module.py,v 1.2 2005-11-02 11:56:54 syt Exp $'
+from astroid.node_classes import Name as NameNode
+from astroid import modutils
+from astroid.utils import *
+import os.path
+MY_DICT = {}
+
+def global_access(key, val):
+ """function test"""
+ local = 1
+ MY_DICT[key] = val
+ for i in val:
+ if i:
+ del MY_DICT[i]
+ continue
+ else:
+ break
+ else:
+ return
+
+
+class YO:
+ """hehe
+ haha"""
+ a = 1
+
+ def __init__(self):
+ try:
+ self.yo = 1
+ except ValueError as ex:
+ pass
+ except (NameError, TypeError):
+ raise XXXError()
+ except:
+ raise
+
+
+
+class YOUPI(YO):
+ class_attr = None
+
+ def __init__(self):
+ self.member = None
+
+ def method(self):
+ """method
+ test"""
+ global MY_DICT
+ try:
+ MY_DICT = {}
+ local = None
+ autre = [a for (a, b) in MY_DICT if b]
+ if b in autre:
+ return
+ elif a in autre:
+ return 'hehe'
+ global_access(local, val=autre)
+ finally:
+ return local
+
+ def static_method():
+ """static method test"""
+ assert MY_DICT, '???'
+ static_method = staticmethod(static_method)
+
+ def class_method(cls):
+ """class method test"""
+ exec(a, b)
+ class_method = classmethod(class_method)
+
+
+def four_args(a, b, c, d):
+ """four arguments (was nested_args)"""
+ while 1:
+ if a:
+ break
+ a += +1
+ else:
+ b += -2
+ if c:
+ d = a and (b or c)
+ else:
+ c = a and b or d
+ list(map(lambda x, y: (y, x), a))
+redirect = four_args
+
diff --git a/tests/testdata/python3/data/module1abs/__init__.py b/tests/testdata/python3/data/module1abs/__init__.py
new file mode 100644
index 00000000..f9d5b686
--- /dev/null
+++ b/tests/testdata/python3/data/module1abs/__init__.py
@@ -0,0 +1,4 @@
+
+from . import core
+from .core import *
+print(sys.version)
diff --git a/tests/testdata/python3/data/module1abs/core.py b/tests/testdata/python3/data/module1abs/core.py
new file mode 100644
index 00000000..de101117
--- /dev/null
+++ b/tests/testdata/python3/data/module1abs/core.py
@@ -0,0 +1 @@
+import sys
diff --git a/tests/testdata/python3/data/module2.py b/tests/testdata/python3/data/module2.py
new file mode 100644
index 00000000..c4da10d2
--- /dev/null
+++ b/tests/testdata/python3/data/module2.py
@@ -0,0 +1,144 @@
+from __future__ import print_function
+from data.module import YO, YOUPI
+import data
+
+
+class Specialization(YOUPI, YO):
+ pass
+
+
+
+class Metaclass(type):
+ pass
+
+
+
+class Interface:
+ pass
+
+
+
+class MyIFace(Interface):
+ pass
+
+
+
+class AnotherIFace(Interface):
+ pass
+
+
+
+class MyException(Exception):
+ pass
+
+
+
+class MyError(MyException):
+ pass
+
+
+
+class AbstractClass(object):
+
+ def to_override(self, whatever):
+ raise NotImplementedError()
+
+ def return_something(self, param):
+ if param:
+ return 'toto'
+ return
+
+
+
+class Concrete0:
+ __implements__ = MyIFace
+
+
+
+class Concrete1:
+ __implements__ = (MyIFace, AnotherIFace)
+
+
+
+class Concrete2:
+ __implements__ = (MyIFace, AnotherIFace)
+
+
+
+class Concrete23(Concrete1):
+ pass
+
+del YO.member
+del YO
+[SYN1, SYN2] = (Concrete0, Concrete1)
+assert repr(1)
+b = (1 | 2) & (3 ^ 8)
+bb = 1 | (two | 6)
+ccc = one & two & three
+dddd = x ^ (o ^ r)
+exec('c = 3')
+exec('c = 3', {}, {})
+
+def raise_string(a=2, *args, **kwargs):
+ raise Exception('yo')
+ yield 'coucou'
+ yield
+a = b + 2
+c = b * 2
+c = b / 2
+c = b // 2
+c = b - 2
+c = b % 2
+c = b**2
+c = b << 2
+c = b >> 2
+c = ~b
+c = not b
+d = [c]
+e = d[:]
+e = d[a:b:c]
+raise_string(*args, **kwargs)
+print('bonjour', file=stream)
+print('salut', end=' ', file=stream)
+
+def make_class(any, base=data.module.YO, *args, **kwargs):
+ """check base is correctly resolved to Concrete0"""
+
+
+ class Aaaa(base):
+ """dynamic class"""
+
+
+ return Aaaa
+from os.path import abspath
+import os as myos
+
+
+class A:
+ pass
+
+
+
+class A(A):
+ pass
+
+
+def generator():
+ """A generator."""
+ yield
+
+def not_a_generator():
+ """A function that contains generator, but is not one."""
+
+ def generator():
+ yield
+ genl = lambda: (yield)
+
+def with_metaclass(meta, *bases):
+ return meta('NewBase', bases, {})
+
+
+class NotMetaclass(with_metaclass(Metaclass)):
+ pass
+
+
diff --git a/tests/testdata/python3/data/namespace_pep_420/module.py b/tests/testdata/python3/data/namespace_pep_420/module.py
new file mode 100644
index 00000000..a4d111e6
--- /dev/null
+++ b/tests/testdata/python3/data/namespace_pep_420/module.py
@@ -0,0 +1 @@
+from namespace_pep_420.submodule import var \ No newline at end of file
diff --git a/tests/testdata/python3/data/noendingnewline.py b/tests/testdata/python3/data/noendingnewline.py
new file mode 100644
index 00000000..e17b92cc
--- /dev/null
+++ b/tests/testdata/python3/data/noendingnewline.py
@@ -0,0 +1,36 @@
+import unittest
+
+
+class TestCase(unittest.TestCase):
+
+ def setUp(self):
+ unittest.TestCase.setUp(self)
+
+
+ def tearDown(self):
+ unittest.TestCase.tearDown(self)
+
+ def testIt(self):
+ self.a = 10
+ self.xxx()
+
+
+ def xxx(self):
+ if False:
+ pass
+ print('a')
+
+ if False:
+ pass
+ pass
+
+ if False:
+ pass
+ print('rara')
+
+
+if __name__ == '__main__':
+ print('test2')
+ unittest.main()
+
+
diff --git a/tests/testdata/python3/data/nonregr.py b/tests/testdata/python3/data/nonregr.py
new file mode 100644
index 00000000..78765c85
--- /dev/null
+++ b/tests/testdata/python3/data/nonregr.py
@@ -0,0 +1,57 @@
+
+
+try:
+ enumerate = enumerate
+except NameError:
+
+ def enumerate(iterable):
+ """emulates the python2.3 enumerate() function"""
+ i = 0
+ for val in iterable:
+ yield i, val
+ i += 1
+
+def toto(value):
+ for k, v in value:
+ print(v.get('yo'))
+
+
+import imp
+fp, mpath, desc = imp.find_module('optparse',a)
+s_opt = imp.load_module('std_optparse', fp, mpath, desc)
+
+class OptionParser(s_opt.OptionParser):
+
+ def parse_args(self, args=None, values=None, real_optparse=False):
+ if real_optparse:
+ pass
+## return super(OptionParser, self).parse_args()
+ else:
+ import optcomp
+ optcomp.completion(self)
+
+
+class Aaa(object):
+ """docstring"""
+ def __init__(self):
+ self.__setattr__('a','b')
+ pass
+
+ def one_public(self):
+ """docstring"""
+ pass
+
+ def another_public(self):
+ """docstring"""
+ pass
+
+class Ccc(Aaa):
+ """docstring"""
+
+ class Ddd(Aaa):
+ """docstring"""
+ pass
+
+ class Eee(Ddd):
+ """docstring"""
+ pass
diff --git a/tests/testdata/python3/data/notall.py b/tests/testdata/python3/data/notall.py
new file mode 100644
index 00000000..9d35aa3a
--- /dev/null
+++ b/tests/testdata/python3/data/notall.py
@@ -0,0 +1,8 @@
+
+name = 'a'
+_bla = 2
+other = 'o'
+class Aaa: pass
+
+def func(): print('yo')
+
diff --git a/tests/testdata/python3/data/notamodule/file.py b/tests/testdata/python3/data/notamodule/file.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/notamodule/file.py
diff --git a/tests/testdata/python3/data/operator_precedence.py b/tests/testdata/python3/data/operator_precedence.py
new file mode 100644
index 00000000..b4333375
--- /dev/null
+++ b/tests/testdata/python3/data/operator_precedence.py
@@ -0,0 +1,27 @@
+assert not not True == True
+assert (not False or True) == True
+assert True or False and True
+assert (True or False) and True
+
+assert True is not (False is True) == False
+assert True is (not False is True == False)
+
+assert 1 + 2 + 3 == 6
+assert 5 - 4 + 3 == 4
+assert 4 - 5 - 6 == -7
+assert 7 - (8 - 9) == 8
+assert 2**3**4 == 2**81
+assert (2**3)**4 == 8**4
+
+assert 1 + 2 if (0.5 if True else 0.2) else 1 if True else 2 == 3
+assert (0 if True else 1) if False else 2 == 2
+assert lambda x: x if (0 if False else 0) else 0 if False else 0
+assert (lambda x: x) if (0 if True else 0.2) else 1 if True else 2
+
+assert ('1' + '2').replace('1', '3') == '32'
+assert (lambda x: x)(1) == 1
+assert ([0] + [1])[1] == 1
+assert (lambda x: lambda: x + 1)(2)() == 3
+
+f = lambda x, y, z: y(x, z)
+assert f(1, lambda x, y: x + y[1], (2, 3)) == 4
diff --git a/tests/testdata/python3/data/package/__init__.py b/tests/testdata/python3/data/package/__init__.py
new file mode 100644
index 00000000..575d18b1
--- /dev/null
+++ b/tests/testdata/python3/data/package/__init__.py
@@ -0,0 +1,4 @@
+"""package's __init__ file"""
+
+
+from . import subpackage
diff --git a/tests/testdata/python3/data/package/absimport.py b/tests/testdata/python3/data/package/absimport.py
new file mode 100644
index 00000000..33ed117c
--- /dev/null
+++ b/tests/testdata/python3/data/package/absimport.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import, print_function
+import import_package_subpackage_module # fail
+print(import_package_subpackage_module)
+
+from . import hello as hola
+
diff --git a/tests/testdata/python3/data/package/hello.py b/tests/testdata/python3/data/package/hello.py
new file mode 100644
index 00000000..b154c844
--- /dev/null
+++ b/tests/testdata/python3/data/package/hello.py
@@ -0,0 +1,2 @@
+"""hello module"""
+
diff --git a/tests/testdata/python3/data/package/import_package_subpackage_module.py b/tests/testdata/python3/data/package/import_package_subpackage_module.py
new file mode 100644
index 00000000..ad442c16
--- /dev/null
+++ b/tests/testdata/python3/data/package/import_package_subpackage_module.py
@@ -0,0 +1,49 @@
+# pylint: disable-msg=I0011,C0301,W0611
+"""I found some of my scripts trigger off an AttributeError in pylint
+0.8.1 (with common 0.12.0 and astroid 0.13.1).
+
+Traceback (most recent call last):
+ File "/usr/bin/pylint", line 4, in ?
+ lint.Run(sys.argv[1:])
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 729, in __init__
+ linter.check(args)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 412, in check
+ self.check_file(filepath, modname, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 426, in check_file
+ astroid = self._check_file(filepath, modname, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 450, in _check_file
+ self.check_astroid_module(astroid, checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 494, in check_astroid_module
+ self.astroid_events(astroid, [checker for checker in checkers
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
+ self.astroid_events(child, checkers, _reversed_checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astroid_events
+ self.astroid_events(child, checkers, _reversed_checkers)
+ File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 508, in astroid_events
+ checker.visit(astroid)
+ File "/usr/lib/python2.4/site-packages/logilab/astroid/utils.py", line 84, in visit
+ method(node)
+ File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 295, in visit_import
+ self._check_module_attrs(node, module, name_parts[1:])
+ File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 357, in _check_module_attrs
+ self.add_message('E0611', args=(name, module.name),
+AttributeError: Import instance has no attribute 'name'
+
+
+You can reproduce it by:
+(1) create package structure like the following:
+
+package/
+ __init__.py
+ subpackage/
+ __init__.py
+ module.py
+
+(2) in package/__init__.py write:
+
+import subpackage
+
+(3) run pylint with a script importing package.subpackage.module.
+"""
+__revision__ = '$Id: import_package_subpackage_module.py,v 1.1 2005-11-10 15:59:32 syt Exp $'
+import package.subpackage.module
diff --git a/tests/testdata/python3/data/package/subpackage/__init__.py b/tests/testdata/python3/data/package/subpackage/__init__.py
new file mode 100644
index 00000000..dc4782e6
--- /dev/null
+++ b/tests/testdata/python3/data/package/subpackage/__init__.py
@@ -0,0 +1 @@
+"""package.subpackage"""
diff --git a/tests/testdata/python3/data/package/subpackage/module.py b/tests/testdata/python3/data/package/subpackage/module.py
new file mode 100644
index 00000000..4b7244ba
--- /dev/null
+++ b/tests/testdata/python3/data/package/subpackage/module.py
@@ -0,0 +1 @@
+"""package.subpackage.module"""
diff --git a/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py b/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py
new file mode 100644
index 00000000..b0d64337
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py b/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py
diff --git a/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py b/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py
new file mode 100644
index 00000000..b0d64337
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py b/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py
diff --git a/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py b/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py
new file mode 100644
index 00000000..b0d64337
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py b/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py
diff --git a/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py b/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py
new file mode 100644
index 00000000..0bfb5a62
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py
@@ -0,0 +1,2 @@
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkgutil_1/package/foo.py b/tests/testdata/python3/data/path_pkgutil_1/package/foo.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_1/package/foo.py
diff --git a/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py b/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py
new file mode 100644
index 00000000..0bfb5a62
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py
@@ -0,0 +1,2 @@
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkgutil_2/package/bar.py b/tests/testdata/python3/data/path_pkgutil_2/package/bar.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_2/package/bar.py
diff --git a/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py b/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py
new file mode 100644
index 00000000..0bfb5a62
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py
@@ -0,0 +1,2 @@
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__) \ No newline at end of file
diff --git a/tests/testdata/python3/data/path_pkgutil_3/package/baz.py b/tests/testdata/python3/data/path_pkgutil_3/package/baz.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/path_pkgutil_3/package/baz.py
diff --git a/tests/testdata/python3/data/recursion.py b/tests/testdata/python3/data/recursion.py
new file mode 100644
index 00000000..a34dad32
--- /dev/null
+++ b/tests/testdata/python3/data/recursion.py
@@ -0,0 +1,3 @@
+""" For issue #25 """
+class Base(object):
+ pass \ No newline at end of file
diff --git a/tests/testdata/python3/data/tmp__init__.py b/tests/testdata/python3/data/tmp__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/tmp__init__.py
diff --git a/tests/testdata/python3/data/unicode_package/__init__.py b/tests/testdata/python3/data/unicode_package/__init__.py
new file mode 100644
index 00000000..713e5591
--- /dev/null
+++ b/tests/testdata/python3/data/unicode_package/__init__.py
@@ -0,0 +1 @@
+x = "șțîâ" \ No newline at end of file
diff --git a/tests/testdata/python3/data/unicode_package/core/__init__.py b/tests/testdata/python3/data/unicode_package/core/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/testdata/python3/data/unicode_package/core/__init__.py