The following issues were found
Lib/test/test_timeit.py
90 issues
Line: 16
Column: 3
# timeit's default number of repetitions.
DEFAULT_REPEAT = 5
# XXX: some tests are commented out that would improve the coverage but take a
# long time to run because they test the default number of loops, which is
# large. The tests could be enabled if there was a way to override the default
# number of loops during testing, but this would require changing the signature
# of some functions that use the default as a default argument.
Reported by Pylint.
Line: 41
Column: 9
def wrap_timer(self, timer):
"""Records 'timer' and returns self as callable timer."""
self.saved_timer = timer
return self
class TestTimeit(unittest.TestCase):
def tearDown(self):
Reported by Pylint.
Line: 108
Column: 48
def fake_callable_stmt(self):
self.fake_timer.inc()
def timeit(self, stmt, setup, number=None, globals=None):
self.fake_timer = FakeTimer()
t = timeit.Timer(stmt=stmt, setup=setup, timer=self.fake_timer,
globals=globals)
kwargs = {}
if number is None:
Reported by Pylint.
Line: 109
Column: 9
self.fake_timer.inc()
def timeit(self, stmt, setup, number=None, globals=None):
self.fake_timer = FakeTimer()
t = timeit.Timer(stmt=stmt, setup=setup, timer=self.fake_timer,
globals=globals)
kwargs = {}
if number is None:
number = DEFAULT_NUMBER
Reported by Pylint.
Line: 154
Column: 9
self.assertEqual(delta_time, 0)
def test_timeit_globals_args(self):
global _global_timer
_global_timer = FakeTimer()
t = timeit.Timer(stmt='_global_timer.inc()', timer=_global_timer)
self.assertRaises(NameError, t.timeit, number=3)
timeit.timeit(stmt='_global_timer.inc()', timer=_global_timer,
globals=globals(), number=3)
Reported by Pylint.
Line: 165
Column: 9
globals=locals(), number=3)
def repeat(self, stmt, setup, repeat=None, number=None):
self.fake_timer = FakeTimer()
t = timeit.Timer(stmt=stmt, setup=setup, timer=self.fake_timer)
kwargs = {}
if repeat is None:
repeat = DEFAULT_REPEAT
else:
Reported by Pylint.
Line: 233
Column: 9
t = timeit.Timer("1/0")
try:
t.timeit()
except:
t.print_exc(s)
self.assert_exc_string(s.getvalue(), 'ZeroDivisionError')
MAIN_DEFAULT_OUTPUT = "1 loop, best of 5: 1 sec per loop\n"
Reported by Pylint.
Line: 351
Column: 13
"100 loops, best of 5: 3e+03 usec per loop\n")
# Test invalid unit input
with captured_stderr() as error_stringio:
invalid = self.run_main(seconds_per_increment=0.003,
switches=['-u', 'parsec'])
self.assertEqual(error_stringio.getvalue(),
"Unrecognized unit. Please select nsec, usec, msec, or sec.\n")
def test_main_exception(self):
Reported by Pylint.
Line: 358
Column: 13
def test_main_exception(self):
with captured_stderr() as error_stringio:
s = self.run_main(switches=['1/0'])
self.assert_exc_string(error_stringio.getvalue(), 'ZeroDivisionError')
def test_main_exception_fixed_reps(self):
with captured_stderr() as error_stringio:
s = self.run_main(switches=['-n1', '1/0'])
Reported by Pylint.
Line: 363
Column: 13
def test_main_exception_fixed_reps(self):
with captured_stderr() as error_stringio:
s = self.run_main(switches=['-n1', '1/0'])
self.assert_exc_string(error_stringio.getvalue(), 'ZeroDivisionError')
def autorange(self, seconds_per_increment=1/1024, callback=None):
timer = FakeTimer(seconds_per_increment=seconds_per_increment)
t = timeit.Timer(stmt=self.fake_stmt, setup=self.fake_setup, timer=timer)
Reported by Pylint.
Lib/email/headerregistry.py
90 issues
Line: 192
Column: 9
def __new__(cls, name, value):
kwds = {'defects': []}
cls.parse(value, kwds)
if utils._has_surrogates(kwds['decoded']):
kwds['decoded'] = utils._sanitize(kwds['decoded'])
self = str.__new__(cls, kwds['decoded'])
del kwds['decoded']
self.init(name, **kwds)
Reported by Pylint.
Line: 315
Column: 9
def init(self, *args, **kw):
self._datetime = kw.pop('datetime')
super().init(*args, **kw)
@property
def datetime(self):
return self._datetime
Reported by Pylint.
Line: 368
Column: 9
def init(self, *args, **kw):
self._groups = tuple(kw.pop('groups'))
self._addresses = None
super().init(*args, **kw)
@property
def groups(self):
return self._groups
Reported by Pylint.
Line: 393
Column: 44
def address(self):
if len(self.addresses)!=1:
raise ValueError(("value of single address header {} is not "
"a single address").format(self.name))
return self.addresses[0]
class UniqueSingleAddressHeader(SingleAddressHeader):
Reported by Pylint.
Line: 424
Column: 9
self._version = kw.pop('version')
self._major = kw.pop('major')
self._minor = kw.pop('minor')
super().init(*args, **kw)
@property
def major(self):
return self._major
Reported by Pylint.
Line: 448
Column: 43
@classmethod
def parse(cls, value, kwds):
kwds['parse_tree'] = parse_tree = cls.value_parser(value)
kwds['decoded'] = str(parse_tree)
kwds['defects'].extend(parse_tree.all_defects)
if parse_tree.params is None:
kwds['params'] = {}
else:
Reported by Pylint.
Line: 461
Column: 9
def init(self, *args, **kw):
self._params = kw.pop('params')
super().init(*args, **kw)
@property
def params(self):
return MappingProxyType(self._params)
Reported by Pylint.
Line: 474
Column: 42
def init(self, *args, **kw):
super().init(*args, **kw)
self._maintype = utils._sanitize(self._parse_tree.maintype)
self._subtype = utils._sanitize(self._parse_tree.subtype)
@property
def maintype(self):
return self._maintype
Reported by Pylint.
Line: 475
Column: 41
def init(self, *args, **kw):
super().init(*args, **kw)
self._maintype = utils._sanitize(self._parse_tree.maintype)
self._subtype = utils._sanitize(self._parse_tree.subtype)
@property
def maintype(self):
return self._maintype
Reported by Pylint.
Line: 496
Column: 14
def init(self, *args, **kw):
super().init(*args, **kw)
cd = self._parse_tree.content_disposition
self._content_disposition = cd if cd is None else utils._sanitize(cd)
@property
def content_disposition(self):
return self._content_disposition
Reported by Pylint.
Lib/ctypes/test/test_array_in_pointer.py
90 issues
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Line: 2
Column: 1
import unittest
from ctypes import *
from binascii import hexlify
import re
def dump(obj):
# helper function to dump memory contents in hex, with a hyphen
# between the bytes.
h = hexlify(memoryview(obj)).decode()
Reported by Pylint.
Lib/ctypes/_endian.py
90 issues
Line: 46
Column: 5
LittleEndianStructure = Structure
class BigEndianStructure(Structure, metaclass=_swapped_meta):
"""Structure with big endian byte order"""
__slots__ = ()
_swappedbytes_ = None
elif sys.byteorder == "big":
Reported by Pylint.
Line: 55
Column: 5
_OTHER_ENDIAN = "__ctype_le__"
BigEndianStructure = Structure
class LittleEndianStructure(Structure, metaclass=_swapped_meta):
"""Structure with little endian byte order"""
__slots__ = ()
_swappedbytes_ = None
else:
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Line: 2
Column: 1
import sys
from ctypes import *
_array_type = type(Array)
def _other_endian(typ):
"""Return the type with the 'other' byte order. Simple types like
c_int and so on already have __ctype_be__ and __ctype_le__
attributes which contain the types, for more complicated types
Reported by Pylint.
Lib/test/test_json/test_decode.py
89 issues
Line: 9
Column: 16
class TestDecode:
def test_decimal(self):
rval = self.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
rval = self.loads('1', parse_int=float)
Reported by Pylint.
Line: 10
Column: 9
class TestDecode:
def test_decimal(self):
rval = self.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
Reported by Pylint.
Line: 11
Column: 9
def test_decimal(self):
rval = self.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
self.assertEqual(rval, 1.0)
Reported by Pylint.
Line: 14
Column: 16
self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
Reported by Pylint.
Line: 15
Column: 9
def test_float(self):
rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
Reported by Pylint.
Line: 16
Column: 9
def test_float(self):
rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
self.assertEqual(self.loads('""'), "")
Reported by Pylint.
Line: 19
Column: 9
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
self.assertEqual(self.loads('""'), "")
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
Reported by Pylint.
Line: 19
Column: 26
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
self.assertEqual(self.loads('""'), "")
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
Reported by Pylint.
Line: 20
Column: 26
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
self.assertEqual(self.loads('""'), "")
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
Reported by Pylint.
Line: 20
Column: 9
def test_empty_objects(self):
self.assertEqual(self.loads('{}'), {})
self.assertEqual(self.loads('[]'), [])
self.assertEqual(self.loads('""'), "")
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
Reported by Pylint.
Lib/tkinter/test/test_tkinter/test_misc.py
89 issues
Line: 33
Column: 9
def test_generated_names(self):
t = tkinter.Toplevel(self.root)
f = tkinter.Frame(t)
f2 = tkinter.Frame(t)
b = tkinter.Button(f2)
for name in str(b).split('.'):
self.assertFalse(name.isidentifier(), msg=repr(name))
Reported by Pylint.
Line: 313
Column: 9
Activate = '36'
Deactivate = '37'
MouseWheel = '38'
enum._test_simple_enum(CheckedEventType, tkinter.EventType)
def test_getboolean(self):
for v in 'true', 'yes', 'on', '1', 't', 'y', 1, True:
self.assertIs(self.root.getboolean(v), True)
for v in 'false', 'no', 'off', '0', 'f', 'n', 0, False:
Reported by Pylint.
Line: 341
Column: 23
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
def test_default_root(self):
self.assertIs(tkinter._support_default_root, True)
self.assertIsNone(tkinter._default_root)
root = tkinter.Tk()
root2 = tkinter.Tk()
root3 = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
Reported by Pylint.
Line: 342
Column: 27
def test_default_root(self):
self.assertIs(tkinter._support_default_root, True)
self.assertIsNone(tkinter._default_root)
root = tkinter.Tk()
root2 = tkinter.Tk()
root3 = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
root2.destroy()
Reported by Pylint.
Line: 346
Column: 23
root = tkinter.Tk()
root2 = tkinter.Tk()
root3 = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
root2.destroy()
self.assertIs(tkinter._default_root, root)
root.destroy()
self.assertIsNone(tkinter._default_root)
root3.destroy()
Reported by Pylint.
Line: 348
Column: 23
root3 = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
root2.destroy()
self.assertIs(tkinter._default_root, root)
root.destroy()
self.assertIsNone(tkinter._default_root)
root3.destroy()
self.assertIsNone(tkinter._default_root)
Reported by Pylint.
Line: 350
Column: 27
root2.destroy()
self.assertIs(tkinter._default_root, root)
root.destroy()
self.assertIsNone(tkinter._default_root)
root3.destroy()
self.assertIsNone(tkinter._default_root)
def test_no_default_root(self):
self.assertIs(tkinter._support_default_root, True)
Reported by Pylint.
Line: 352
Column: 27
root.destroy()
self.assertIsNone(tkinter._default_root)
root3.destroy()
self.assertIsNone(tkinter._default_root)
def test_no_default_root(self):
self.assertIs(tkinter._support_default_root, True)
self.assertIsNone(tkinter._default_root)
root = tkinter.Tk()
Reported by Pylint.
Line: 355
Column: 23
self.assertIsNone(tkinter._default_root)
def test_no_default_root(self):
self.assertIs(tkinter._support_default_root, True)
self.assertIsNone(tkinter._default_root)
root = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
tkinter.NoDefaultRoot()
self.assertIs(tkinter._support_default_root, False)
Reported by Pylint.
Line: 356
Column: 27
def test_no_default_root(self):
self.assertIs(tkinter._support_default_root, True)
self.assertIsNone(tkinter._default_root)
root = tkinter.Tk()
self.assertIs(tkinter._default_root, root)
tkinter.NoDefaultRoot()
self.assertIs(tkinter._support_default_root, False)
self.assertFalse(hasattr(tkinter, '_default_root'))
Reported by Pylint.
Lib/gettext.py
89 issues
Line: 37
Column: 3
#
# J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs.
#
# TODO:
# - Lazy loading of .mo files. Currently the entire catalog is loaded into
# memory, but that's probably bad for large translated programs. Instead,
# the lexical sort of original strings in GNU .mo files should be exploited
# to do binary searches and lazy initializations. Or you might want to use
# the undocumented double-hash algorithm for .mo files with hash tables, but
Reported by Pylint.
Line: 169
Column: 9
def _as_int(n):
try:
i = round(n)
except TypeError:
raise TypeError('Plural value must be an integer, got %s' %
(n.__class__.__name__,)) from None
import warnings
warnings.warn('Plural value must be an integer, got %s' %
Reported by Pylint.
Line: 204
Column: 9
depth -= 1
ns = {'_as_int': _as_int}
exec('''if True:
def func(n):
if not isinstance(n, int):
n = _as_int(n)
return int(%s)
''' % result, ns)
Reported by Pylint.
Line: 204
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
depth -= 1
ns = {'_as_int': _as_int}
exec('''if True:
def func(n):
if not isinstance(n, int):
n = _as_int(n)
return int(%s)
''' % result, ns)
Reported by Bandit.
Line: 213
Column: 9
return ns['func']
except RecursionError:
# Recursion error can be raised in _parse() or exec().
raise ValueError('plural form expression is too complex')
def _expand_lang(loc):
import locale
loc = locale.normalize(loc)
Reported by Pylint.
Line: 355
Column: 24
else:
raise OSError(0, 'Bad magic number', filename)
major_version, minor_version = self._get_versions(version)
if major_version not in self.VERSIONS:
raise OSError(0, 'Bad version number ' + str(major_version), filename)
# Now put all messages from the .mo file buffer into the catalog
Reported by Pylint.
Line: 410
Column: 25
charset = self._charset or 'ascii'
if b'\x00' in msg:
# Plural forms
msgid1, msgid2 = msg.split(b'\x00')
tmsg = tmsg.split(b'\x00')
msgid1 = str(msgid1, charset)
for i, x in enumerate(tmsg):
catalog[(msgid1, i)] = str(x, charset)
else:
Reported by Pylint.
Line: 413
Column: 17
msgid1, msgid2 = msg.split(b'\x00')
tmsg = tmsg.split(b'\x00')
msgid1 = str(msgid1, charset)
for i, x in enumerate(tmsg):
catalog[(msgid1, i)] = str(x, charset)
else:
catalog[str(msg, charset)] = str(tmsg, charset)
# advance to next entry in the seek tables
masteridx += 8
Reported by Pylint.
Line: 467
Column: 50
# Locate a .mo file using the gettext strategy
def find(domain, localedir=None, languages=None, all=False):
# Get some reasonable defaults for arguments that were not supplied
if localedir is None:
localedir = _default_localedir
if languages is None:
languages = []
Reported by Pylint.
Line: 553
Column: 5
def textdomain(domain=None):
global _current_domain
if domain is not None:
_current_domain = domain
return _current_domain
Reported by Pylint.
Lib/sqlite3/test/types.py
89 issues
Line: 108
Column: 37
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
@support.bigmemtest(size=2**31, memuse=4, dry_run=False)
def test_too_large_string(self, maxsize):
with self.assertRaises(sqlite.InterfaceError):
self.cur.execute("insert into test(s) values (?)", ('x'*(2**31-1),))
with self.assertRaises(OverflowError):
self.cur.execute("insert into test(s) values (?)", ('x'*(2**31),))
self.cur.execute("select 1 from test")
Reported by Pylint.
Line: 119
Column: 35
@unittest.skipUnless(sys.maxsize > 2**32, 'requires 64bit platform')
@support.bigmemtest(size=2**31, memuse=3, dry_run=False)
def test_too_large_blob(self, maxsize):
with self.assertRaises(sqlite.InterfaceError):
self.cur.execute("insert into test(s) values (?)", (b'x'*(2**31-1),))
with self.assertRaises(OverflowError):
self.cur.execute("insert into test(s) values (?)", (b'x'*(2**31),))
self.cur.execute("select 1 from test")
Reported by Pylint.
Line: 417
Column: 9
self.con = sqlite.connect(":memory:")
try:
del sqlite.adapters[int]
except:
pass
sqlite.register_adapter(int, ObjectAdaptationTests.cast)
self.cur = self.con.cursor()
def tearDown(self):
Reported by Pylint.
Line: 1
Column: 1
# pysqlite2/test/types.py: tests for type conversion and detection
#
# Copyright (C) 2005 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
Reported by Pylint.
Line: 35
Column: 1
from test import support
class SqliteTypeTests(unittest.TestCase):
def setUp(self):
self.con = sqlite.connect(":memory:")
self.cur = self.con.cursor()
self.cur.execute("create table test(i integer, s varchar, f number, b blob)")
Reported by Pylint.
Line: 45
Column: 5
self.cur.close()
self.con.close()
def test_string(self):
self.cur.execute("insert into test(s) values (?)", ("Österreich",))
self.cur.execute("select s from test")
row = self.cur.fetchone()
self.assertEqual(row[0], "Österreich")
Reported by Pylint.
Line: 51
Column: 5
row = self.cur.fetchone()
self.assertEqual(row[0], "Österreich")
def test_string_with_null_character(self):
self.cur.execute("insert into test(s) values (?)", ("a\0b",))
self.cur.execute("select s from test")
row = self.cur.fetchone()
self.assertEqual(row[0], "a\0b")
Reported by Pylint.
Line: 57
Column: 5
row = self.cur.fetchone()
self.assertEqual(row[0], "a\0b")
def test_small_int(self):
self.cur.execute("insert into test(i) values (?)", (42,))
self.cur.execute("select i from test")
row = self.cur.fetchone()
self.assertEqual(row[0], 42)
Reported by Pylint.
Line: 63
Column: 5
row = self.cur.fetchone()
self.assertEqual(row[0], 42)
def test_large_int(self):
num = 123456789123456789
self.cur.execute("insert into test(i) values (?)", (num,))
self.cur.execute("select i from test")
row = self.cur.fetchone()
self.assertEqual(row[0], num)
Reported by Pylint.
Line: 70
Column: 5
row = self.cur.fetchone()
self.assertEqual(row[0], num)
def test_float(self):
val = 3.14
self.cur.execute("insert into test(f) values (?)", (val,))
self.cur.execute("select f from test")
row = self.cur.fetchone()
self.assertEqual(row[0], val)
Reported by Pylint.
Lib/test/test_textwrap.py
88 issues
Line: 40
Column: 18
self.check(result, expect)
def check_split(self, text, expect):
result = self.wrapper._split(text)
self.assertEqual(result, expect,
"\nexpected %r\n"
"but got %r" % (expect, result))
Reported by Pylint.
Line: 40
Column: 18
self.check(result, expect)
def check_split(self, text, expect):
result = self.wrapper._split(text)
self.assertEqual(result, expect,
"\nexpected %r\n"
"but got %r" % (expect, result))
Reported by Pylint.
Line: 420
Column: 18
text = "Hello there -- you goof-ball, use the -b option!"
result = self.wrapper._split(text)
self.check(result,
["Hello", " ", "there", " ", "--", " ", "you", " ", "goof-",
"ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"])
def test_break_on_hyphens(self):
Reported by Pylint.
Line: 1
Column: 1
#
# Test suite for the textwrap module.
#
# Original tests written by Greg Ward <gward@python.net>.
# Converted to PyUnit by Peter Hansen <peter@engcorp.com>.
# Currently maintained by Greg Ward.
#
# $Id$
#
Reported by Pylint.
Line: 1
Column: 1
#
# Test suite for the textwrap module.
#
# Original tests written by Greg Ward <gward@python.net>.
# Converted to PyUnit by Peter Hansen <peter@engcorp.com>.
# Currently maintained by Greg Ward.
#
# $Id$
#
Reported by Pylint.
Line: 19
Column: 5
class BaseTestCase(unittest.TestCase):
'''Parent class with utility methods for textwrap tests.'''
def show(self, textin):
if isinstance(textin, list):
result = []
for i in range(len(textin)):
result.append(" %d: %r" % (i, textin[i]))
result = "\n".join(result) if result else " no lines"
Reported by Pylint.
Line: 19
Column: 5
class BaseTestCase(unittest.TestCase):
'''Parent class with utility methods for textwrap tests.'''
def show(self, textin):
if isinstance(textin, list):
result = []
for i in range(len(textin)):
result.append(" %d: %r" % (i, textin[i]))
result = "\n".join(result) if result else " no lines"
Reported by Pylint.
Line: 22
Column: 13
def show(self, textin):
if isinstance(textin, list):
result = []
for i in range(len(textin)):
result.append(" %d: %r" % (i, textin[i]))
result = "\n".join(result) if result else " no lines"
elif isinstance(textin, str):
result = " %s\n" % repr(textin)
return result
Reported by Pylint.
Line: 30
Column: 5
return result
def check(self, result, expect):
self.assertEqual(result, expect,
'expected:\n%s\nbut got:\n%s' % (
self.show(expect), self.show(result)))
def check_wrap(self, text, width, expect, **kwargs):
Reported by Pylint.
Line: 35
Column: 5
'expected:\n%s\nbut got:\n%s' % (
self.show(expect), self.show(result)))
def check_wrap(self, text, width, expect, **kwargs):
result = wrap(text, width, **kwargs)
self.check(result, expect)
def check_split(self, text, expect):
result = self.wrapper._split(text)
Reported by Pylint.
Lib/ctypes/test/test_varsize_struct.py
88 issues
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.
Line: 1
Column: 1
from ctypes import *
import unittest
class VarSizeTest(unittest.TestCase):
def test_resize(self):
class X(Structure):
_fields_ = [("item", c_int),
("array", c_int * 1)]
Reported by Pylint.