The following issues were found
Lib/unittest/test/testmock/testmock.py
579 issues
Line: 165
Column: 9
mock.assert_called_with(1, 2, fish=3)
results = [1, 2, 3]
def effect():
return results.pop()
mock.side_effect = effect
self.assertEqual([mock(), mock(), mock()], [3, 2, 1],
"side effect not used correctly")
Reported by Pylint.
Line: 924
Column: 9
s.some_attribute = 3
self.assertRaises(NameError, test)
def test():
s.foo = 'bar'
self.assertRaises(AttributeError, test)
def test_setting_call(self):
Reported by Pylint.
Line: 1234
Column: 9
self.assertIsInstance(mock.foo, Subclass)
self.assertIsInstance(mock(), Subclass)
class Subclass(Mock):
def _get_child_mock(self, **kwargs):
return Mock(**kwargs)
mock = Subclass()
self.assertNotIsInstance(mock.foo, Subclass)
Reported by Pylint.
Line: 1864
Column: 9
manager.attach_mock(mock_one, 'one')
manager.attach_mock(mock_two, 'two')
Foo.two()
Foo.one()
self.assertEqual(manager.mock_calls, [call.two(), call.one()])
Reported by Pylint.
Line: 1865
Column: 9
manager.attach_mock(mock_two, 'two')
Foo.two()
Foo.one()
self.assertEqual(manager.mock_calls, [call.two(), call.one()])
def test_magic_methods_mock_calls(self):
Reported by Pylint.
Line: 2024
Column: 30
child_calls = [call(1), call(2), call(3)]
self.assertEqual(parent.mock_calls, parent_calls)
self.assertEqual(parent.child.mock_calls, child_calls)
self.assertEqual(something.mock_calls, child_calls)
self.assertEqual(mock_func.mock_calls, child_calls)
self.assertIn('mock.child', repr(parent.child.mock))
self.assertEqual(mock_func.mock._extract_mock_name(), 'mock.child')
Reported by Pylint.
Line: 2037
Column: 13
obj = Something()
obj.meth(1, 2, 3, d=4)
manager.assert_has_calls([call.attach_meth(mock.ANY, 1, 2, 3, d=4)])
obj.meth.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
mocked.assert_has_calls([call(mock.ANY, 1, 2, 3, d=4)])
with mock.patch(f'{__name__}.something', autospec=True) as mocked:
manager = Mock()
manager.attach_mock(mocked, 'attach_func')
Reported by Pylint.
Line: 2045
Column: 13
manager.attach_mock(mocked, 'attach_func')
something(1)
manager.assert_has_calls([call.attach_func(1)])
something.assert_has_calls([call(1)])
mocked.assert_has_calls([call(1)])
with mock.patch(f'{__name__}.Something', autospec=True) as mocked:
manager = Mock()
manager.attach_mock(mocked, 'attach_obj')
Reported by Pylint.
Line: 2055
Column: 13
obj.meth(1, 2, 3, d=4)
manager.assert_has_calls([call.attach_obj(),
call.attach_obj().meth(1, 2, 3, d=4)])
obj.meth.assert_has_calls([call(1, 2, 3, d=4)])
mocked.assert_has_calls([call(), call().meth(1, 2, 3, d=4)])
def test_attribute_deletion(self):
for mock in (Mock(), MagicMock(), NonCallableMagicMock(),
Reported by Pylint.
Line: 47
Column: 15
set_spec = None
def something(a): pass
class MockTest(unittest.TestCase):
def test_all(self):
Reported by Pylint.
Lib/test/test_warnings/__init__.py
578 issues
Line: 67
Column: 17
if '__warningregistry__' in globals():
del globals()['__warningregistry__']
if hasattr(warning_tests, '__warningregistry__'):
del warning_tests.__warningregistry__
if hasattr(sys, '__warningregistry__'):
del sys.__warningregistry__
# The 'warnings' module must be explicitly set so that the proper
# interaction between _warnings and 'warnings' can be controlled.
sys.modules['warnings'] = self.module
Reported by Pylint.
Line: 69
Column: 17
if hasattr(warning_tests, '__warningregistry__'):
del warning_tests.__warningregistry__
if hasattr(sys, '__warningregistry__'):
del sys.__warningregistry__
# The 'warnings' module must be explicitly set so that the proper
# interaction between _warnings and 'warnings' can be controlled.
sys.modules['warnings'] = self.module
# Ensure that unittest.TestCase.assertWarns() uses the same warnings
# module than warnings.catch_warnings(). Otherwise,
Reported by Pylint.
Line: 72
Column: 35
del sys.__warningregistry__
# The 'warnings' module must be explicitly set so that the proper
# interaction between _warnings and 'warnings' can be controlled.
sys.modules['warnings'] = self.module
# Ensure that unittest.TestCase.assertWarns() uses the same warnings
# module than warnings.catch_warnings(). Otherwise,
# warnings.catch_warnings() will be unable to remove the added filter.
unittest.case.warnings = self.module
super(BaseTest, self).setUp()
Reported by Pylint.
Line: 76
Column: 34
# Ensure that unittest.TestCase.assertWarns() uses the same warnings
# module than warnings.catch_warnings(). Otherwise,
# warnings.catch_warnings() will be unable to remove the added filter.
unittest.case.warnings = self.module
super(BaseTest, self).setUp()
def tearDown(self):
sys.modules['warnings'] = original_warnings
unittest.case.warnings = self.old_unittest_module
Reported by Pylint.
Line: 77
Column: 9
# module than warnings.catch_warnings(). Otherwise,
# warnings.catch_warnings() will be unable to remove the added filter.
unittest.case.warnings = self.module
super(BaseTest, self).setUp()
def tearDown(self):
sys.modules['warnings'] = original_warnings
unittest.case.warnings = self.old_unittest_module
super(BaseTest, self).tearDown()
Reported by Pylint.
Line: 82
Column: 9
def tearDown(self):
sys.modules['warnings'] = original_warnings
unittest.case.warnings = self.old_unittest_module
super(BaseTest, self).tearDown()
class PublicAPITests(BaseTest):
"""Ensures that the correct values are exposed in the
public API.
Reported by Pylint.
Line: 91
Column: 33
"""
def test_module_all_attribute(self):
self.assertTrue(hasattr(self.module, '__all__'))
target_api = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
self.assertSetEqual(set(self.module.__all__),
set(target_api))
Reported by Pylint.
Line: 91
Column: 9
"""
def test_module_all_attribute(self):
self.assertTrue(hasattr(self.module, '__all__'))
target_api = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
self.assertSetEqual(set(self.module.__all__),
set(target_api))
Reported by Pylint.
Line: 95
Column: 9
target_api = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
self.assertSetEqual(set(self.module.__all__),
set(target_api))
class CPublicAPITests(PublicAPITests, unittest.TestCase):
module = c_warnings
Reported by Pylint.
Line: 95
Column: 33
target_api = ["warn", "warn_explicit", "showwarning",
"formatwarning", "filterwarnings", "simplefilter",
"resetwarnings", "catch_warnings"]
self.assertSetEqual(set(self.module.__all__),
set(target_api))
class CPublicAPITests(PublicAPITests, unittest.TestCase):
module = c_warnings
Reported by Pylint.
Lib/test/test_codecs.py
575 issues
Line: 80
Column: 13
d = codecs.getincrementaldecoder(encoding)()
part1 = d.decode(s[:i])
state = d.getstate()
self.assertIsInstance(state[1], int)
# Check that the condition stated in the documentation for
# IncrementalDecoder.getstate() holds
if not state[1]:
# reset decoder to the default state without anything buffered
d.setstate((state[0][:0], 0))
Reported by Pylint.
Line: 87
Column: 17
# reset decoder to the default state without anything buffered
d.setstate((state[0][:0], 0))
# Feeding the previous input may not produce any output
self.assertTrue(not d.decode(state[0]))
# The decoder must return to the same state
self.assertEqual(state, d.getstate())
# Create a new decoder and set it to the state
# we extracted from the old one
d = codecs.getincrementaldecoder(encoding)()
Reported by Pylint.
Line: 89
Column: 17
# Feeding the previous input may not produce any output
self.assertTrue(not d.decode(state[0]))
# The decoder must return to the same state
self.assertEqual(state, d.getstate())
# Create a new decoder and set it to the state
# we extracted from the old one
d = codecs.getincrementaldecoder(encoding)()
d.setstate(state)
part2 = d.decode(s[i:], True)
Reported by Pylint.
Line: 95
Column: 13
d = codecs.getincrementaldecoder(encoding)()
d.setstate(state)
part2 = d.decode(s[i:], True)
self.assertEqual(u, part1+part2)
def check_state_handling_encode(self, encoding, u, s):
for i in range(len(u)+1):
d = codecs.getincrementalencoder(encoding)()
part1 = d.encode(u[:i])
Reported by Pylint.
Line: 105
Column: 13
d = codecs.getincrementalencoder(encoding)()
d.setstate(state)
part2 = d.encode(u[i:], True)
self.assertEqual(s, part1+part2)
class ReadTest(MixInCheckStateHandling):
def check_partial(self, input, partialresults):
# get a StreamReader for the encoding and feed the bytestring version
Reported by Pylint.
Line: 115
Column: 30
# the StreamReader and check that the results equal the appropriate
# entries from partialresults.
q = Queue(b"")
r = codecs.getreader(self.encoding)(q)
result = ""
for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
q.write(bytes([c]))
result += r.read()
self.assertEqual(result, partialresult)
Reported by Pylint.
Line: 117
Column: 52
q = Queue(b"")
r = codecs.getreader(self.encoding)(q)
result = ""
for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
q.write(bytes([c]))
result += r.read()
self.assertEqual(result, partialresult)
# check that there's nothing left in the buffers
self.assertEqual(r.read(), "")
Reported by Pylint.
Line: 120
Column: 13
for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
q.write(bytes([c]))
result += r.read()
self.assertEqual(result, partialresult)
# check that there's nothing left in the buffers
self.assertEqual(r.read(), "")
self.assertEqual(r.bytebuffer, b"")
# do the check again, this time using an incremental decoder
Reported by Pylint.
Line: 122
Column: 9
result += r.read()
self.assertEqual(result, partialresult)
# check that there's nothing left in the buffers
self.assertEqual(r.read(), "")
self.assertEqual(r.bytebuffer, b"")
# do the check again, this time using an incremental decoder
d = codecs.getincrementaldecoder(self.encoding)()
result = ""
Reported by Pylint.
Line: 123
Column: 9
self.assertEqual(result, partialresult)
# check that there's nothing left in the buffers
self.assertEqual(r.read(), "")
self.assertEqual(r.bytebuffer, b"")
# do the check again, this time using an incremental decoder
d = codecs.getincrementaldecoder(self.encoding)()
result = ""
for (c, partialresult) in zip(input.encode(self.encoding), partialresults):
Reported by Pylint.
Lib/test/test_builtin.py
568 issues
Line: 18
Column: 1
import random
import re
import sys
import traceback
import types
import unittest
import warnings
from contextlib import ExitStack
from functools import partial
Reported by Pylint.
Line: 24
Column: 1
import warnings
from contextlib import ExitStack
from functools import partial
from inspect import CO_COROUTINE
from itertools import product
from textwrap import dedent
from types import AsyncGeneratorType, FunctionType
from operator import neg
from test import support
Reported by Pylint.
Line: 444
Column: 29
# test we can create and advance a function type
globals_ = {'asyncio': asyncio, 'a': 0, 'arange': arange}
async_f = FunctionType(co, globals_)
asyncio.run(async_f())
self.assertEqual(globals_['a'], 1)
# test we can await-eval,
globals_ = {'asyncio': asyncio, 'a': 0, 'arange': arange}
asyncio.run(eval(co, globals_))
Reported by Pylint.
Line: 535
Column: 9
self.assertNotIn("__mro__", dir(str))
# dir(obj)
class Foo(object):
def __init__(self):
self.x = 7
self.y = 8
self.z = 9
f = Foo()
Reported by Pylint.
Line: 544
Column: 9
self.assertIn("y", dir(f))
# dir(obj_no__dict__)
class Foo(object):
__slots__ = []
f = Foo()
self.assertIn("__repr__", dir(f))
# dir(obj_no__class__with__dict__)
Reported by Pylint.
Line: 551
Column: 9
# dir(obj_no__class__with__dict__)
# (an ugly trick to cause getattr(f, "__class__") to fail)
class Foo(object):
__slots__ = ["__class__", "__dict__"]
def __init__(self):
self.bar = "wow"
f = Foo()
self.assertNotIn("__repr__", dir(f))
Reported by Pylint.
Line: 560
Column: 9
self.assertIn("bar", dir(f))
# dir(obj_using __dir__)
class Foo(object):
def __dir__(self):
return ["kan", "ga", "roo"]
f = Foo()
self.assertTrue(dir(f) == ["ga", "kan", "roo"])
Reported by Pylint.
Line: 567
Column: 9
self.assertTrue(dir(f) == ["ga", "kan", "roo"])
# dir(obj__dir__tuple)
class Foo(object):
def __dir__(self):
return ("b", "c", "a")
res = dir(Foo())
self.assertIsInstance(res, list)
self.assertTrue(res == ["a", "b", "c"])
Reported by Pylint.
Line: 575
Column: 9
self.assertTrue(res == ["a", "b", "c"])
# dir(obj__dir__not_sequence)
class Foo(object):
def __dir__(self):
return 7
f = Foo()
self.assertRaises(TypeError, dir, f)
Reported by Pylint.
Line: 845
Column: 13
return 2**100
self.assertEqual(type(hash(X())), int)
class Z(int):
def __hash__(self):
return self
self.assertEqual(hash(Z(42)), hash(42))
def test_hex(self):
self.assertEqual(hex(16), '0x10')
Reported by Pylint.
Lib/test/test_mailbox.py
565 issues
Line: 27
Column: 9
def _check_sample(self, msg):
# Inspect a mailbox.Message representation of the sample message
self.assertIsInstance(msg, email.message.Message)
self.assertIsInstance(msg, mailbox.Message)
for key, value in _sample_headers.items():
self.assertIn(value, msg.get_all(key))
self.assertTrue(msg.is_multipart())
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
Reported by Pylint.
Line: 28
Column: 9
def _check_sample(self, msg):
# Inspect a mailbox.Message representation of the sample message
self.assertIsInstance(msg, email.message.Message)
self.assertIsInstance(msg, mailbox.Message)
for key, value in _sample_headers.items():
self.assertIn(value, msg.get_all(key))
self.assertTrue(msg.is_multipart())
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
for i, payload in enumerate(_sample_payloads):
Reported by Pylint.
Line: 30
Column: 13
self.assertIsInstance(msg, email.message.Message)
self.assertIsInstance(msg, mailbox.Message)
for key, value in _sample_headers.items():
self.assertIn(value, msg.get_all(key))
self.assertTrue(msg.is_multipart())
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
for i, payload in enumerate(_sample_payloads):
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
Reported by Pylint.
Line: 31
Column: 9
self.assertIsInstance(msg, mailbox.Message)
for key, value in _sample_headers.items():
self.assertIn(value, msg.get_all(key))
self.assertTrue(msg.is_multipart())
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
for i, payload in enumerate(_sample_payloads):
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
self.assertNotIsInstance(part, mailbox.Message)
Reported by Pylint.
Line: 32
Column: 9
for key, value in _sample_headers.items():
self.assertIn(value, msg.get_all(key))
self.assertTrue(msg.is_multipart())
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
for i, payload in enumerate(_sample_payloads):
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
self.assertNotIsInstance(part, mailbox.Message)
self.assertEqual(part.get_payload(), payload)
Reported by Pylint.
Line: 35
Column: 13
self.assertEqual(len(msg.get_payload()), len(_sample_payloads))
for i, payload in enumerate(_sample_payloads):
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
self.assertNotIsInstance(part, mailbox.Message)
self.assertEqual(part.get_payload(), payload)
def _delete_recursively(self, target):
# Delete a file or delete a directory recursively
Reported by Pylint.
Line: 36
Column: 13
for i, payload in enumerate(_sample_payloads):
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
self.assertNotIsInstance(part, mailbox.Message)
self.assertEqual(part.get_payload(), payload)
def _delete_recursively(self, target):
# Delete a file or delete a directory recursively
if os.path.isdir(target):
Reported by Pylint.
Line: 37
Column: 13
part = msg.get_payload(i)
self.assertIsInstance(part, email.message.Message)
self.assertNotIsInstance(part, mailbox.Message)
self.assertEqual(part.get_payload(), payload)
def _delete_recursively(self, target):
# Delete a file or delete a directory recursively
if os.path.isdir(target):
os_helper.rmtree(target)
Reported by Pylint.
Line: 57
Column: 21
def setUp(self):
self._path = os_helper.TESTFN
self._delete_recursively(self._path)
self._box = self._factory(self._path)
def tearDown(self):
self._box.close()
self._delete_recursively(self._path)
Reported by Pylint.
Line: 67
Column: 9
# Add copies of a sample message
keys = []
keys.append(self._box.add(self._template % 0))
self.assertEqual(len(self._box), 1)
keys.append(self._box.add(mailbox.Message(_sample_message)))
self.assertEqual(len(self._box), 2)
keys.append(self._box.add(email.message_from_string(_sample_message)))
self.assertEqual(len(self._box), 3)
keys.append(self._box.add(io.BytesIO(_bytes_sample_message)))
Reported by Pylint.
Lib/test/test_ast.py
562 issues
Line: 287
Column: 13
self.assertEqual(x.__dict__["foobar"], 42)
with self.assertRaises(AttributeError):
x.vararg
with self.assertRaises(TypeError):
# "ast.AST constructor takes 0 positional arguments"
ast.AST(2)
Reported by Pylint.
Line: 384
Column: 13
'kw_defaults', 'kwarg', 'defaults'))
with self.assertRaises(AttributeError):
x.args
self.assertIsNone(x.vararg)
x = ast.arguments(*range(1, 8))
self.assertEqual(x.args, 2)
self.assertEqual(x.vararg, 3)
Reported by Pylint.
Line: 385
Column: 27
with self.assertRaises(AttributeError):
x.args
self.assertIsNone(x.vararg)
x = ast.arguments(*range(1, 8))
self.assertEqual(x.args, 2)
self.assertEqual(x.vararg, 3)
Reported by Pylint.
Line: 388
Column: 26
self.assertIsNone(x.vararg)
x = ast.arguments(*range(1, 8))
self.assertEqual(x.args, 2)
self.assertEqual(x.vararg, 3)
def test_field_attr_writable(self):
x = ast.Num()
# We can assign to _fields
Reported by Pylint.
Line: 389
Column: 26
x = ast.arguments(*range(1, 8))
self.assertEqual(x.args, 2)
self.assertEqual(x.vararg, 3)
def test_field_attr_writable(self):
x = ast.Num()
# We can assign to _fields
x._fields = 666
Reported by Pylint.
Line: 402
Column: 13
self.assertEqual(x._fields, ('value', 'kind'))
with self.assertRaises(AttributeError):
x.value
with self.assertRaises(AttributeError):
x.n
x = ast.Num(42)
Reported by Pylint.
Line: 408
Column: 26
x.n
x = ast.Num(42)
self.assertEqual(x.value, 42)
self.assertEqual(x.n, 42)
with self.assertRaises(AttributeError):
x.lineno
Reported by Pylint.
Line: 412
Column: 13
self.assertEqual(x.n, 42)
with self.assertRaises(AttributeError):
x.lineno
with self.assertRaises(AttributeError):
x.foobar
x = ast.Num(lineno=2)
Reported by Pylint.
Line: 418
Column: 26
x.foobar
x = ast.Num(lineno=2)
self.assertEqual(x.lineno, 2)
x = ast.Num(42, lineno=0)
self.assertEqual(x.lineno, 0)
self.assertEqual(x._fields, ('value', 'kind'))
self.assertEqual(x.value, 42)
Reported by Pylint.
Line: 421
Column: 26
self.assertEqual(x.lineno, 2)
x = ast.Num(42, lineno=0)
self.assertEqual(x.lineno, 0)
self.assertEqual(x._fields, ('value', 'kind'))
self.assertEqual(x.value, 42)
self.assertEqual(x.n, 42)
self.assertRaises(TypeError, ast.Num, 1, None, 2)
Reported by Pylint.
Lib/xml/dom/minidom.py
541 issues
Line: 58
Column: 12
encoding=encoding,
errors="xmlcharrefreplace",
newline='\n')
if self.nodeType == Node.DOCUMENT_NODE:
# Can pass encoding only to document, to put it into XML header
self.writexml(writer, "", indent, newl, encoding, standalone)
else:
self.writexml(writer, "", indent, newl)
if encoding is None:
Reported by Pylint.
Line: 60
Column: 13
newline='\n')
if self.nodeType == Node.DOCUMENT_NODE:
# Can pass encoding only to document, to put it into XML header
self.writexml(writer, "", indent, newl, encoding, standalone)
else:
self.writexml(writer, "", indent, newl)
if encoding is None:
return writer.getvalue()
else:
Reported by Pylint.
Line: 62
Column: 13
# Can pass encoding only to document, to put it into XML header
self.writexml(writer, "", indent, newl, encoding, standalone)
else:
self.writexml(writer, "", indent, newl)
if encoding is None:
return writer.getvalue()
else:
return writer.detach().getvalue()
Reported by Pylint.
Line: 88
Column: 37
self.insertBefore(c, refChild)
### The DOM does not clearly specify what to return in this case
return newChild
if newChild.nodeType not in self._child_node_types:
raise xml.dom.HierarchyRequestErr(
"%s cannot be child of %s" % (repr(newChild), repr(self)))
if newChild.parentNode is not None:
newChild.parentNode.removeChild(newChild)
if refChild is None:
Reported by Pylint.
Line: 120
Column: 33
self.appendChild(c)
### The DOM does not clearly specify what to return in this case
return node
if node.nodeType not in self._child_node_types:
raise xml.dom.HierarchyRequestErr(
"%s cannot be child of %s" % (repr(node), repr(self)))
elif node.nodeType in _nodeTypes_with_children:
_clear_id_cache(self)
if node.parentNode is not None:
Reported by Pylint.
Line: 136
Column: 37
refChild = oldChild.nextSibling
self.removeChild(oldChild)
return self.insertBefore(newChild, refChild)
if newChild.nodeType not in self._child_node_types:
raise xml.dom.HierarchyRequestErr(
"%s cannot be child of %s" % (repr(newChild), repr(self)))
if newChild is oldChild:
return
if newChild.parentNode is not None:
Reported by Pylint.
Line: 265
Column: 12
def unlink(self):
self.parentNode = self.ownerDocument = None
if self.childNodes:
for child in self.childNodes:
child.unlink()
self.childNodes = NodeList()
self.previousSibling = None
self.nextSibling = None
Reported by Pylint.
Line: 266
Column: 26
def unlink(self):
self.parentNode = self.ownerDocument = None
if self.childNodes:
for child in self.childNodes:
child.unlink()
self.childNodes = NodeList()
self.previousSibling = None
self.nextSibling = None
Reported by Pylint.
Line: 410
Column: 23
"illegal use of 'xmlns' prefix for the wrong namespace")
self._prefix = prefix
if prefix is None:
newName = self.localName
else:
newName = "%s:%s" % (prefix, self.localName)
if self.ownerElement:
_clear_id_cache(self.ownerElement)
self.name = newName
Reported by Pylint.
Line: 412
Column: 42
if prefix is None:
newName = self.localName
else:
newName = "%s:%s" % (prefix, self.localName)
if self.ownerElement:
_clear_id_cache(self.ownerElement)
self.name = newName
prefix = property(_get_prefix, _set_prefix)
Reported by Pylint.
Lib/test/test_dict.py
536 issues
Line: 62
Column: 23
self.assertEqual(c, {0: 0, 1: 1, 2: 2, 3: 3})
self.assertIs(a.__or__(None), NotImplemented)
self.assertIs(a.__or__(()), NotImplemented)
self.assertIs(a.__or__("BAD"), NotImplemented)
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
Reported by Pylint.
Line: 63
Column: 23
self.assertEqual(c, {0: 0, 1: 1, 2: 2, 3: 3})
self.assertIs(a.__or__(None), NotImplemented)
self.assertIs(a.__or__(()), NotImplemented)
self.assertIs(a.__or__("BAD"), NotImplemented)
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
Reported by Pylint.
Line: 64
Column: 23
self.assertIs(a.__or__(None), NotImplemented)
self.assertIs(a.__or__(()), NotImplemented)
self.assertIs(a.__or__("BAD"), NotImplemented)
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
Reported by Pylint.
Line: 65
Column: 23
self.assertIs(a.__or__(None), NotImplemented)
self.assertIs(a.__or__(()), NotImplemented)
self.assertIs(a.__or__("BAD"), NotImplemented)
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
self.assertEqual(a.__ior__(""), {0: 0, 1: 1, 2: 1})
Reported by Pylint.
Line: 67
Column: 38
self.assertIs(a.__or__("BAD"), NotImplemented)
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
self.assertEqual(a.__ior__(""), {0: 0, 1: 1, 2: 1})
def test_bool(self):
Reported by Pylint.
Line: 68
Column: 26
self.assertIs(a.__or__(""), NotImplemented)
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
self.assertEqual(a.__ior__(""), {0: 0, 1: 1, 2: 1})
def test_bool(self):
self.assertIs(not {}, True)
Reported by Pylint.
Line: 69
Column: 39
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
self.assertEqual(a.__ior__(""), {0: 0, 1: 1, 2: 1})
def test_bool(self):
self.assertIs(not {}, True)
self.assertTrue({1: 2})
Reported by Pylint.
Line: 70
Column: 26
self.assertRaises(TypeError, a.__ior__, None)
self.assertEqual(a.__ior__(()), {0: 0, 1: 1, 2: 1})
self.assertRaises(ValueError, a.__ior__, "BAD")
self.assertEqual(a.__ior__(""), {0: 0, 1: 1, 2: 1})
def test_bool(self):
self.assertIs(not {}, True)
self.assertTrue({1: 2})
self.assertIs(bool({}), False)
Reported by Pylint.
Line: 222
Column: 9
raise Exc
self.assertRaises(Exc, d.update, FailingUserDict())
class FailingUserDict:
def keys(self):
class BogonIter:
def __init__(self):
self.i = 1
def __iter__(self):
Reported by Pylint.
Line: 239
Column: 9
return key
self.assertRaises(Exc, d.update, FailingUserDict())
class FailingUserDict:
def keys(self):
class BogonIter:
def __init__(self):
self.i = ord('a')
def __iter__(self):
Reported by Pylint.
Lib/test/test_asyncio/test_selector_events.py
534 issues
Line: 32
Column: 9
def _make_self_pipe(self):
self._ssock = mock.Mock()
self._csock = mock.Mock()
self._internal_fds += 1
def _close_self_pipe(self):
pass
Reported by Pylint.
Line: 127
Column: 17
def _make_self_pipe(self):
self._ssock = mock.Mock()
self._csock = mock.Mock()
self._internal_fds += 1
self.loop = EventLoop(self.selector)
self.set_event_loop(self.loop)
ssock = self.loop._ssock
Reported by Pylint.
Line: 427
Column: 26
self.assertFalse(self.loop.readers)
test_utils.run_briefly(self.loop)
self.assertFalse(self.protocol.connection_lost.called)
def test_force_close(self):
tr = self.create_transport()
tr._buffer.extend(b'1')
self.loop._add_reader(7, mock.sentinel)
Reported by Pylint.
Line: 480
Column: 9
self.assertIsNotNone(tr._loop)
tr._call_connection_lost(exc)
self.protocol.connection_lost.assert_called_with(exc)
self.sock.close.assert_called_with()
self.assertIsNone(tr._sock)
self.assertIsNone(tr._protocol)
self.assertIsNone(tr._loop)
Reported by Pylint.
Line: 525
Column: 9
self.loop.assert_reader(7, tr._read_ready)
test_utils.run_briefly(self.loop)
self.protocol.connection_made.assert_called_with(tr)
def test_ctor_with_waiter(self):
waiter = self.loop.create_future()
self.socket_transport(waiter=waiter)
self.loop.run_until_complete(waiter)
Reported by Pylint.
Line: 564
Column: 9
self.loop.call_exception_handler = mock.Mock()
self.protocol.eof_received.side_effect = LookupError()
self.sock.recv.return_value = b''
transport._read_ready()
self.protocol.eof_received.assert_called_with()
Reported by Pylint.
Line: 569
Column: 9
self.sock.recv.return_value = b''
transport._read_ready()
self.protocol.eof_received.assert_called_with()
self.assertTrue(transport._fatal_error.called)
def test_data_received_error(self):
transport = self.socket_transport()
transport._fatal_error = mock.Mock()
Reported by Pylint.
Line: 577
Column: 9
transport._fatal_error = mock.Mock()
self.loop.call_exception_handler = mock.Mock()
self.protocol.data_received.side_effect = LookupError()
self.sock.recv.return_value = b'data'
transport._read_ready()
self.assertTrue(transport._fatal_error.called)
Reported by Pylint.
Line: 583
Column: 25
transport._read_ready()
self.assertTrue(transport._fatal_error.called)
self.assertTrue(self.protocol.data_received.called)
def test_read_ready(self):
transport = self.socket_transport()
self.sock.recv.return_value = b'data'
Reported by Pylint.
Line: 591
Column: 9
self.sock.recv.return_value = b'data'
transport._read_ready()
self.protocol.data_received.assert_called_with(b'data')
def test_read_ready_eof(self):
transport = self.socket_transport()
transport.close = mock.Mock()
Reported by Pylint.
Lib/test/test_operator.py
518 issues
Line: 49
Column: 20
class OperatorTestCase:
def test_lt(self):
operator = self.module
self.assertRaises(TypeError, operator.lt)
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
Reported by Pylint.
Line: 50
Column: 9
class OperatorTestCase:
def test_lt(self):
operator = self.module
self.assertRaises(TypeError, operator.lt)
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
Reported by Pylint.
Line: 51
Column: 9
def test_lt(self):
operator = self.module
self.assertRaises(TypeError, operator.lt)
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
Reported by Pylint.
Line: 52
Column: 9
operator = self.module
self.assertRaises(TypeError, operator.lt)
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
Reported by Pylint.
Line: 53
Column: 9
self.assertRaises(TypeError, operator.lt)
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
Reported by Pylint.
Line: 54
Column: 9
self.assertRaises(TypeError, operator.lt, 1j, 2j)
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
def test_le(self):
Reported by Pylint.
Line: 55
Column: 9
self.assertFalse(operator.lt(1, 0))
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
def test_le(self):
operator = self.module
Reported by Pylint.
Line: 56
Column: 9
self.assertFalse(operator.lt(1, 0.0))
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
def test_le(self):
operator = self.module
self.assertRaises(TypeError, operator.le)
Reported by Pylint.
Line: 57
Column: 9
self.assertFalse(operator.lt(1, 1))
self.assertFalse(operator.lt(1, 1.0))
self.assertTrue(operator.lt(1, 2))
self.assertTrue(operator.lt(1, 2.0))
def test_le(self):
operator = self.module
self.assertRaises(TypeError, operator.le)
self.assertRaises(TypeError, operator.le, 1j, 2j)
Reported by Pylint.
Line: 60
Column: 20
self.assertTrue(operator.lt(1, 2.0))
def test_le(self):
operator = self.module
self.assertRaises(TypeError, operator.le)
self.assertRaises(TypeError, operator.le, 1j, 2j)
self.assertFalse(operator.le(1, 0))
self.assertFalse(operator.le(1, 0.0))
self.assertTrue(operator.le(1, 1))
Reported by Pylint.