diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-12 11:49:03 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-12 11:49:03 +0300 |
commit | 4e82b39a1e0e2329de4df11cd79740a5455b7b5d (patch) | |
tree | 186a0621cae66824fe1615a8ec8f1ce27ef142c6 | |
parent | d2eef8ae6dac76ad7395170ca22424f1cc0a3c92 (diff) | |
download | pylint-4e82b39a1e0e2329de4df11cd79740a5455b7b5d.tar.gz |
Port more old tests to the new style tests and remove obsolete tests.
17 files changed, 83 insertions, 98 deletions
diff --git a/pylint/test/input/func_w0312.py b/pylint/test/functional/mixed_indentation.py index 491f75b..724ecff 100644 --- a/pylint/test/input/func_w0312.py +++ b/pylint/test/functional/mixed_indentation.py @@ -1,11 +1,10 @@ """test mixed tabs and spaces""" from __future__ import print_function -__revision__ = 1 def spaces_func(): """yo""" print("yo") def tab_func(): - """yo""" - print("yo") + """yo""" # [mixed-indentation] + print("yo") # [mixed-indentation] diff --git a/pylint/test/functional/mixed_indentation.txt b/pylint/test/functional/mixed_indentation.txt new file mode 100644 index 0000000..d4857e6 --- /dev/null +++ b/pylint/test/functional/mixed_indentation.txt @@ -0,0 +1,2 @@ +mixed-indentation:9::Found indentation with tabs instead of spaces +mixed-indentation:10::Found indentation with tabs instead of spaces diff --git a/pylint/test/input/func_typecheck_non_callable_call.py b/pylint/test/functional/not_callable.py index 832657d..c2a3ab4 100644 --- a/pylint/test/input/func_typecheck_non_callable_call.py +++ b/pylint/test/functional/not_callable.py @@ -1,19 +1,13 @@ -# pylint: disable=R0903,missing-docstring,no-self-use -""" - 'E1102': ('%s is not callable', - 'Used when an object being called has been infered to a non \ - callable object'), -""" +# pylint: disable=missing-docstring,no-self-use,too-few-public-methods -__revision__ = None +REVISION = None -__revision__() +REVISION() # [not-callable] def correct(): - """callable object""" return 1 -__revision__ = correct() +REVISION = correct() class Correct(object): """callable object""" @@ -26,15 +20,15 @@ class MetaCorrect(object): INSTANCE = Correct() CALLABLE_INSTANCE = MetaCorrect() CORRECT = CALLABLE_INSTANCE() -INCORRECT = INSTANCE() +INCORRECT = INSTANCE() # [not-callable] LIST = [] -INCORRECT = LIST() +INCORRECT = LIST() # [not-callable] DICT = {} -INCORRECT = DICT() +INCORRECT = DICT() # [not-callable] TUPLE = () -INCORRECT = TUPLE() +INCORRECT = TUPLE() # [not-callable] INT = 1 -INCORRECT = INT() +INCORRECT = INT() # [not-callable] # Test calling properties. Pylint can detect when using only the # getter, but it doesn't infer properly when having a getter @@ -69,8 +63,8 @@ class PropertyTest(object): self.attr = value PROP = PropertyTest() -PROP.test(40) -PROP.custom() +PROP.test(40) # [not-callable] +PROP.custom() # [not-callable] # Safe from not-callable when using properties. diff --git a/pylint/test/functional/not_callable.txt b/pylint/test/functional/not_callable.txt new file mode 100644 index 0000000..4928c8c --- /dev/null +++ b/pylint/test/functional/not_callable.txt @@ -0,0 +1,8 @@ +not-callable:5::REVISION is not callable +not-callable:23::INSTANCE is not callable +not-callable:25::LIST is not callable +not-callable:27::DICT is not callable +not-callable:29::TUPLE is not callable +not-callable:31::INT is not callable +not-callable:66::PROP.test is not callable +not-callable:67::PROP.custom is not callable
\ No newline at end of file diff --git a/pylint/test/input/func_return_outside_func.py b/pylint/test/functional/return_outside_function.py index 440798d..449dafd 100644 --- a/pylint/test/input/func_return_outside_func.py +++ b/pylint/test/functional/return_outside_function.py @@ -1,3 +1,2 @@ """This is gramatically correct, but it's still a SyntaxError""" -__revision__ = None -return +return # [return-outside-function] diff --git a/pylint/test/functional/return_outside_function.txt b/pylint/test/functional/return_outside_function.txt new file mode 100644 index 0000000..0c9aa56 --- /dev/null +++ b/pylint/test/functional/return_outside_function.txt @@ -0,0 +1 @@ +return-outside-function:2::Return outside function
\ No newline at end of file diff --git a/pylint/test/functional/too_many_locals.py b/pylint/test/functional/too_many_locals.py index 56ed514..ac38a9e 100644 --- a/pylint/test/functional/too_many_locals.py +++ b/pylint/test/functional/too_many_locals.py @@ -7,3 +7,54 @@ def function(arg1, arg2, arg3, arg4, arg5): # [too-many-locals] loc1, loc2, loc3, loc4, loc5, loc6, loc7 = arg1, arg2, arg3, arg4, arg5, \ arg6, arg7 print(loc1, loc2, loc3, loc4, loc5, loc6, loc7) + + +def too_many_locals_function(): # [too-many-locals] + """pylint will complains about too many local variables""" + args0 = 0 + args1 = args0 * 1 + args2 = args1 * 2 + args3 = args2 * 3 + args4 = args3 * 4 + args5 = args4 * 5 + args6 = args5 * 6 + args7 = args6 * 7 + args8 = args7 * 8 + args9 = args8 * 9 + args10 = args9 * 10 + args11 = args10 * 11 + args12 = args11 * 12 + args13 = args12 * 13 + args14 = args13 * 14 + args15 = args14 * 15 + return args15 + +def too_many_arguments_function(arga, argu, argi, arge, argt, args): # [too-many-arguments] + """pylint will complains about too many arguments.""" + arga = argu + arga += argi + arga += arge + arga += argt + arga += args + return arga + +def ignored_arguments_function(arga, argu, argi, + _arge=0, _argt=1, _args=None): + """pylint will ignore _arge, _argt, _args. + + Consequently pylint will only coun 13 arguments. + """ + arg0 = 0 + arg1 = arg0 * 1 + arga + arg2 = arg1 * 2 + argu + arg3 = arg2 * 3 + argi + arg4 = arg3 * 4 + _arge + arg5 = arg4 * 5 + _argt + arg6 = arg5 * 6 + arg7 = arg6 * 7 + arg8 = arg7 * 8 + arg9 = arg8 * 9 + arg9 += arg0 + if _args: + arg9 += sum(_args) + return arg9 diff --git a/pylint/test/functional/too_many_locals.txt b/pylint/test/functional/too_many_locals.txt index b94c307..4a7d19d 100644 --- a/pylint/test/functional/too_many_locals.txt +++ b/pylint/test/functional/too_many_locals.txt @@ -1 +1,3 @@ -too-many-locals:4:function:Too many local variables (16/15)
\ No newline at end of file +too-many-locals:4:function:Too many local variables (16/15)
+too-many-locals:12:too_many_locals_function:Too many local variables (16/15)
+too-many-arguments:32:too_many_arguments_function:Too many arguments (6/5)
\ No newline at end of file diff --git a/pylint/test/functional/unrecognized_inline_option.py b/pylint/test/functional/unrecognized_inline_option.py new file mode 100644 index 0000000..3163b1e --- /dev/null +++ b/pylint/test/functional/unrecognized_inline_option.py @@ -0,0 +1,3 @@ +# +1: [unrecognized-inline-option] +# pylint:bouboule=1 +"""Check unknown option"""
diff --git a/pylint/test/functional/unrecognized_inline_option.txt b/pylint/test/functional/unrecognized_inline_option.txt new file mode 100644 index 0000000..922cc92 --- /dev/null +++ b/pylint/test/functional/unrecognized_inline_option.txt @@ -0,0 +1 @@ +unrecognized-inline-option:2::"Unrecognized file option 'bouboule'" diff --git a/pylint/test/input/func_e0001_py30.py b/pylint/test/input/func_e0001_py30.py deleted file mode 100644 index 9c1b727..0000000 --- a/pylint/test/input/func_e0001_py30.py +++ /dev/null @@ -1,12 +0,0 @@ -"""test string exception -""" - -__revision__ = '' - -def function1(): - """hehehe""" - raise "String Exception" - -def function2(): - """hehehe""" - raise 'exception', 'message' diff --git a/pylint/test/input/func_e0011.py b/pylint/test/input/func_e0011.py deleted file mode 100644 index f2bb592..0000000 --- a/pylint/test/input/func_e0011.py +++ /dev/null @@ -1,5 +0,0 @@ -# pylint:bouboule=1 -"""check unknown option -""" -__revision__ = 1 - diff --git a/pylint/test/input/func_too_many_locals_arguments.py b/pylint/test/input/func_too_many_locals_arguments.py deleted file mode 100644 index f63a5ee..0000000 --- a/pylint/test/input/func_too_many_locals_arguments.py +++ /dev/null @@ -1,52 +0,0 @@ -"""tests number of arguments and local variables in functions -""" - -__revision__ = None - -def too_many_locals_function(): - '''pylint will complains about too many local variables''' - args0 = 0 - args1 = args0 * 1 - args2 = args1 * 2 - args3 = args2 * 3 - args4 = args3 * 4 - args5 = args4 * 5 - args6 = args5 * 6 - args7 = args6 * 7 - args8 = args7 * 8 - args9 = args8 * 9 - args10 = args9 * 10 - args11 = args10 * 11 - args12 = args11 * 12 - args13 = args12 * 13 - args14 = args13 * 14 - args15 = args14 * 15 - return args15 - -def too_many_arguments_function(arga, argu, argi, arge, argt, args): - '''pylint will complains about too many arguments.''' - arga = argu - arga += argi - arga += arge - arga += argt - arga += args - return arga - -def ignored_arguments_function(arga, argu, argi, - _arge=0, _argt=1, _args=None): - '''pylint will ignore _arge, _argt, _args. - Consequently pylint will only coun 13 arguments''' - arg0 = 0 - arg1 = arg0 * 1 + arga - arg2 = arg1 * 2 + argu - arg3 = arg2 * 3 + argi - arg4 = arg3 * 4 + _arge - arg5 = arg4 * 5 + _argt - arg6 = arg5 * 6 - arg7 = arg6 * 7 - arg8 = arg7 * 8 - arg9 = arg8 * 9 - arg9 += arg0 - if _args: - arg9 += sum(_args) - return arg9 diff --git a/pylint/test/messages/func_e0001_py30.txt b/pylint/test/messages/func_e0001_py30.txt deleted file mode 100644 index 1cf05ca..0000000 --- a/pylint/test/messages/func_e0001_py30.txt +++ /dev/null @@ -1,2 +0,0 @@ -E: 12: invalid syntax - diff --git a/pylint/test/messages/func_e0011.txt b/pylint/test/messages/func_e0011.txt deleted file mode 100644 index 55f07b1..0000000 --- a/pylint/test/messages/func_e0011.txt +++ /dev/null @@ -1 +0,0 @@ -E: 1: Unrecognized file option 'bouboule' diff --git a/pylint/test/messages/func_return_outside_func.txt b/pylint/test/messages/func_return_outside_func.txt deleted file mode 100644 index e61be76..0000000 --- a/pylint/test/messages/func_return_outside_func.txt +++ /dev/null @@ -1 +0,0 @@ -E: 3: Return outside function diff --git a/pylint/test/messages/func_too_many_locals_arguments.txt b/pylint/test/messages/func_too_many_locals_arguments.txt deleted file mode 100644 index 8f236c2..0000000 --- a/pylint/test/messages/func_too_many_locals_arguments.txt +++ /dev/null @@ -1,2 +0,0 @@ -R: 6:too_many_locals_function: Too many local variables (16/15) -R: 26:too_many_arguments_function: Too many arguments (6/5) |