summaryrefslogtreecommitdiff
path: root/test/input
diff options
context:
space:
mode:
Diffstat (limited to 'test/input')
-rw-r--r--test/input/func_bad_str_strip_call.py9
-rw-r--r--test/input/func_ctor_arguments.py7
-rw-r--r--test/input/func_name_checking.py135
-rw-r--r--test/input/func_namedtuple.py10
-rw-r--r--test/input/func_noerror_abstract_method.py20
-rw-r--r--test/input/func_noerror_abstract_method_py30.py19
-rw-r--r--test/input/func_raw_escapes.py19
-rw-r--r--test/input/func_unicode_literal.py7
-rw-r--r--test/input/func_w0404.py6
9 files changed, 8 insertions, 224 deletions
diff --git a/test/input/func_bad_str_strip_call.py b/test/input/func_bad_str_strip_call.py
deleted file mode 100644
index 2d94a6e..0000000
--- a/test/input/func_bad_str_strip_call.py
+++ /dev/null
@@ -1,9 +0,0 @@
-"""Suspicious str.strip calls."""
-__revision__ = 1
-
-''.strip('yo')
-''.strip()
-
-u''.strip('http://')
-u''.lstrip('http://')
-b''.rstrip('http://')
diff --git a/test/input/func_ctor_arguments.py b/test/input/func_ctor_arguments.py
index c708855..7bfc3a2 100644
--- a/test/input/func_ctor_arguments.py
+++ b/test/input/func_ctor_arguments.py
@@ -62,13 +62,16 @@ ClassNew(1, kwarg=1)
ClassNew(1, 2, 3)
ClassNew(one=2)
-import abc
+
+class Metaclass(type):
+ pass
+
def with_metaclass(meta, base=object):
"""Create a new type that can be used as a metaclass."""
return meta("NewBase", (base, ), {})
-class ClassWithMeta(with_metaclass(abc.ABCMeta)):
+class ClassWithMeta(with_metaclass(Metaclass)):
pass
ClassWithMeta()
diff --git a/test/input/func_name_checking.py b/test/input/func_name_checking.py
deleted file mode 100644
index d19d946..0000000
--- a/test/input/func_name_checking.py
+++ /dev/null
@@ -1,135 +0,0 @@
-# pylint: disable=R0903,R0201,R0921,W0603
-"""Test for the invalid-name (C0103) warning."""
-
-__revision__ = 1
-
-import collections
-
-def Run():
- """method without any good name"""
- class B(object):
- """nested class should not be tested has a variable"""
- def __init__(self):
- pass
- bBb = 1
- return A, bBb, B
-
-def run():
- """anothrer method without only good name"""
- class Aaa(object):
- """nested class should not be tested has a variable"""
- def __init__(self):
- pass
- bbb = 1
- return bbb, Aaa
-
-A = None
-
-def HOHOHOHO():
- """yo"""
- HIHIHI = 1
- print HIHIHI
-
-class xyz(object):
- """yo"""
-
- zz = 'Bad Class Attribute'
-
- def __init__(self):
- pass
-
- def Youplapoum(self):
- """bad method name"""
-
-
-class Derived(xyz):
- """Derived class."""
- zz = 'Not a bad class attribute'
-
-
-def no_nested_args(arg1, arg21, arg22):
- """a function which had nested arguments but no more"""
- print arg1, arg21, arg22
-
-
-GOOD_CONST_NAME = ''
-benpasceluila = 0
-
-class Correct(object):
- """yo"""
- def __init__(self):
- self.cava = 12
- self._Ca_va_Pas = None
-
- def BadMethodName(self):
- """Ignored."""
-
-V = [WHAT_Ever_inListComp for WHAT_Ever_inListComp in GOOD_CONST_NAME]
-
-def class_builder():
- """Function returning a class object."""
-
- class EmbeddedClass(object):
- """Useless class."""
-
- return EmbeddedClass
-
-BAD_NAME_FOR_CLASS = collections.namedtuple('Named', ['tuple'])
-NEXT_BAD_NAME_FOR_CLASS = class_builder()
-
-GoodName = collections.namedtuple('Named', ['tuple'])
-ToplevelClass = class_builder()
-
-AlsoCorrect = Correct
-NOT_CORRECT = Correct
-
-
-def test_globals():
- """Names in global statements are also checked."""
- global NOT_CORRECT
- global AlsoCorrect
- NOT_CORRECT = 1
- AlsoCorrect = 2
-
-
-class DerivedFromCorrect(Correct):
- """A derived class with an invalid inherited members.
-
- Derived attributes and methods with invalid names do not trigger warnings.
- """
-
- def __init__(self):
- super(DerivedFromCorrect, self).__init__()
- self._Ca_va_Pas = None
-
- def BadMethodName(self):
- """Ignored."""
-
-import abc
-
-class FooClass(object):
- """A test case for property names.
-
- Since by default, the regex for attributes is the same as the one
- for method names, we check the warning messages to contain the
- string 'attribute'.
- """
- @property
- def PROPERTY_NAME(self):
- """Ignored."""
- pass
-
- @abc.abstractproperty
- def ABSTRACT_PROPERTY_NAME(self):
- """Ignored."""
- pass
-
- @PROPERTY_NAME.setter
- def PROPERTY_NAME_SETTER(self):
- """Ignored."""
- pass
-
-
-def func_bad_argname(NOT_GOOD):
- """Function with a badly named argument."""
- return NOT_GOOD
diff --git a/test/input/func_namedtuple.py b/test/input/func_namedtuple.py
deleted file mode 100644
index 8cfd048..0000000
--- a/test/input/func_namedtuple.py
+++ /dev/null
@@ -1,10 +0,0 @@
-"""Test namedtuple attributes.
-
-Regression test for:
-https://bitbucket.org/logilab/pylint/issue/93/pylint-crashes-on-namedtuple-attribute
-"""
-__revision__ = None
-
-from collections import namedtuple
-Thing = namedtuple('Thing', ())
-print Thing.x
diff --git a/test/input/func_noerror_abstract_method.py b/test/input/func_noerror_abstract_method.py
deleted file mode 100644
index 18228c6..0000000
--- a/test/input/func_noerror_abstract_method.py
+++ /dev/null
@@ -1,20 +0,0 @@
-""" This should not warn about `prop` being abstract in Child """
-
-# pylint: disable=too-few-public-methods,abstract-class-little-used
-
-__revision__ = None
-
-import abc
-
-class Parent(object):
- """ Class """
- __metaclass__ = abc.ABCMeta
-
- @property
- @abc.abstractmethod
- def prop(self):
- """ Abstract """
-
-class Child(Parent):
- """ No warning for the following. """
- prop = property(lambda self: 1)
diff --git a/test/input/func_noerror_abstract_method_py30.py b/test/input/func_noerror_abstract_method_py30.py
deleted file mode 100644
index c237cb4..0000000
--- a/test/input/func_noerror_abstract_method_py30.py
+++ /dev/null
@@ -1,19 +0,0 @@
-""" This should not warn about `prop` being abstract in Child """
-
-# pylint: disable=too-few-public-methods,abstract-class-little-used,no-init,old-style-class
-
-__revision__ = None
-
-import abc
-
-class Parent(metaclass=abc.ABCMeta):
- """ Class """
-
- @property
- @abc.abstractmethod
- def prop(self):
- """ Abstract """
-
-class Child(Parent):
- """ No warning for the following. """
- prop = property(lambda self: 1)
diff --git a/test/input/func_raw_escapes.py b/test/input/func_raw_escapes.py
deleted file mode 100644
index b08b6f1..0000000
--- a/test/input/func_raw_escapes.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# pylint:disable=W0105, W0511, C0121
-"""Test for backslash escapes in byte vs unicode strings"""
-
-# Would be valid in Unicode, but probably not what you want otherwise
-BAD_UNICODE = b'\u0042'
-BAD_LONG_UNICODE = b'\U00000042'
-BAD_NAMED_UNICODE = b'\N{GREEK SMALL LETTER ALPHA}'
-
-GOOD_UNICODE = u'\u0042'
-GOOD_LONG_UNICODE = u'\U00000042'
-GOOD_NAMED_UNICODE = u'\N{GREEK SMALL LETTER ALPHA}'
-
-
-# Valid raw strings
-RAW_BACKSLASHES = r'raw'
-RAW_UNICODE = ur"\u0062\n"
-
-# In a comment you can have whatever you want: \ \\ \n \m
-# even things that look like bad strings: "C:\Program Files"
diff --git a/test/input/func_unicode_literal.py b/test/input/func_unicode_literal.py
deleted file mode 100644
index fa47902..0000000
--- a/test/input/func_unicode_literal.py
+++ /dev/null
@@ -1,7 +0,0 @@
-"""Unicode literals in Python 2.*"""
-from __future__ import unicode_literals
-
-__revision__ = 0
-
-BAD_STRING = b'\u1234'
-GOOD_STRING = '\u1234'
diff --git a/test/input/func_w0404.py b/test/input/func_w0404.py
index 0e2f727..f475a4d 100644
--- a/test/input/func_w0404.py
+++ b/test/input/func_w0404.py
@@ -7,8 +7,8 @@ import sys
import xml.etree.ElementTree
from xml.etree import ElementTree
-from multiprocessing import pool
-import multiprocessing.pool
+from email import encoders
+import email.encoders
import sys
@@ -24,4 +24,4 @@ def reimport():
del sys
-del sys, ElementTree, xml.etree.ElementTree, pool, multiprocessing.pool
+del sys, ElementTree, xml.etree.ElementTree, encoders, email.encoders