diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-09-30 14:44:40 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-09-30 14:44:40 +0300 |
commit | fd17d09f94aa286139723de9f86b5d04e7acf858 (patch) | |
tree | 72cf2e189ad6e7ecb1dc3a9642fa4b5201b5796c /pylint | |
parent | 8f583e56df75466907b1c360d24d606876325e3b (diff) | |
download | pylint-fd17d09f94aa286139723de9f86b5d04e7acf858.tar.gz |
Port more tests to the new test format.
Diffstat (limited to 'pylint')
21 files changed, 35 insertions, 86 deletions
diff --git a/pylint/test/input/func_assert_2uple.py b/pylint/test/functional/assert_on_tuple.py index de93d3b..357e181 100644 --- a/pylint/test/input/func_assert_2uple.py +++ b/pylint/test/functional/assert_on_tuple.py @@ -1,11 +1,10 @@ '''Assert check example''' -__revision__ = 0 assert (1 == 1, 2 == 2), "no error" -assert (1 == 1, 2 == 2) #this should generate a warning +assert (1 == 1, 2 == 2) # [assert-on-tuple] assert 1 == 1, "no error" assert (1 == 1, ), "no error" assert (1 == 1, ) assert (1 == 1, 2 == 2, 3 == 5), "no error" assert () -assert (True, 'error msg') #this should generate a warning +assert (True, 'error msg') # [assert-on-tuple] diff --git a/pylint/test/functional/assert_on_tuple.txt b/pylint/test/functional/assert_on_tuple.txt new file mode 100644 index 0000000..b1de73c --- /dev/null +++ b/pylint/test/functional/assert_on_tuple.txt @@ -0,0 +1,2 @@ +assert-on-tuple:4::Assert called on a 2-uple. Did you mean 'assert x,y'? +assert-on-tuple:10::Assert called on a 2-uple. Did you mean 'assert x,y'? diff --git a/pylint/test/input/func_deprecated_lambda_py_30.py b/pylint/test/functional/deprecated_lambda.py index 74b3241..6a785a6 100644 --- a/pylint/test/input/func_deprecated_lambda_py_30.py +++ b/pylint/test/functional/deprecated_lambda.py @@ -1,12 +1,11 @@ # pylint: disable=missing-docstring,bad-builtin,invalid-name,no-absolute-import -__revision__ = "$Id$" import functools # Don't do this, use a comprehension instead. -assert map(lambda x: x*2, [1, 2, 3]) == [2, 4, 6] +assert map(lambda x: x*2, [1, 2, 3]) == [2, 4, 6] # [deprecated-lambda] -assert filter(lambda x: x != 1, [1, 2, 3]) == [2, 3] +assert filter(lambda x: x != 1, [1, 2, 3]) == [2, 3] # [deprecated-lambda] # It's still ok to use map and filter with anything but an inline lambda. double = lambda x: x * 2 diff --git a/pylint/test/functional/deprecated_lambda.rc b/pylint/test/functional/deprecated_lambda.rc new file mode 100644 index 0000000..a650233 --- /dev/null +++ b/pylint/test/functional/deprecated_lambda.rc @@ -0,0 +1,2 @@ +[testoptions] +max_pyver=3.0 diff --git a/pylint/test/functional/deprecated_lambda.txt b/pylint/test/functional/deprecated_lambda.txt new file mode 100644 index 0000000..78cd9fb --- /dev/null +++ b/pylint/test/functional/deprecated_lambda.txt @@ -0,0 +1,2 @@ +deprecated-lambda:6::map/filter on lambda could be replaced by comprehension +deprecated-lambda:8::map/filter on lambda could be replaced by comprehension diff --git a/pylint/test/input/func_e0108.py b/pylint/test/functional/duplicate_argument_name.py index 2ed2ce1..2b939ed 100644 --- a/pylint/test/input/func_e0108.py +++ b/pylint/test/functional/duplicate_argument_name.py @@ -1,14 +1,11 @@ """Check for duplicate function arguments.""" -__revision__ = 1 -def foo1(_, _): + +def foo1(_, _): # [duplicate-argument-name] """Function with duplicate argument name.""" - pass -def foo2(_, *_): +def foo2(_, *_): # [duplicate-argument-name] """Function with duplicate argument name.""" - pass -def foo3(_, _=3): +def foo3(_, _=3): # [duplicate-argument-name] """Function with duplicate argument name.""" - pass diff --git a/pylint/test/functional/duplicate_argument_name.txt b/pylint/test/functional/duplicate_argument_name.txt new file mode 100644 index 0000000..c51e4df --- /dev/null +++ b/pylint/test/functional/duplicate_argument_name.txt @@ -0,0 +1,3 @@ +duplicate-argument-name:4:foo1:Duplicate argument name _ in function definition +duplicate-argument-name:7:foo2:Duplicate argument name _ in function definition +duplicate-argument-name:10:foo3:Duplicate argument name _ in function definition diff --git a/pylint/test/functional/init_is_generator.py b/pylint/test/functional/init_is_generator.py new file mode 100644 index 0000000..882200c --- /dev/null +++ b/pylint/test/functional/init_is_generator.py @@ -0,0 +1,5 @@ +# pylint: disable=missing-docstring,too-few-public-methods + +class SomeClass(object): + def __init__(self): # [init-is-generator] + yield None diff --git a/pylint/test/functional/init_is_generator.txt b/pylint/test/functional/init_is_generator.txt new file mode 100644 index 0000000..5d2132a --- /dev/null +++ b/pylint/test/functional/init_is_generator.txt @@ -0,0 +1 @@ +init-is-generator:4:SomeClass.__init__:__init__ method is a generator diff --git a/pylint/test/input/func_e0101.py b/pylint/test/functional/return_in_init.py index 2bf5a28..35976d2 100644 --- a/pylint/test/input/func_e0101.py +++ b/pylint/test/functional/return_in_init.py @@ -1,13 +1,8 @@ -# pylint: disable=R0903 -"""test __init__ return -""" - -__revision__ = 'yo' +# pylint: disable=missing-docstring,too-few-public-methods class MyClass(object): - """dummy class""" - def __init__(self): + def __init__(self): # [return-in-init] return 1 class MyClass2(object): @@ -16,18 +11,13 @@ class MyClass2(object): def __init__(self): return + class MyClass3(object): """dummy class""" def __init__(self): return None -class MyClass4(object): - """dummy class""" - - def __init__(self): - yield None - class MyClass5(object): """dummy class""" diff --git a/pylint/test/functional/return_in_init.txt b/pylint/test/functional/return_in_init.txt new file mode 100644 index 0000000..5e708d0 --- /dev/null +++ b/pylint/test/functional/return_in_init.txt @@ -0,0 +1 @@ +return-in-init:5:MyClass.__init__:Explicit return in __init__
\ No newline at end of file diff --git a/pylint/test/functional/unnecessary_pass.py b/pylint/test/functional/unnecessary_pass.py new file mode 100644 index 0000000..5bf7e8b --- /dev/null +++ b/pylint/test/functional/unnecessary_pass.py @@ -0,0 +1,7 @@ +# pylint: disable=missing-docstring + +try: + A = 2 +except ValueError: + A = 24 + pass # [unnecessary-pass] diff --git a/pylint/test/functional/unnecessary_pass.txt b/pylint/test/functional/unnecessary_pass.txt new file mode 100644 index 0000000..e3a7448 --- /dev/null +++ b/pylint/test/functional/unnecessary_pass.txt @@ -0,0 +1 @@ +unnecessary-pass:7::Unnecessary pass statement diff --git a/pylint/test/input/func_base_useless_pass.py b/pylint/test/input/func_base_useless_pass.py deleted file mode 100644 index 145e82f..0000000 --- a/pylint/test/input/func_base_useless_pass.py +++ /dev/null @@ -1,9 +0,0 @@ -"""W0107: unnecessary pass statement -""" -from __future__ import print_function - -try: - A = 2 -except ValueError: - print(A) - pass diff --git a/pylint/test/input/func_noerror_crash_122793.py b/pylint/test/input/func_noerror_crash_122793.py deleted file mode 100644 index 71c138a..0000000 --- a/pylint/test/input/func_noerror_crash_122793.py +++ /dev/null @@ -1,8 +0,0 @@ -"""https://www.logilab.org/ticket/122793""" - -def gen(): - """dumb generator""" - yield - -GEN = gen() -next(GEN) diff --git a/pylint/test/input/func_noerror_staticmethod_as_decorator_py24.py b/pylint/test/input/func_noerror_staticmethod_as_decorator_py24.py deleted file mode 100644 index 8b614a2..0000000 --- a/pylint/test/input/func_noerror_staticmethod_as_decorator_py24.py +++ /dev/null @@ -1,33 +0,0 @@ -# pylint: disable=R0903 -"""test staticmethod and classmethod as decorator""" - -__revision__ = None - -class StaticMethod1(object): - """staticmethod test""" - def __init__(self): - pass - - @staticmethod - def do_work(): - "Working..." - - @staticmethod - def do_work_with_arg(job): - "Working on something" - return "Working on %s..." % job - - -class ClassMethod2(object): - """classmethod test""" - def __init__(self): - pass - - @classmethod - def do_work(cls): - "Working..." - - @classmethod - def do_work_with_arg(cls, job): - "Working on something" - return "Working on %s..." % job diff --git a/pylint/test/messages/func_assert_2uple.txt b/pylint/test/messages/func_assert_2uple.txt deleted file mode 100644 index 3031ea7..0000000 --- a/pylint/test/messages/func_assert_2uple.txt +++ /dev/null @@ -1,2 +0,0 @@ -W: 5: Assert called on a 2-uple. Did you mean 'assert x,y'? -W: 11: Assert called on a 2-uple. Did you mean 'assert x,y'? diff --git a/pylint/test/messages/func_base_useless_pass.txt b/pylint/test/messages/func_base_useless_pass.txt deleted file mode 100644 index 4398e3f..0000000 --- a/pylint/test/messages/func_base_useless_pass.txt +++ /dev/null @@ -1 +0,0 @@ -W: 9: Unnecessary pass statement diff --git a/pylint/test/messages/func_deprecated_lambda_py_30.txt b/pylint/test/messages/func_deprecated_lambda_py_30.txt deleted file mode 100644 index be68e16..0000000 --- a/pylint/test/messages/func_deprecated_lambda_py_30.txt +++ /dev/null @@ -1,2 +0,0 @@ -W: 7: map/filter on lambda could be replaced by comprehension -W: 9: map/filter on lambda could be replaced by comprehension diff --git a/pylint/test/messages/func_e0101.txt b/pylint/test/messages/func_e0101.txt deleted file mode 100644 index 203cd32..0000000 --- a/pylint/test/messages/func_e0101.txt +++ /dev/null @@ -1,2 +0,0 @@ -E: 10:MyClass.__init__: Explicit return in __init__ -E: 28:MyClass4.__init__: __init__ method is a generator diff --git a/pylint/test/messages/func_e0108.txt b/pylint/test/messages/func_e0108.txt deleted file mode 100644 index dfbafe5..0000000 --- a/pylint/test/messages/func_e0108.txt +++ /dev/null @@ -1,3 +0,0 @@ -E: 4:foo1: Duplicate argument name _ in function definition -E: 8:foo2: Duplicate argument name _ in function definition -E: 12:foo3: Duplicate argument name _ in function definition |