summaryrefslogtreecommitdiff
path: root/tests/testdata/python3/data/module2.py
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/data/module2.py
parent73babe3d536ffc4da94e59c705eb6a8c3e5822ef (diff)
downloadastroid-git-2f288598de485c6af25788fc917139b48c31c474.tar.gz
Moved tests out of package directory (#704)
Diffstat (limited to 'tests/testdata/python3/data/module2.py')
-rw-r--r--tests/testdata/python3/data/module2.py144
1 files changed, 144 insertions, 0 deletions
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
+
+