summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-09-29 15:43:37 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-09-29 15:43:37 +0300
commitb2dd7c7e3e14eb92f96fbf72e47466555df07ab2 (patch)
treec64e7afcf37c98234aeef0578375811a746cca13
parent29a3b51b53c7f381ca5c451303366e6aa79720bc (diff)
downloadpylint-b2dd7c7e3e14eb92f96fbf72e47466555df07ab2.tar.gz
Port some old style tests to new style tests.
-rw-r--r--pylint/test/functional/bare_except.py6
-rw-r--r--pylint/test/functional/bare_except.txt1
-rw-r--r--pylint/test/functional/too_many_lines.py (renamed from pylint/test/input/func_w0302.py)5
-rw-r--r--pylint/test/functional/too_many_lines.txt1
-rw-r--r--pylint/test/functional/used_before_assignment_nonlocal.py (renamed from pylint/test/input/func_used_before_assignment_py30.py)11
-rw-r--r--pylint/test/functional/used_before_assignment_nonlocal.rc2
-rw-r--r--pylint/test/functional/used_before_assignment_nonlocal.txt6
-rw-r--r--pylint/test/functional/wildcard_import.py5
-rw-r--r--pylint/test/functional/wildcard_import.txt2
-rw-r--r--pylint/test/input/func_noerror_factory_method.py23
-rw-r--r--pylint/test/input/func_w0402.py12
-rw-r--r--pylint/test/input/func_w0702.py17
-rw-r--r--pylint/test/messages/func_used_before_assignment_py30.txt6
-rw-r--r--pylint/test/messages/func_w0302.txt2
-rw-r--r--pylint/test/messages/func_w0402.txt3
-rw-r--r--pylint/test/messages/func_w0702.txt2
16 files changed, 30 insertions, 74 deletions
diff --git a/pylint/test/functional/bare_except.py b/pylint/test/functional/bare_except.py
new file mode 100644
index 0000000..47a2079
--- /dev/null
+++ b/pylint/test/functional/bare_except.py
@@ -0,0 +1,6 @@
+# pylint: disable=missing-docstring, import-error
+
+try:
+ 1 + "2"
+except: # [bare-except]
+ pass
diff --git a/pylint/test/functional/bare_except.txt b/pylint/test/functional/bare_except.txt
new file mode 100644
index 0000000..ccb7ba9
--- /dev/null
+++ b/pylint/test/functional/bare_except.txt
@@ -0,0 +1 @@
+bare-except:5::No exception type(s) specified \ No newline at end of file
diff --git a/pylint/test/input/func_w0302.py b/pylint/test/functional/too_many_lines.py
index a78f479..78e568c 100644
--- a/pylint/test/input/func_w0302.py
+++ b/pylint/test/functional/too_many_lines.py
@@ -1,6 +1,5 @@
-"""test too much line in modules
-"""
-
+# pylint: disable=missing-docstring
+# -1: [too-many-lines]
__revision__ = 0
diff --git a/pylint/test/functional/too_many_lines.txt b/pylint/test/functional/too_many_lines.txt
new file mode 100644
index 0000000..0374f0c
--- /dev/null
+++ b/pylint/test/functional/too_many_lines.txt
@@ -0,0 +1 @@
+too-many-lines:1::Too many lines in module (1015/1000) \ No newline at end of file
diff --git a/pylint/test/input/func_used_before_assignment_py30.py b/pylint/test/functional/used_before_assignment_nonlocal.py
index ae979a1..ef6e152 100644
--- a/pylint/test/input/func_used_before_assignment_py30.py
+++ b/pylint/test/functional/used_before_assignment_nonlocal.py
@@ -15,7 +15,7 @@ def test_fail():
""" doesn't use nonlocal """
cnt = 1
def wrap():
- cnt = cnt + 1
+ cnt = cnt + 1 # [used-before-assignment]
wrap()
def test_fail2():
@@ -24,20 +24,20 @@ def test_fail2():
count = 1
def wrap():
nonlocal count
- cnt = cnt + 1
+ cnt = cnt + 1 # [used-before-assignment]
wrap()
-def test_fail3(arg: test_fail4):
+def test_fail3(arg: test_fail4): # [used-before-assignment]
""" Depends on `test_fail4`, in argument annotation. """
return arg
-
+# +1: [used-before-assignment, used-before-assignment]
def test_fail4(*args: test_fail5, **kwargs: undefined):
""" Depends on `test_fail5` and `undefined` in
variable and named arguments annotations.
"""
return args, kwargs
-def test_fail5()->undefined1:
+def test_fail5()->undefined1: # [used-before-assignment]
""" Depends on `undefined1` in function return annotation. """
def undefined():
@@ -45,4 +45,3 @@ def undefined():
def undefined1():
""" no op """
-
diff --git a/pylint/test/functional/used_before_assignment_nonlocal.rc b/pylint/test/functional/used_before_assignment_nonlocal.rc
new file mode 100644
index 0000000..c093be2
--- /dev/null
+++ b/pylint/test/functional/used_before_assignment_nonlocal.rc
@@ -0,0 +1,2 @@
+[testoptions]
+min_pyver=3.0
diff --git a/pylint/test/functional/used_before_assignment_nonlocal.txt b/pylint/test/functional/used_before_assignment_nonlocal.txt
new file mode 100644
index 0000000..36e635e
--- /dev/null
+++ b/pylint/test/functional/used_before_assignment_nonlocal.txt
@@ -0,0 +1,6 @@
+used-before-assignment:18:test_fail.wrap:Using variable 'cnt' before assignment
+used-before-assignment:27:test_fail2.wrap:Using variable 'cnt' before assignment
+used-before-assignment:30:test_fail3:Using variable 'test_fail4' before assignment
+used-before-assignment:34:test_fail4:Using variable 'test_fail5' before assignment
+used-before-assignment:34:test_fail4:Using variable 'undefined' before assignment
+used-before-assignment:40:test_fail5:Using variable 'undefined1' before assignment \ No newline at end of file
diff --git a/pylint/test/functional/wildcard_import.py b/pylint/test/functional/wildcard_import.py
new file mode 100644
index 0000000..4cccb6b
--- /dev/null
+++ b/pylint/test/functional/wildcard_import.py
@@ -0,0 +1,5 @@
+# pylint: disable=no-absolute-import,missing-docstring,import-error
+from indirect1 import * # [wildcard-import]
+# This is an unresolved import which still generates the wildcard-import
+# warning.
+from unknown.package import * # [wildcard-import]
diff --git a/pylint/test/functional/wildcard_import.txt b/pylint/test/functional/wildcard_import.txt
new file mode 100644
index 0000000..643d818
--- /dev/null
+++ b/pylint/test/functional/wildcard_import.txt
@@ -0,0 +1,2 @@
+wildcard-import:2::Wildcard import indirect1
+wildcard-import:5::Wildcard import unknown.package
diff --git a/pylint/test/input/func_noerror_factory_method.py b/pylint/test/input/func_noerror_factory_method.py
deleted file mode 100644
index 9574bd3..0000000
--- a/pylint/test/input/func_noerror_factory_method.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# pylint: disable=R0903
-"""use new astroid context sensitive inference"""
-
-
-class Super(object):
- """super class"""
- def __init__(self):
- self.bla = None
-
- def instance(cls):
- """factory method"""
- return cls()
- instance = classmethod(instance)
-
-class Sub(Super):
- """dub class"""
- def method(self):
- """specific method"""
- return 'method called', self
-
-# should see the Sub.instance() is returning a Sub instance, not a Super
-# instance
-Sub.instance().method()
diff --git a/pylint/test/input/func_w0402.py b/pylint/test/input/func_w0402.py
deleted file mode 100644
index fcf2fc1..0000000
--- a/pylint/test/input/func_w0402.py
+++ /dev/null
@@ -1,12 +0,0 @@
-"""test wildard import
-"""
-__revision__ = 0
-# pylint: disable=no-absolute-import
-from input.indirect1 import *
-# This is an unresolved import which still generates the wildcard-import
-# warning.
-from unknown.package import *
-
-def abcd():
- """use imports"""
- TotoInterface()
diff --git a/pylint/test/input/func_w0702.py b/pylint/test/input/func_w0702.py
deleted file mode 100644
index 800f4c1..0000000
--- a/pylint/test/input/func_w0702.py
+++ /dev/null
@@ -1,17 +0,0 @@
-"""check empty except statement
-"""
-from __future__ import print_function
-__revision__ = 0
-# pylint: disable=using-constant-test
-if __revision__:
- try:
- print(__revision__)
- except:
- print('error')
-
-try:
- __revision__ += 1
-except TypeError:
- print('error')
-except Exception:
- print('error')
diff --git a/pylint/test/messages/func_used_before_assignment_py30.txt b/pylint/test/messages/func_used_before_assignment_py30.txt
deleted file mode 100644
index 8bb131d..0000000
--- a/pylint/test/messages/func_used_before_assignment_py30.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-E: 18:test_fail.wrap: Using variable 'cnt' before assignment
-E: 27:test_fail2.wrap: Using variable 'cnt' before assignment
-E: 30:test_fail3: Using variable 'test_fail4' before assignment
-E: 34:test_fail4: Using variable 'test_fail5' before assignment
-E: 34:test_fail4: Using variable 'undefined' before assignment
-E: 40:test_fail5: Using variable 'undefined1' before assignment \ No newline at end of file
diff --git a/pylint/test/messages/func_w0302.txt b/pylint/test/messages/func_w0302.txt
deleted file mode 100644
index 26d509c..0000000
--- a/pylint/test/messages/func_w0302.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-C: 1: Too many lines in module (1016/1000)
-
diff --git a/pylint/test/messages/func_w0402.txt b/pylint/test/messages/func_w0402.txt
deleted file mode 100644
index 3bbcc5d..0000000
--- a/pylint/test/messages/func_w0402.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-E: 8: Unable to import 'unknown.package'
-W: 5: Wildcard import input.indirect1
-W: 8: Wildcard import unknown.package
diff --git a/pylint/test/messages/func_w0702.txt b/pylint/test/messages/func_w0702.txt
deleted file mode 100644
index d40a837..0000000
--- a/pylint/test/messages/func_w0702.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-W: 9: No exception type(s) specified
-W: 16: Catching too general exception Exception