diff options
Diffstat (limited to 'test/functional')
30 files changed, 83 insertions, 79 deletions
diff --git a/test/functional/access_to__name__.py b/test/functional/access_to__name__.py index 21da530..45e500e 100644 --- a/test/functional/access_to__name__.py +++ b/test/functional/access_to__name__.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,star-args +# pylint: disable=too-few-public-methods,star-args, print-statement """test access to __name__ gives undefined member on new/old class instances but not on new/old class object """ diff --git a/test/functional/access_to_protected_members.py b/test/functional/access_to_protected_members.py index 8f1c928..809e7dc 100644 --- a/test/functional/access_to_protected_members.py +++ b/test/functional/access_to_protected_members.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods, W0231 +# pylint: disable=too-few-public-methods, W0231, print-statement """Test external access to protected class members.""" @@ -36,4 +36,3 @@ INST._protected = 2 # [protected-access] print INST._protected # [protected-access] INST._cls_protected = 3 # [protected-access] print INST._cls_protected # [protected-access] - diff --git a/test/functional/bad_continuation.py b/test/functional/bad_continuation.py index 3d62521..d7e90c0 100644 --- a/test/functional/bad_continuation.py +++ b/test/functional/bad_continuation.py @@ -1,5 +1,5 @@ """Regression test case for bad-continuation.""" - +# pylint: disable=print-statement # Various alignment for brackets LIST0 = [ 1, 2, 3 diff --git a/test/functional/boolean_datetime.py b/test/functional/boolean_datetime.py index 0ea9d27..5de0a0c 100644 --- a/test/functional/boolean_datetime.py +++ b/test/functional/boolean_datetime.py @@ -1,5 +1,5 @@ """ Checks for boolean uses of datetime.time. """
-# pylint: disable=superfluous-parens
+# pylint: disable=superfluous-parens,print-statement
import datetime
if datetime.time(0, 0, 0): # [boolean-datetime]
diff --git a/test/functional/cellvar_escaping_loop.py b/test/functional/cellvar_escaping_loop.py index 316bc47..dfacaf4 100644 --- a/test/functional/cellvar_escaping_loop.py +++ b/test/functional/cellvar_escaping_loop.py @@ -1,3 +1,4 @@ +# pylint: disable=print-statement """Tests for loopvar-in-closure.""" def good_case(): diff --git a/test/functional/cellvar_escaping_loop.txt b/test/functional/cellvar_escaping_loop.txt index 4448d44..90d787e 100644 --- a/test/functional/cellvar_escaping_loop.txt +++ b/test/functional/cellvar_escaping_loop.txt @@ -1,8 +1,8 @@ -unused-variable:18:good_case3:Unused variable 'i' -undefined-loop-variable:42:good_case6.<lambda>:Using possibly undefined loop variable 'i' -cell-var-from-loop:75:bad_case.<lambda>:Cell variable i defined in loop -cell-var-from-loop:80:bad_case2.<lambda>:Cell variable i defined in loop -cell-var-from-loop:88:bad_case3.<lambda>:Cell variable j defined in loop -cell-var-from-loop:98:bad_case4.nested:Cell variable i defined in loop -cell-var-from-loop:119:bad_case5.<lambda>:Cell variable i defined in loop -cell-var-from-loop:127:bad_case6.<lambda>:Cell variable i defined in loop +unused-variable:19:good_case3:Unused variable 'i' +undefined-loop-variable:43:good_case6.<lambda>:Using possibly undefined loop variable 'i' +cell-var-from-loop:76:bad_case.<lambda>:Cell variable i defined in loop +cell-var-from-loop:81:bad_case2.<lambda>:Cell variable i defined in loop +cell-var-from-loop:89:bad_case3.<lambda>:Cell variable j defined in loop +cell-var-from-loop:99:bad_case4.nested:Cell variable i defined in loop +cell-var-from-loop:120:bad_case5.<lambda>:Cell variable i defined in loop +cell-var-from-loop:128:bad_case6.<lambda>:Cell variable i defined in loop diff --git a/test/functional/class_members_py27.py b/test/functional/class_members_py27.py index d60458b..9192e4f 100644 --- a/test/functional/class_members_py27.py +++ b/test/functional/class_members_py27.py @@ -1,5 +1,5 @@ """ Various tests for class members access. """
-# pylint: disable=R0903
+# pylint: disable=R0903,print-statement
class MyClass(object):
"""class docstring"""
diff --git a/test/functional/confidence_filter.rc b/test/functional/confidence_filter.rc index 5d21cb5..74953b6 100644 --- a/test/functional/confidence_filter.rc +++ b/test/functional/confidence_filter.rc @@ -1,3 +1,3 @@ [Messages Control] -disable=no-init,too-few-public-methods,undefined-variable +disable=no-init,too-few-public-methods,undefined-variable,print-statement confidence=INFERENCE,HIGH,UNDEFINED diff --git a/test/functional/defined_and_used_on_same_line.py b/test/functional/defined_and_used_on_same_line.py index 3c180b8..d56031d 100644 --- a/test/functional/defined_and_used_on_same_line.py +++ b/test/functional/defined_and_used_on_same_line.py @@ -1,5 +1,5 @@ """Check for definitions and usage happening on the same line.""" -#pylint: disable=missing-docstring,multiple-statements +#pylint: disable=missing-docstring,multiple-statements,print-statement print [index for index in range(10)] diff --git a/test/functional/docstrings.py b/test/functional/docstrings.py index 4cdc37e..8b92b08 100644 --- a/test/functional/docstrings.py +++ b/test/functional/docstrings.py @@ -1,4 +1,4 @@ -# pylint: disable=R0201
+# pylint: disable=R0201,print-statement
# -1: [missing-docstring]
__revision__ = ''
diff --git a/test/functional/exception_is_binary_op.py b/test/functional/exception_is_binary_op.py index 76326e0..b9c51d4 100644 --- a/test/functional/exception_is_binary_op.py +++ b/test/functional/exception_is_binary_op.py @@ -1,12 +1,12 @@ """Warn about binary operations used as exceptions.""" - +from __future__ import print_function try: pass except Exception or BaseException: # [binary-op-exception] - print "caught1" + print("caught1") except Exception and BaseException: # [binary-op-exception] - print "caught2" + print("caught2") except Exception or BaseException: # [binary-op-exception] - print "caught3" + print("caught3") except (Exception or BaseException), exc: # [binary-op-exception] - print "caught4" + print("caught4") diff --git a/test/functional/generated_members.rc b/test/functional/generated_members.rc index 73fb671..4657c4e 100644 --- a/test/functional/generated_members.rc +++ b/test/functional/generated_members.rc @@ -1,5 +1,5 @@ [Messages Control] -disable=too-few-public-methods +disable=too-few-public-methods,print-statement [typecheck] generated-members=DoesNotExist,"[a-zA-Z]+_set{1,2}"" diff --git a/test/functional/genexpr_variable_scope.py b/test/functional/genexpr_variable_scope.py index 4089439..a00d72d 100644 --- a/test/functional/genexpr_variable_scope.py +++ b/test/functional/genexpr_variable_scope.py @@ -1,5 +1,5 @@ """test name defined in generator expression are not available outside the genexpr scope """ - -print n # [undefined-variable] +from __future__ import print_function +print(n) # [undefined-variable] diff --git a/test/functional/globals.py b/test/functional/globals.py index 04bfd95..c2844b1 100644 --- a/test/functional/globals.py +++ b/test/functional/globals.py @@ -1,21 +1,22 @@ """Warnings about global statements and usage of global variables.""" +from __future__ import print_function global CSTE # [global-at-module-level] -print CSTE # [undefined-variable] +print(CSTE) # [undefined-variable] CONSTANT = 1 def fix_contant(value): """all this is ok, but try not using global ;)""" global CONSTANT # [global-statement] - print CONSTANT + print(CONSTANT) CONSTANT = value def other(): """global behaviour test""" global HOP # [global-variable-not-assigned] - print HOP # [undefined-variable] + print(HOP) # [undefined-variable] def define_constant(): diff --git a/test/functional/globals.txt b/test/functional/globals.txt index 0f9d13a..c675906 100644 --- a/test/functional/globals.txt +++ b/test/functional/globals.txt @@ -1,6 +1,6 @@ -global-at-module-level:3::Using the global statement at the module level -undefined-variable:4::Undefined variable 'CSTE' -global-statement:10:fix_contant:Using the global statement -global-variable-not-assigned:17:other:Using global for 'HOP' but no assignment is done -undefined-variable:18:other:Undefined variable 'HOP' -global-variable-undefined:23:define_constant:Global variable 'SOMEVAR' undefined at the module level +global-at-module-level:4::Using the global statement at the module level +undefined-variable:5::Undefined variable 'CSTE' +global-statement:11:fix_contant:Using the global statement +global-variable-not-assigned:18:other:Using global for 'HOP' but no assignment is done +undefined-variable:19:other:Undefined variable 'HOP' +global-variable-undefined:24:define_constant:Global variable 'SOMEVAR' undefined at the module level diff --git a/test/functional/invalid_exceptions_caught.py b/test/functional/invalid_exceptions_caught.py index a48cd0f..d0bb7f1 100644 --- a/test/functional/invalid_exceptions_caught.py +++ b/test/functional/invalid_exceptions_caught.py @@ -1,6 +1,6 @@ """Test for catching non-exceptions.""" import socket -# pylint: disable=too-many-ancestors +# pylint: disable=too-many-ancestors,print-statement class MyException(object): """Custom 'exception'.""" diff --git a/test/functional/member_checks.py b/test/functional/member_checks.py index fccf160..78c4625 100644 --- a/test/functional/member_checks.py +++ b/test/functional/member_checks.py @@ -1,4 +1,4 @@ -# pylint: disable= +# pylint: disable=print-statement """check getattr if inference succeed""" diff --git a/test/functional/method_hidden.py b/test/functional/method_hidden.py index 0510f55..98fd4c7 100644 --- a/test/functional/method_hidden.py +++ b/test/functional/method_hidden.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods +# pylint: disable=too-few-public-methods,print-statement """check method hidding ancestor attribute """ diff --git a/test/functional/missing_final_newline.py b/test/functional/missing_final_newline.py index b2a9e0c..370f902 100644 --- a/test/functional/missing_final_newline.py +++ b/test/functional/missing_final_newline.py @@ -1,4 +1,4 @@ """This file does not have a final newline.""" - +from __future__ import print_function # +1:[missing-final-newline] -print 1
\ No newline at end of file +print(1)
\ No newline at end of file diff --git a/test/functional/name_styles.py b/test/functional/name_styles.py index be3e96d..5d62929 100644 --- a/test/functional/name_styles.py +++ b/test/functional/name_styles.py @@ -1,4 +1,5 @@ """Test for the invalid-name warning.""" +# pylint: disable=print-statement import abc import collections diff --git a/test/functional/name_styles.txt b/test/functional/name_styles.txt index e81d27a..0d578c8 100644 --- a/test/functional/name_styles.txt +++ b/test/functional/name_styles.txt @@ -1,17 +1,17 @@ -invalid-name:6::"Invalid constant name ""bad_const_name""" -invalid-name:9:BADFUNCTION_name:"Invalid function name ""BADFUNCTION_name""" -invalid-name:11:BADFUNCTION_name:"Invalid variable name ""BAD_LOCAL_VAR""" -invalid-name:15:func_bad_argname:"Invalid argument name ""NOT_GOOD""" -invalid-name:25:bad_class_name:"Invalid class name ""bad_class_name""" -invalid-name:36:CorrectClassName.__init__:"Invalid attribute name ""_Bad_AtTR_name""" -invalid-name:37:CorrectClassName.__init__:"Invalid attribute name ""Bad_PUBLIC_name""" -invalid-name:39:CorrectClassName:"Invalid class attribute name ""zz""" -invalid-name:42:CorrectClassName.BadMethodName:"Invalid method name ""BadMethodName""":INFERENCE -invalid-name:48:CorrectClassName.__DunDER_IS_not_free_for_all__:"Invalid method name ""__DunDER_IS_not_free_for_all__""":INFERENCE -invalid-name:78::"Invalid class name ""BAD_NAME_FOR_CLASS""" -invalid-name:79::"Invalid class name ""NEXT_BAD_NAME_FOR_CLASS""" -invalid-name:86::"Invalid class name ""NOT_CORRECT""" -invalid-name:92:test_globals:"Invalid constant name ""AlsoCorrect""" -invalid-name:105:FooClass.PROPERTY_NAME:"Invalid attribute name ""PROPERTY_NAME""":INFERENCE -invalid-name:110:FooClass.ABSTRACT_PROPERTY_NAME:"Invalid attribute name ""ABSTRACT_PROPERTY_NAME""":INFERENCE -invalid-name:115:FooClass.PROPERTY_NAME_SETTER:"Invalid attribute name ""PROPERTY_NAME_SETTER""":INFERENCE +invalid-name:7::"Invalid constant name ""bad_const_name""" +invalid-name:10:BADFUNCTION_name:"Invalid function name ""BADFUNCTION_name""" +invalid-name:12:BADFUNCTION_name:"Invalid variable name ""BAD_LOCAL_VAR""" +invalid-name:16:func_bad_argname:"Invalid argument name ""NOT_GOOD""" +invalid-name:26:bad_class_name:"Invalid class name ""bad_class_name""" +invalid-name:37:CorrectClassName.__init__:"Invalid attribute name ""_Bad_AtTR_name""" +invalid-name:38:CorrectClassName.__init__:"Invalid attribute name ""Bad_PUBLIC_name""" +invalid-name:40:CorrectClassName:"Invalid class attribute name ""zz""" +invalid-name:43:CorrectClassName.BadMethodName:"Invalid method name ""BadMethodName""":INFERENCE +invalid-name:49:CorrectClassName.__DunDER_IS_not_free_for_all__:"Invalid method name ""__DunDER_IS_not_free_for_all__""":INFERENCE +invalid-name:79::"Invalid class name ""BAD_NAME_FOR_CLASS""" +invalid-name:80::"Invalid class name ""NEXT_BAD_NAME_FOR_CLASS""" +invalid-name:87::"Invalid class name ""NOT_CORRECT""" +invalid-name:93:test_globals:"Invalid constant name ""AlsoCorrect""" +invalid-name:106:FooClass.PROPERTY_NAME:"Invalid attribute name ""PROPERTY_NAME""":INFERENCE +invalid-name:111:FooClass.ABSTRACT_PROPERTY_NAME:"Invalid attribute name ""ABSTRACT_PROPERTY_NAME""":INFERENCE +invalid-name:116:FooClass.PROPERTY_NAME_SETTER:"Invalid attribute name ""PROPERTY_NAME_SETTER""":INFERENCE diff --git a/test/functional/namedtuple_member_inference.py b/test/functional/namedtuple_member_inference.py index 675c3e2..c630f6b 100644 --- a/test/functional/namedtuple_member_inference.py +++ b/test/functional/namedtuple_member_inference.py @@ -3,6 +3,8 @@ Regression test for: https://bitbucket.org/logilab/pylint/issue/93/pylint-crashes-on-namedtuple-attribute """ +from __future__ import print_function + __revision__ = None from collections import namedtuple @@ -12,10 +14,10 @@ Fantastic = namedtuple('Fantastic', ['foo']) def test(): """Test member access in named tuples.""" - print Thing.x # [no-member] + print(Thing.x) # [no-member] fan = Fantastic(1) - print fan.foo + print(fan.foo) # Should not raise protected-access. fan2 = fan._replace(foo=2) # [protected-access] # This is a bug. - print fan2.foo # [no-member] + print(fan2.foo) # [no-member] diff --git a/test/functional/namedtuple_member_inference.txt b/test/functional/namedtuple_member_inference.txt index 308336f..2f0f85c 100644 --- a/test/functional/namedtuple_member_inference.txt +++ b/test/functional/namedtuple_member_inference.txt @@ -1,3 +1,3 @@ -no-member:15:test:Class 'Thing' has no 'x' member:INFERENCE -protected-access:19:test:Access to a protected member _replace of a client class -no-member:21:test:Instance of 'Fantastic' has no 'foo' member:INFERENCE +no-member:17:test:Class 'Thing' has no 'x' member:INFERENCE +protected-access:21:test:Access to a protected member _replace of a client class +no-member:23:test:Instance of 'Fantastic' has no 'foo' member:INFERENCE diff --git a/test/functional/names_in__all__.py b/test/functional/names_in__all__.py index acd94c3..a71aeee 100644 --- a/test/functional/names_in__all__.py +++ b/test/functional/names_in__all__.py @@ -7,7 +7,7 @@ * This module imports path and republished it in __all__. No errors are expected. """ - +from __future__ import print_function from os import path from collections import deque @@ -39,7 +39,7 @@ class Klass(object): def func(self): """A klass method""" inner = None - print inner + print(inner) class InnerKlass(object): """A inner klass""" diff --git a/test/functional/redefined_builtin.py b/test/functional/redefined_builtin.py index ace2ea6..c41d06d 100644 --- a/test/functional/redefined_builtin.py +++ b/test/functional/redefined_builtin.py @@ -3,7 +3,7 @@ def function(): """Redefined local.""" type = 1 # [redefined-builtin] - print type + print type # pylint: disable=print-statement # pylint:disable=invalid-name map = {} # [redefined-builtin] diff --git a/test/functional/socketerror_import.py b/test/functional/socketerror_import.py index 37310cf..98d6f2e 100644 --- a/test/functional/socketerror_import.py +++ b/test/functional/socketerror_import.py @@ -1,6 +1,6 @@ """ds""" - +from __future__ import print_function __revision__ = '$Id: socketerror_import.py,v 1.2 2005-12-28 14:58:22 syt Exp $' from socket import error -print error +print(error) diff --git a/test/functional/superfluous_parens.py b/test/functional/superfluous_parens.py index 35a8d0a..8bb3dd6 100644 --- a/test/functional/superfluous_parens.py +++ b/test/functional/superfluous_parens.py @@ -1,5 +1,5 @@ """Test the superfluous-parens warning.""" - +from __future__ import print_function if (3 == 5): # [superfluous-parens] pass @@ -8,7 +8,7 @@ if not (3 == 5): # [superfluous-parens] if not (3 or 5): pass for (x) in (1, 2, 3): # [superfluous-parens] - print x + print(x) if (1) in (1, 2, 3): # [superfluous-parens] pass if (1, 2) in (1, 2, 3): diff --git a/test/functional/undefined_variable.py b/test/functional/undefined_variable.py index 0b5f7aa..efaa1b8 100644 --- a/test/functional/undefined_variable.py +++ b/test/functional/undefined_variable.py @@ -1,5 +1,5 @@ """Test warnings about access to undefined variables.""" -# pylint: disable=too-few-public-methods, no-init, no-self-use, old-style-class +# pylint: disable=too-few-public-methods, no-init, no-self-use, old-style-class,print-statement DEFINED = 1 diff --git a/test/functional/unpacked_exceptions.py b/test/functional/unpacked_exceptions.py index f3c633f..1eb6675 100644 --- a/test/functional/unpacked_exceptions.py +++ b/test/functional/unpacked_exceptions.py @@ -5,7 +5,7 @@ def new_style(): try: pass except IOError, (errno, message): # [unpacking-in-except] - print errno, message + print errno, message # pylint: disable=print-statement # +1: [redefine-in-handler,redefine-in-handler,unpacking-in-except] except IOError, (new_style, tuple): - print new_style, tuple + print new_style, tuple # pylint: disable=print-statement diff --git a/test/functional/useless_else_on_loop.py b/test/functional/useless_else_on_loop.py index 4f27cf7..2fcde8b 100644 --- a/test/functional/useless_else_on_loop.py +++ b/test/functional/useless_else_on_loop.py @@ -1,5 +1,5 @@ """Check for else branches on loops with break an return only.""" - +from __future__ import print_function __revision__ = 0 def test_return_for(): @@ -8,14 +8,14 @@ def test_return_for(): if i % 2: return i else: # [useless-else-on-loop] - print 'math is broken' + print('math is broken') def test_return_while(): """else + return is not accetable.""" while True: return 1 else: # [useless-else-on-loop] - print 'math is broken' + print('math is broken') while True: @@ -24,19 +24,19 @@ while True: for _ in range(10): break else: # [useless-else-on-loop] - print 'or else!' + print('or else!') while True: while False: break else: # [useless-else-on-loop] - print 'or else!' + print('or else!') for j in range(10): pass else: # [useless-else-on-loop] - print 'fat chance' + print('fat chance') for j in range(10): break @@ -52,4 +52,4 @@ def test_return_for2(): else: break else: - print 'great math' + print('great math') |