summaryrefslogtreecommitdiff
path: root/tests/input/func_noerror_classes_meth_could_be_a_function.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/input/func_noerror_classes_meth_could_be_a_function.py')
-rw-r--r--tests/input/func_noerror_classes_meth_could_be_a_function.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/input/func_noerror_classes_meth_could_be_a_function.py b/tests/input/func_noerror_classes_meth_could_be_a_function.py
new file mode 100644
index 000000000..05a6c40d7
--- /dev/null
+++ b/tests/input/func_noerror_classes_meth_could_be_a_function.py
@@ -0,0 +1,33 @@
+# pylint: disable=C0111,R0903,W0232, useless-object-inheritance
+"""
+#2479
+
+R0201 (formely W0212), Method could be a function shouldn't be emitted in case
+like factory method pattern
+"""
+__revision__ = 1
+
+class XAsub(object):
+ pass
+class XBsub(XAsub):
+ pass
+class XCsub(XAsub):
+ pass
+
+class Aimpl(object):
+ # disable "method could be a function" on classes which are not overriding
+ # the factory method because in that case the usage of polymorphism is not
+ # detected
+ # pylint: disable=R0201
+ def makex(self):
+ return XAsub()
+
+class Bimpl(Aimpl):
+
+ def makex(self):
+ return XBsub()
+
+class Cimpl(Aimpl):
+
+ def makex(self):
+ return XCsub()