diff options
author | David Gilman <davidgilman1@gmail.com> | 2021-01-01 15:51:06 -0500 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-02-16 07:53:15 +0100 |
commit | 0c3c6dc8facf395ada947a5444255e0c6a3d2aaa (patch) | |
tree | 386f9386f5b971fcfe225ad221f2805da2055a90 /tests | |
parent | cee9fd848246a6f4e575f6b3639c3e83daf79d24 (diff) | |
download | pylint-git-0c3c6dc8facf395ada947a5444255e0c6a3d2aaa.tar.gz |
Remove tests that only run pre-Python 3.6
Diffstat (limited to 'tests')
39 files changed, 0 insertions, 398 deletions
diff --git a/tests/functional/b/boolean_datetime.py b/tests/functional/b/boolean_datetime.py deleted file mode 100644 index 5afc5a42e..000000000 --- a/tests/functional/b/boolean_datetime.py +++ /dev/null @@ -1,30 +0,0 @@ -""" Checks for boolean uses of datetime.time. """
-# pylint: disable=superfluous-parens,print-statement,no-absolute-import,consider-using-ternary,simplifiable-if-expression
-import datetime
-
-if datetime.time(0, 0, 0): # [boolean-datetime]
- print("datetime.time(0,0,0) is not a bug!")
-else:
- print("datetime.time(0,0,0) is a bug!")
-
-if not datetime.time(0, 0, 1): # [boolean-datetime]
- print("datetime.time(0,0,1) is not a bug!")
-else:
- print("datetime.time(0,0,1) is a bug!")
-
-DATA = not datetime.time(0, 0, 0) # [boolean-datetime]
-DATA1 = True if datetime.time(0, 0, 0) else False # [boolean-datetime]
-DATA2 = datetime.time(0, 0, 0) or True # [boolean-datetime]
-DATA3 = datetime.time(0, 0, 0) and True # [boolean-datetime]
-DATA4 = False or True or datetime.time(0, 0, 0) # [boolean-datetime]
-DATA5 = False and datetime.time(0, 0, 0) or True # [boolean-datetime]
-
-
-def cant_infer(data):
- """ Can't infer what data is """
- hophop = not data
- troptrop = True if data else False
- toptop = data or True
- return hophop, troptrop, toptop
-
-cant_infer(datetime.time(0, 0, 0))
diff --git a/tests/functional/b/boolean_datetime.rc b/tests/functional/b/boolean_datetime.rc deleted file mode 100644 index 21fd414d3..000000000 --- a/tests/functional/b/boolean_datetime.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.5 diff --git a/tests/functional/b/boolean_datetime.txt b/tests/functional/b/boolean_datetime.txt deleted file mode 100644 index f3287d4f7..000000000 --- a/tests/functional/b/boolean_datetime.txt +++ /dev/null @@ -1,8 +0,0 @@ -boolean-datetime:5::Using datetime.time in a boolean context. -boolean-datetime:10::Using datetime.time in a boolean context. -boolean-datetime:15::Using datetime.time in a boolean context. -boolean-datetime:16::Using datetime.time in a boolean context. -boolean-datetime:17::Using datetime.time in a boolean context. -boolean-datetime:18::Using datetime.time in a boolean context. -boolean-datetime:19::Using datetime.time in a boolean context. -boolean-datetime:20::Using datetime.time in a boolean context. diff --git a/tests/functional/e/exception_message.py b/tests/functional/e/exception_message.py deleted file mode 100644 index da95c78f7..000000000 --- a/tests/functional/e/exception_message.py +++ /dev/null @@ -1,41 +0,0 @@ -""" -Check accessing Exception.message -""" -# pylint: disable=import-error, no-absolute-import, broad-except - -from unknown import ExtensionException -__revision__ = 0 - -class SubException(IndexError): - """ empty """ - -_ = IndexError("test").message # [exception-message-attribute] -_ = ZeroDivisionError("error").message # [exception-message-attribute] -_ = ExtensionException("error").message -_ = SubException("error").message # [exception-message-attribute] - -try: - raise Exception('e') -except Exception as exception: - _ = exception.message # [exception-message-attribute] - del exception.message # [exception-message-attribute] - exception.message += 'hello world' # [exception-message-attribute] - exception.message = 'hello world' - - -class CompatException(Exception): - """An exception which should work on py2 and py3.""" - - def __init__(self, message=''): - super(CompatException, self).__init__() - self.message = message - - def __repr__(self): - result = 'CompatException %s' % self.message - return result.encode('utf-8') - - -try: - raise CompatException('message here') -except CompatException as error: - _ = error.message diff --git a/tests/functional/e/exception_message.rc b/tests/functional/e/exception_message.rc deleted file mode 100644 index 4a0e47a21..000000000 --- a/tests/functional/e/exception_message.rc +++ /dev/null @@ -1,5 +0,0 @@ -[testoptions] -max_pyver=3.0 - -[Messages Control] -enable=python3 diff --git a/tests/functional/e/exception_message.txt b/tests/functional/e/exception_message.txt deleted file mode 100644 index b2a993bdf..000000000 --- a/tests/functional/e/exception_message.txt +++ /dev/null @@ -1,6 +0,0 @@ -exception-message-attribute:12::Exception.message removed in Python 3
-exception-message-attribute:13::Exception.message removed in Python 3
-exception-message-attribute:15::Exception.message removed in Python 3
-exception-message-attribute:20::Exception.message removed in Python 3
-exception-message-attribute:21::Exception.message removed in Python 3
-exception-message-attribute:22::Exception.message removed in Python 3
diff --git a/tests/functional/e/exec_used_py2.py b/tests/functional/e/exec_used_py2.py deleted file mode 100644 index 8f7f07d90..000000000 --- a/tests/functional/e/exec_used_py2.py +++ /dev/null @@ -1,10 +0,0 @@ -# pylint: disable=missing-docstring - -exec 'a = __revision__' # [exec-used] -VALUES = {} -exec 'a = 1' in VALUES # [exec-used] - -exec 'a = 1' in globals() # [exec-used] - -def func(): - exec 'b = 1' # [exec-used] diff --git a/tests/functional/e/exec_used_py2.rc b/tests/functional/e/exec_used_py2.rc deleted file mode 100644 index a65023393..000000000 --- a/tests/functional/e/exec_used_py2.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff --git a/tests/functional/e/exec_used_py2.txt b/tests/functional/e/exec_used_py2.txt deleted file mode 100644 index 756d3ec89..000000000 --- a/tests/functional/e/exec_used_py2.txt +++ /dev/null @@ -1,4 +0,0 @@ -exec-used:3::Use of exec
-exec-used:5::Use of exec
-exec-used:7::Use of exec
-exec-used:10:func:Use of exec diff --git a/tests/functional/i/indexing_exception.py b/tests/functional/i/indexing_exception.py deleted file mode 100644 index 9ac1a7c68..000000000 --- a/tests/functional/i/indexing_exception.py +++ /dev/null @@ -1,15 +0,0 @@ -""" -Check for indexing exceptions. -""" -# pylint: disable=import-error, no-absolute-import - -from unknown import ExtensionException -__revision__ = 0 - -class SubException(IndexError): - """ empty """ - -_ = IndexError("test")[0] # [indexing-exception] -_ = ZeroDivisionError("error")[0] # [indexing-exception] -_ = ExtensionException("error")[0] -_ = SubException("error")[1] # [indexing-exception] diff --git a/tests/functional/i/indexing_exception.rc b/tests/functional/i/indexing_exception.rc deleted file mode 100644 index 4a0e47a21..000000000 --- a/tests/functional/i/indexing_exception.rc +++ /dev/null @@ -1,5 +0,0 @@ -[testoptions] -max_pyver=3.0 - -[Messages Control] -enable=python3 diff --git a/tests/functional/i/indexing_exception.txt b/tests/functional/i/indexing_exception.txt deleted file mode 100644 index c1fcc7531..000000000 --- a/tests/functional/i/indexing_exception.txt +++ /dev/null @@ -1,3 +0,0 @@ -indexing-exception:12::Indexing exceptions will not work on Python 3
-indexing-exception:13::Indexing exceptions will not work on Python 3
-indexing-exception:15::Indexing exceptions will not work on Python 3 diff --git a/tests/functional/i/iterable_context_py2.py b/tests/functional/i/iterable_context_py2.py deleted file mode 100644 index 22c60c174..000000000 --- a/tests/functional/i/iterable_context_py2.py +++ /dev/null @@ -1,18 +0,0 @@ -""" -Checks that iterable metaclasses are recognized by pylint. -""" -# pylint: disable=missing-docstring,too-few-public-methods,no-init,no-self-use,unused-argument,bad-mcs-method-argument, useless-object-inheritance - -# metaclasses as iterables -class Meta(type): - def __iter__(self): - return iter((1, 2, 3)) - -class SomeClass(object): - __metaclass__ = Meta - - -for i in SomeClass: - print i -for i in SomeClass(): # [not-an-iterable] - print i diff --git a/tests/functional/i/iterable_context_py2.rc b/tests/functional/i/iterable_context_py2.rc deleted file mode 100644 index a65023393..000000000 --- a/tests/functional/i/iterable_context_py2.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff --git a/tests/functional/i/iterable_context_py2.txt b/tests/functional/i/iterable_context_py2.txt deleted file mode 100644 index 8de579a3f..000000000 --- a/tests/functional/i/iterable_context_py2.txt +++ /dev/null @@ -1 +0,0 @@ -not-an-iterable:17::Non-iterable value SomeClass() is used in an iterating context diff --git a/tests/functional/m/mapping_context_py2.py b/tests/functional/m/mapping_context_py2.py deleted file mode 100644 index f5cdc753d..000000000 --- a/tests/functional/m/mapping_context_py2.py +++ /dev/null @@ -1,19 +0,0 @@ -# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,no-self-use,bad-mcs-method-argument, useless-object-inheritance -from __future__ import print_function - - -def test(**kwargs): - print(kwargs) - -# metaclasses as mappings -class Meta(type): - def __getitem__(self, key): - return ord(key) - def keys(self): - return ['a', 'b', 'c'] - -class SomeClass(object): - __metaclass__ = Meta - -test(**SomeClass) -test(**SomeClass()) # [not-a-mapping] diff --git a/tests/functional/m/mapping_context_py2.rc b/tests/functional/m/mapping_context_py2.rc deleted file mode 100644 index a65023393..000000000 --- a/tests/functional/m/mapping_context_py2.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff --git a/tests/functional/m/mapping_context_py2.txt b/tests/functional/m/mapping_context_py2.txt deleted file mode 100644 index 59cca6c42..000000000 --- a/tests/functional/m/mapping_context_py2.txt +++ /dev/null @@ -1 +0,0 @@ -not-a-mapping:19::Non-mapping value SomeClass() is used in a mapping context diff --git a/tests/functional/m/membership_protocol_py2.py b/tests/functional/m/membership_protocol_py2.py deleted file mode 100644 index 8a569c36b..000000000 --- a/tests/functional/m/membership_protocol_py2.py +++ /dev/null @@ -1,36 +0,0 @@ -# pylint: disable=missing-docstring,too-few-public-methods,no-init,no-self-use,unused-argument,pointless-statement,expression-not-assigned,undefined-variable, useless-object-inheritance - -# metaclasses that support membership test protocol -class MetaIterable(type): - def __iter__(cls): - return iter((1, 2, 3)) - -class MetaOldIterable(type): - def __getitem__(cls, key): - if key < 10: - return key ** 2 - else: - raise IndexError("bad index") - -class MetaContainer(type): - def __contains__(cls, key): - return False - - -class IterableClass(object): - __metaclass__ = MetaIterable - -class OldIterableClass(object): - __metaclass__ = MetaOldIterable - -class ContainerClass(object): - __metaclass__ = MetaContainer - - -def test(): - 1 in IterableClass - 1 in OldIterableClass - 1 in ContainerClass - 1 in IterableClass() # [unsupported-membership-test] - 1 in OldIterableClass() # [unsupported-membership-test] - 1 in ContainerClass() # [unsupported-membership-test] diff --git a/tests/functional/m/membership_protocol_py2.rc b/tests/functional/m/membership_protocol_py2.rc deleted file mode 100644 index a65023393..000000000 --- a/tests/functional/m/membership_protocol_py2.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff --git a/tests/functional/m/membership_protocol_py2.txt b/tests/functional/m/membership_protocol_py2.txt deleted file mode 100644 index 4ba757550..000000000 --- a/tests/functional/m/membership_protocol_py2.txt +++ /dev/null @@ -1,3 +0,0 @@ -unsupported-membership-test:34:test:Value 'IterableClass()' doesn't support membership test -unsupported-membership-test:35:test:Value 'OldIterableClass()' doesn't support membership test -unsupported-membership-test:36:test:Value 'ContainerClass()' doesn't support membership test diff --git a/tests/functional/p/print_always_warns.py b/tests/functional/p/print_always_warns.py deleted file mode 100644 index 8b7f2fc9c..000000000 --- a/tests/functional/p/print_always_warns.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Check print statement always warns even if in Python 2 block """ - -from __future__ import absolute_import - -import six - -if six.PY2: - print "Python 3 fails to parse print statements." # [print-statement] diff --git a/tests/functional/p/print_always_warns.rc b/tests/functional/p/print_always_warns.rc deleted file mode 100644 index 4a0e47a21..000000000 --- a/tests/functional/p/print_always_warns.rc +++ /dev/null @@ -1,5 +0,0 @@ -[testoptions] -max_pyver=3.0 - -[Messages Control] -enable=python3 diff --git a/tests/functional/p/print_always_warns.txt b/tests/functional/p/print_always_warns.txt deleted file mode 100644 index c35e118d4..000000000 --- a/tests/functional/p/print_always_warns.txt +++ /dev/null @@ -1 +0,0 @@ -print-statement:8::print statement used diff --git a/tests/functional/s/singledispatch_functions.py b/tests/functional/s/singledispatch_functions.py deleted file mode 100644 index cfd4d873c..000000000 --- a/tests/functional/s/singledispatch_functions.py +++ /dev/null @@ -1,76 +0,0 @@ -# pylint: disable=missing-docstring,import-error,unused-import,assignment-from-no-return -# pylint: disable=invalid-name, too-few-public-methods, useless-object-inheritance -from __future__ import print_function -from UNINFERABLE import uninferable_func - -try: - from functools import singledispatch -except ImportError: - from singledispatch import singledispatch - -my_single_dispatch = singledispatch - - -class FakeSingleDispatch(object): - - @staticmethod - def register(function): - return function - - def __call__(self, function): - return function - -fake_singledispatch_decorator = FakeSingleDispatch() - -@singledispatch -def func(arg): - return arg - - -@func.register(str) -def _(arg): - return 42 - - -@func.register(float) -@func.register(int) -def _(arg): - return 42 - - -@my_single_dispatch -def func2(arg): - return arg - - -@func2.register(int) -def _(arg): - return 42 - - -@singledispatch -def with_extra_arg(arg, verbose=False): - if verbose: - print(arg) - return arg - - -@with_extra_arg.register(str) -def _(arg, verbose=False): - unused = 42 # [unused-variable] - return arg[::-1] - - -@fake_singledispatch_decorator -def not_single_dispatch(arg): # [unused-argument] - return 'not yet implemented' - - -@fake_singledispatch_decorator.register(str) -def bad_single_dispatch(arg): # [unused-argument] - return 42 - - -@fake_singledispatch_decorator.register(str) -def bad_single_dispatch(arg): # [unused-argument, function-redefined] - return 24 diff --git a/tests/functional/s/singledispatch_functions.rc b/tests/functional/s/singledispatch_functions.rc deleted file mode 100644 index 69713a63d..000000000 --- a/tests/functional/s/singledispatch_functions.rc +++ /dev/null @@ -1,3 +0,0 @@ -[testoptions] -;https://bugs.python.org/issue10445 -max_pyver=3.0 diff --git a/tests/functional/s/singledispatch_functions.txt b/tests/functional/s/singledispatch_functions.txt deleted file mode 100644 index 1a678e43c..000000000 --- a/tests/functional/s/singledispatch_functions.txt +++ /dev/null @@ -1,5 +0,0 @@ -unused-variable:60:_:Unused variable 'unused' -unused-argument:65:not_single_dispatch:Unused argument 'arg' -unused-argument:70:bad_single_dispatch:Unused argument 'arg' -function-redefined:75:bad_single_dispatch:function already defined line 70 -unused-argument:75:bad_single_dispatch:Unused argument 'arg' diff --git a/tests/functional/s/string_formatting_py27.py b/tests/functional/s/string_formatting_py27.py deleted file mode 100644 index eab042c07..000000000 --- a/tests/functional/s/string_formatting_py27.py +++ /dev/null @@ -1,22 +0,0 @@ -"""test for Python 2 string formatting error
-"""
-from __future__ import unicode_literals
-# pylint: disable=line-too-long
-__revision__ = 1
-
-def pprint_bad():
- """Test string format """
- "{{}}".format(1) # [too-many-format-args]
- "{} {".format() # [bad-format-string]
- "{} }".format() # [bad-format-string]
- "{0} {}".format(1, 2) # [format-combined-specification]
- # +1: [missing-format-argument-key, unused-format-string-argument]
- "{a} {b}".format(a=1, c=2)
- "{} {a}".format(1, 2) # [missing-format-argument-key]
- "{} {}".format(1) # [too-few-format-args]
- "{} {}".format(1, 2, 3) # [too-many-format-args]
- # +1: [missing-format-argument-key,missing-format-argument-key,missing-format-argument-key]
- "{a} {b} {c}".format()
- "{} {}".format(a=1, b=2) # [too-few-format-args]
- # +1: [missing-format-argument-key, missing-format-argument-key]
- "{a} {b}".format(1, 2)
diff --git a/tests/functional/s/string_formatting_py27.rc b/tests/functional/s/string_formatting_py27.rc deleted file mode 100644 index 8cc2fde47..000000000 --- a/tests/functional/s/string_formatting_py27.rc +++ /dev/null @@ -1,3 +0,0 @@ -[testoptions] -min_pyver=2.7
-max_pyver=3.0 diff --git a/tests/functional/s/string_formatting_py27.txt b/tests/functional/s/string_formatting_py27.txt deleted file mode 100644 index 47f21ded0..000000000 --- a/tests/functional/s/string_formatting_py27.txt +++ /dev/null @@ -1,15 +0,0 @@ -too-many-format-args:9:pprint_bad:Too many arguments for format string -bad-format-string:10:pprint_bad:Invalid format string -bad-format-string:11:pprint_bad:Invalid format string -format-combined-specification:12:pprint_bad:Format string contains both automatic field numbering and manual field specification -missing-format-argument-key:14:pprint_bad:Missing keyword argument u'b' for format string -unused-format-string-argument:14:pprint_bad:Unused format argument 'c' -missing-format-argument-key:15:pprint_bad:Missing keyword argument u'a' for format string -too-few-format-args:16:pprint_bad:Not enough arguments for format string -too-many-format-args:17:pprint_bad:Too many arguments for format string -missing-format-argument-key:19:pprint_bad:Missing keyword argument u'a' for format string -missing-format-argument-key:19:pprint_bad:Missing keyword argument u'b' for format string -missing-format-argument-key:19:pprint_bad:Missing keyword argument u'c' for format string -too-few-format-args:20:pprint_bad:Not enough arguments for format string -missing-format-argument-key:22:pprint_bad:Missing keyword argument u'a' for format string -missing-format-argument-key:22:pprint_bad:Missing keyword argument u'b' for format string diff --git a/tests/functional/s/suspicious_str_strip_call.py b/tests/functional/s/suspicious_str_strip_call.py deleted file mode 100644 index bc3a27c27..000000000 --- a/tests/functional/s/suspicious_str_strip_call.py +++ /dev/null @@ -1,10 +0,0 @@ -"""Suspicious str.strip calls.""" -__revision__ = 1 - -''.strip('yo') -''.strip() - -u''.strip('http://') # [bad-str-strip-call] -u''.lstrip('http://') # [bad-str-strip-call] -b''.rstrip('http://') # [bad-str-strip-call] -"some_sensible_string".strip(None) # Don't crash diff --git a/tests/functional/s/suspicious_str_strip_call.rc b/tests/functional/s/suspicious_str_strip_call.rc deleted file mode 100644 index a65023393..000000000 --- a/tests/functional/s/suspicious_str_strip_call.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -max_pyver=3.0 diff --git a/tests/functional/s/suspicious_str_strip_call.txt b/tests/functional/s/suspicious_str_strip_call.txt deleted file mode 100644 index ad714cc6b..000000000 --- a/tests/functional/s/suspicious_str_strip_call.txt +++ /dev/null @@ -1,3 +0,0 @@ -bad-str-strip-call:7::Suspicious argument in unicode.strip call -bad-str-strip-call:8::Suspicious argument in unicode.lstrip call -bad-str-strip-call:9::Suspicious argument in str.rstrip call diff --git a/tests/functional/u/unknown_encoding_py29.py b/tests/functional/u/unknown_encoding_py29.py deleted file mode 100644 index 4bc9816ba..000000000 --- a/tests/functional/u/unknown_encoding_py29.py +++ /dev/null @@ -1,6 +0,0 @@ -# [syntax-error]
-# -*- coding: IBO-8859-1 -*-
-""" check correct unknown encoding declaration
-"""
-
-__revision__ = 'יייי'
diff --git a/tests/functional/u/unknown_encoding_py29.rc b/tests/functional/u/unknown_encoding_py29.rc deleted file mode 100644 index bbe1f6b92..000000000 --- a/tests/functional/u/unknown_encoding_py29.rc +++ /dev/null @@ -1,3 +0,0 @@ -[testoptions] -max_pyver=3.0 -except_implementations=PyPy diff --git a/tests/functional/u/unknown_encoding_py29.txt b/tests/functional/u/unknown_encoding_py29.txt deleted file mode 100644 index 20e775752..000000000 --- a/tests/functional/u/unknown_encoding_py29.txt +++ /dev/null @@ -1 +0,0 @@ -syntax-error:1::"unknown encoding: IBO-8859-1 (<string>, line 0)"
diff --git a/tests/functional/u/unpacked_exceptions.py b/tests/functional/u/unpacked_exceptions.py deleted file mode 100644 index ec3599c3c..000000000 --- a/tests/functional/u/unpacked_exceptions.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Test for redefine-in-handler, overwriting names in exception handlers.""" - -def new_style(): - """Some exceptions can be unpacked.""" - try: - pass - except IOError, (errno, message): # [unpacking-in-except] - print errno, message # pylint: disable=print-statement - # +1: [redefine-in-handler,redefine-in-handler,unpacking-in-except] - except IOError, (new_style, tuple): # pylint: disable=duplicate-except - print new_style, tuple # pylint: disable=print-statement diff --git a/tests/functional/u/unpacked_exceptions.rc b/tests/functional/u/unpacked_exceptions.rc deleted file mode 100644 index 4a0e47a21..000000000 --- a/tests/functional/u/unpacked_exceptions.rc +++ /dev/null @@ -1,5 +0,0 @@ -[testoptions] -max_pyver=3.0 - -[Messages Control] -enable=python3 diff --git a/tests/functional/u/unpacked_exceptions.txt b/tests/functional/u/unpacked_exceptions.txt deleted file mode 100644 index 1a1b03423..000000000 --- a/tests/functional/u/unpacked_exceptions.txt +++ /dev/null @@ -1,4 +0,0 @@ -unpacking-in-except:7:new_style:Implicit unpacking of exceptions is not supported in Python 3 -redefine-in-handler:10:new_style:Redefining name 'new_style' from outer scope (line 3) in exception handler -redefine-in-handler:10:new_style:Redefining name 'tuple' from builtins in exception handler -unpacking-in-except:10:new_style:Implicit unpacking of exceptions is not supported in Python 3 |