summaryrefslogtreecommitdiff
path: root/tests/functional/o
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-07 22:20:00 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-07 22:59:36 +0100
commitf84bf0220812a987595f719acad0be6e8cf0f982 (patch)
treea7c96e0322a8b38af55b34e57e33105528b61fb8 /tests/functional/o
parent48d366855759b612cc883409997ba161afe09095 (diff)
downloadpylint-git-f84bf0220812a987595f719acad0be6e8cf0f982.tar.gz
Migrate all func_noerror_* to new functional tests
Diffstat (limited to 'tests/functional/o')
-rw-r--r--tests/functional/o/object_as_class_attribute.py18
-rw-r--r--tests/functional/o/overloaded_operator.py21
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/functional/o/object_as_class_attribute.py b/tests/functional/o/object_as_class_attribute.py
new file mode 100644
index 000000000..71cd027b7
--- /dev/null
+++ b/tests/functional/o/object_as_class_attribute.py
@@ -0,0 +1,18 @@
+# pylint: disable=R0903, useless-object-inheritance
+"""Test case for the problem described below :
+ - A class extends 'object'
+ - This class defines its own __init__()
+ * pylint will therefore check that baseclasses' init()
+ are called
+ - If this class defines an 'object' attribute, then pylint
+ will use this new definition when trying to retrieve
+ object.__init__()
+"""
+
+__revision__ = None
+
+class Statement(object):
+ """ ... """
+ def __init__(self):
+ pass
+ object = None
diff --git a/tests/functional/o/overloaded_operator.py b/tests/functional/o/overloaded_operator.py
new file mode 100644
index 000000000..3a158b00b
--- /dev/null
+++ b/tests/functional/o/overloaded_operator.py
@@ -0,0 +1,21 @@
+# pylint: disable=C0111,R0903, useless-object-inheritance
+"""#3291"""
+from __future__ import print_function
+
+class Myarray(object):
+ def __init__(self, array):
+ self.array = array
+
+ def __mul__(self, val):
+ return Myarray(val)
+
+ def astype(self):
+ return "ASTYPE", self
+
+def randint(maximum):
+ if maximum is not None:
+ return Myarray([1, 2, 3]) * 2
+
+ return int(5)
+
+print(randint(1).astype()) # we don't wan't an error for astype access