The following issues were found
Lib/asyncio/__init__.py
33 issues
Line: 8
Column: 1
import sys
# This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
Reported by Pylint.
Line: 9
Column: 1
# This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
Reported by Pylint.
Line: 10
Column: 1
# This relies on each of the submodules having an __all__ variable.
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
Reported by Pylint.
Line: 11
Column: 1
from .base_events import *
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
Reported by Pylint.
Line: 12
Column: 1
from .coroutines import *
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
Reported by Pylint.
Line: 13
Column: 1
from .events import *
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
Reported by Pylint.
Line: 14
Column: 1
from .exceptions import *
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
Reported by Pylint.
Line: 15
Column: 1
from .futures import *
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *
Reported by Pylint.
Line: 16
Column: 1
from .locks import *
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *
from .transports import *
Reported by Pylint.
Line: 17
Column: 1
from .protocols import *
from .runners import *
from .queues import *
from .streams import *
from .subprocess import *
from .tasks import *
from .threads import *
from .transports import *
Reported by Pylint.
Lib/idlelib/stackviewer.py
33 issues
Line: 11
Column: 5
from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas
def StackBrowser(root, flist=None, tb=None, top=None):
global sc, item, node # For testing.
if top is None:
top = tk.Toplevel(root)
sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
sc.frame.pack(expand=1, fill="both")
item = StackTreeItem(flist, tb)
Reported by Pylint.
Line: 11
Column: 5
from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas
def StackBrowser(root, flist=None, tb=None, top=None):
global sc, item, node # For testing.
if top is None:
top = tk.Toplevel(root)
sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
sc.frame.pack(expand=1, fill="both")
item = StackTreeItem(flist, tb)
Reported by Pylint.
Line: 11
Column: 5
from idlelib.tree import TreeNode, TreeItem, ScrolledCanvas
def StackBrowser(root, flist=None, tb=None, top=None):
global sc, item, node # For testing.
if top is None:
top = tk.Toplevel(root)
sc = ScrolledCanvas(top, bg="white", highlightthickness=0)
sc.frame.pack(expand=1, fill="both")
item = StackTreeItem(flist, tb)
Reported by Pylint.
Line: 23
Column: 5
class StackTreeItem(TreeItem):
def __init__(self, flist=None, tb=None):
self.flist = flist
self.stack = self.get_stack(tb)
self.text = self.get_exception()
def get_stack(self, tb):
Reported by Pylint.
Line: 40
Column: 9
return stack
def get_exception(self):
type = sys.last_type
value = sys.last_value
if hasattr(type, "__name__"):
type = type.__name__
s = str(type)
if value is not None:
Reported by Pylint.
Line: 55
Column: 13
def GetSubList(self):
sublist = []
for info in self.stack:
item = FrameTreeItem(info, self.flist)
sublist.append(item)
return sublist
class FrameTreeItem(TreeItem):
Reported by Pylint.
Line: 62
Column: 5
class FrameTreeItem(TreeItem):
def __init__(self, info, flist):
self.info = info
self.flist = flist
def GetText(self):
frame, lineno = self.info
Reported by Pylint.
Line: 70
Column: 9
frame, lineno = self.info
try:
modname = frame.f_globals["__name__"]
except:
modname = "?"
code = frame.f_code
filename = code.co_filename
funcname = code.co_name
sourceline = linecache.getline(filename, lineno)
Reported by Pylint.
Line: 78
Column: 13
sourceline = linecache.getline(filename, lineno)
sourceline = sourceline.strip()
if funcname in ("?", "", None):
item = "%s, line %d: %s" % (modname, lineno, sourceline)
else:
item = "%s.%s(...), line %d: %s" % (modname, funcname,
lineno, sourceline)
return item
Reported by Pylint.
Line: 85
Column: 16
return item
def GetSubList(self):
frame, lineno = self.info
sublist = []
if frame.f_globals is not frame.f_locals:
item = VariablesTreeItem("<locals>", frame.f_locals, self.flist)
sublist.append(item)
item = VariablesTreeItem("<globals>", frame.f_globals, self.flist)
Reported by Pylint.
Lib/idlelib/idle_test/test_replace.py
33 issues
Line: 4
Column: 1
"Test replace, coverage 78%."
from idlelib.replace import ReplaceDialog
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
Reported by Pylint.
Line: 5
Column: 1
from idlelib.replace import ReplaceDialog
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
Reported by Pylint.
Line: 7
Column: 1
import unittest
from test.support import requires
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
Reported by Pylint.
Line: 9
Column: 1
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
orig_mbox = se.messagebox
showerror = Mbox.showerror
Reported by Pylint.
Line: 9
Column: 1
requires('gui')
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
orig_mbox = se.messagebox
showerror = Mbox.showerror
Reported by Pylint.
Line: 10
Column: 1
from tkinter import Tk, Text
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
orig_mbox = se.messagebox
showerror = Mbox.showerror
Reported by Pylint.
Line: 11
Column: 1
from unittest.mock import Mock
from idlelib.idle_test.mock_tk import Mbox
import idlelib.searchengine as se
orig_mbox = se.messagebox
showerror = Mbox.showerror
Reported by Pylint.
Line: 17
Column: 1
showerror = Mbox.showerror
class ReplaceDialogTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.root = Tk()
cls.root.withdraw()
Reported by Pylint.
Line: 55
Column: 5
showerror.message = ''
self.text.delete('1.0', 'end')
def test_replace_simple(self):
# Test replace function with all options at default setting.
# Wrap around - True
# Regular Expression - False
# Match case - False
# Match word - False
Reported by Pylint.
Lib/test/test_thread.py
33 issues
Line: 64
Column: 17
def test_starting_threads(self):
with threading_helper.wait_threads_exit():
# Basic test for thread creation.
for i in range(NUMTASKS):
self.newtask()
verbose_print("waiting for tasks to complete...")
self.done_mutex.acquire()
verbose_print("all tasks done")
Reported by Pylint.
Line: 99
Column: 21
self.next_ident = 0
self.created = 0
with threading_helper.wait_threads_exit():
for i in range(NUMTASKS):
self.newtask()
verbose_print("waiting for all tasks to complete")
self.done_mutex.acquire()
verbose_print("all tasks done")
Reported by Pylint.
Line: 110
Column: 16
def test__count(self):
# Test the _count() function.
orig = thread._count()
mut = thread.allocate_lock()
mut.acquire()
started = []
def task():
Reported by Pylint.
Line: 124
Column: 30
thread.start_new_thread(task, ())
while not started:
time.sleep(POLL_SLEEP)
self.assertEqual(thread._count(), orig + 1)
# Allow the task to finish.
mut.release()
# The only reliable way to be sure that the thread ended from the
# interpreter's point of view is to wait for the function object to be
# destroyed.
Reported by Pylint.
Line: 131
Column: 13
# interpreter's point of view is to wait for the function object to be
# destroyed.
done = []
wr = weakref.ref(task, lambda _: done.append(None))
del task
while not done:
time.sleep(POLL_SLEEP)
self.assertEqual(thread._count(), orig)
Reported by Pylint.
Line: 135
Column: 30
del task
while not done:
time.sleep(POLL_SLEEP)
self.assertEqual(thread._count(), orig)
def test_unraisable_exception(self):
def task():
started.release()
raise ValueError("task failed")
Reported by Pylint.
Line: 185
Column: 13
def test_barrier(self):
with threading_helper.wait_threads_exit():
self.bar = Barrier(NUMTASKS)
self.running = NUMTASKS
for i in range(NUMTASKS):
thread.start_new_thread(self.task2, (i,))
verbose_print("waiting for tasks to end")
self.done_mutex.acquire()
Reported by Pylint.
Line: 245
Column: 17
os.close(read_fd)
os.write(write_fd, b"OK")
finally:
os._exit(0)
with threading_helper.wait_threads_exit():
thread.start_new_thread(fork_thread, (self.read_fd, self.write_fd))
self.assertEqual(os.read(self.read_fd, 2), b"OK")
os.close(self.write_fd)
Reported by Pylint.
Line: 1
Column: 1
import os
import unittest
import random
from test import support
from test.support import threading_helper
import _thread as thread
import time
import weakref
Reported by Pylint.
Line: 10
Column: 1
import time
import weakref
from test import lock_tests
NUMTASKS = 10
NUMTRIPS = 3
POLL_SLEEP = 0.010 # seconds = 10 ms
Reported by Pylint.
Lib/timeit.py
33 issues
Line: 154
Column: 1
The optional file argument directs where the traceback is
sent; it defaults to sys.stderr.
"""
import linecache, traceback
if self.src is not None:
linecache.cache[dummy_src_name] = (len(self.src),
None,
self.src.split("\n"),
dummy_src_name)
Reported by Pylint.
Line: 320
Column: 13
# determine number so that 0.2 <= total time < 2.0
callback = None
if verbose:
def callback(number, time_taken):
msg = "{num} loop{s} -> {secs:.{prec}g} secs"
plural = (number != 1)
print(msg.format(num=number, s='s' if plural else '',
secs=time_taken, prec=precision))
try:
Reported by Pylint.
Line: 103
Column: 18
"""
def __init__(self, stmt="pass", setup="pass", timer=default_timer,
globals=None):
"""Constructor. See class doc string."""
self.timer = timer
local_ns = {}
global_ns = _globals() if globals is None else globals
init = ''
Reported by Pylint.
Line: 134
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html
src = template.format(stmt=stmt, setup=setup, init=init)
self.src = src # Save for traceback display
code = compile(src, dummy_src_name, "exec")
exec(code, global_ns, local_ns)
self.inner = local_ns["inner"]
def print_exc(self, file=None):
"""Helper to print a traceback from the timed code.
Reported by Bandit.
Line: 134
Column: 9
src = template.format(stmt=stmt, setup=setup, init=init)
self.src = src # Save for traceback display
code = compile(src, dummy_src_name, "exec")
exec(code, global_ns, local_ns)
self.inner = local_ns["inner"]
def print_exc(self, file=None):
"""Helper to print a traceback from the timed code.
Reported by Pylint.
Line: 184
Column: 22
gc.enable()
return timing
def repeat(self, repeat=default_repeat, number=default_number):
"""Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 5;
Reported by Pylint.
Line: 205
Column: 13
vector and apply common sense rather than statistics.
"""
r = []
for i in range(repeat):
t = self.timeit(number)
r.append(t)
return r
def autorange(self, callback=None):
Reported by Pylint.
Line: 232
Column: 35
i *= 10
def timeit(stmt="pass", setup="pass", timer=default_timer,
number=default_number, globals=None):
"""Convenience function to create Timer object and call timeit method."""
return Timer(stmt, setup, timer, globals).timeit(number)
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number, globals=None):
Reported by Pylint.
Line: 237
Column: 58
return Timer(stmt, setup, timer, globals).timeit(number)
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number, globals=None):
"""Convenience function to create Timer object and call repeat method."""
return Timer(stmt, setup, timer, globals).repeat(repeat, number)
def main(args=None, *, _wrap_timer=None):
"""Main program, used when run as a script.
Reported by Pylint.
Line: 237
Column: 12
return Timer(stmt, setup, timer, globals).timeit(number)
def repeat(stmt="pass", setup="pass", timer=default_timer,
repeat=default_repeat, number=default_number, globals=None):
"""Convenience function to create Timer object and call repeat method."""
return Timer(stmt, setup, timer, globals).repeat(repeat, number)
def main(args=None, *, _wrap_timer=None):
"""Main program, used when run as a script.
Reported by Pylint.
Lib/test/test_tools/test_pindent.py
33 issues
Line: 8
Column: 1
import unittest
import subprocess
import textwrap
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok
from test.test_tools import scriptsdir, skip_if_missing
Reported by Pylint.
Line: 45
Column: 13
with open(data_path, 'w') as f:
f.write(closed)
rc, out, err = assert_python_ok(self.script, '-d', data_path)
self.assertEqual(out, b'')
self.assertEqual(err, b'')
backup = data_path + '~'
self.assertTrue(os.path.exists(backup))
with open(backup) as f:
Reported by Pylint.
Line: 6
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
import os
import sys
import unittest
import subprocess
import textwrap
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok
Reported by Bandit.
Line: 17
Column: 1
skip_if_missing()
class PindentTests(unittest.TestCase):
script = os.path.join(scriptsdir, 'pindent.py')
def assertFileEqual(self, fn1, fn2):
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
Reported by Pylint.
Line: 20
Column: 5
class PindentTests(unittest.TestCase):
script = os.path.join(scriptsdir, 'pindent.py')
def assertFileEqual(self, fn1, fn2):
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
Reported by Pylint.
Line: 20
Column: 5
class PindentTests(unittest.TestCase):
script = os.path.join(scriptsdir, 'pindent.py')
def assertFileEqual(self, fn1, fn2):
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
Reported by Pylint.
Line: 21
Column: 27
script = os.path.join(scriptsdir, 'pindent.py')
def assertFileEqual(self, fn1, fn2):
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
(sys.executable, self.script) + args,
Reported by Pylint.
Line: 21
Column: 44
script = os.path.join(scriptsdir, 'pindent.py')
def assertFileEqual(self, fn1, fn2):
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
(sys.executable, self.script) + args,
Reported by Pylint.
Line: 24
Column: 5
with open(fn1) as f1, open(fn2) as f2:
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
(sys.executable, self.script) + args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True) as proc:
out, err = proc.communicate(source)
Reported by Pylint.
Line: 25
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html
self.assertEqual(f1.readlines(), f2.readlines())
def pindent(self, source, *args):
with subprocess.Popen(
(sys.executable, self.script) + args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True) as proc:
out, err = proc.communicate(source)
self.assertIsNone(err)
Reported by Bandit.
Lib/test/test_contains.py
33 issues
Line: 27
Column: 51
self.assertNotIn(0, b)
self.assertIn(1, c)
self.assertNotIn(0, c)
self.assertRaises(TypeError, lambda: 1 in a)
self.assertRaises(TypeError, lambda: 1 not in a)
# test char in string
self.assertIn('c', 'abc')
self.assertNotIn('d', 'abc')
Reported by Pylint.
Line: 28
Column: 55
self.assertIn(1, c)
self.assertNotIn(0, c)
self.assertRaises(TypeError, lambda: 1 in a)
self.assertRaises(TypeError, lambda: 1 not in a)
# test char in string
self.assertIn('c', 'abc')
self.assertNotIn('d', 'abc')
Reported by Pylint.
Line: 1
Column: 1
from collections import deque
import unittest
from test.support import NEVER_EQ
class base_set:
def __init__(self, el):
self.el = el
Reported by Pylint.
Line: 6
Column: 1
from test.support import NEVER_EQ
class base_set:
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
Reported by Pylint.
Line: 6
Column: 1
from test.support import NEVER_EQ
class base_set:
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
Reported by Pylint.
Line: 6
Column: 1
from test.support import NEVER_EQ
class base_set:
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
Reported by Pylint.
Line: 8
Column: 9
class base_set:
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
return self.el == el
Reported by Pylint.
Line: 10
Column: 1
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
Reported by Pylint.
Line: 10
Column: 1
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
Reported by Pylint.
Line: 10
Column: 1
def __init__(self, el):
self.el = el
class myset(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
Reported by Pylint.
Lib/test/test_fcntl.py
33 issues
Line: 35
Column: 9
else:
off_t = 'lxxxx'
pid_t = 'l'
lockdata = struct.pack(off_t + off_t + pid_t + 'hh', 0, 0, 0,
fcntl.F_WRLCK, 0)
elif sys.platform.startswith('gnukfreebsd'):
lockdata = struct.pack('qqihhi', 0, 0, 0, fcntl.F_WRLCK, 0, 0)
elif sys.platform in ['hp-uxB', 'unixware7']:
lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
Reported by Pylint.
Line: 19
Column: 1
def get_lockdata():
try:
os.O_LARGEFILE
except AttributeError:
start_len = "ll"
else:
Reported by Pylint.
Line: 50
Column: 1
lockdata = get_lockdata()
class BadFile:
def __init__(self, fn):
self.fn = fn
def fileno(self):
return self.fn
Reported by Pylint.
Line: 50
Column: 1
lockdata = get_lockdata()
class BadFile:
def __init__(self, fn):
self.fn = fn
def fileno(self):
return self.fn
Reported by Pylint.
Line: 52
Column: 9
class BadFile:
def __init__(self, fn):
self.fn = fn
def fileno(self):
return self.fn
def try_lockf_on_other_process_fail(fname, cmd):
f = open(fname, 'wb+')
Reported by Pylint.
Line: 53
Column: 5
class BadFile:
def __init__(self, fn):
self.fn = fn
def fileno(self):
return self.fn
def try_lockf_on_other_process_fail(fname, cmd):
f = open(fname, 'wb+')
try:
Reported by Pylint.
Line: 56
Column: 1
def fileno(self):
return self.fn
def try_lockf_on_other_process_fail(fname, cmd):
f = open(fname, 'wb+')
try:
fcntl.lockf(f, cmd)
except BlockingIOError:
pass
Reported by Pylint.
Line: 57
Column: 5
return self.fn
def try_lockf_on_other_process_fail(fname, cmd):
f = open(fname, 'wb+')
try:
fcntl.lockf(f, cmd)
except BlockingIOError:
pass
finally:
Reported by Pylint.
Line: 65
Column: 1
finally:
f.close()
def try_lockf_on_other_process(fname, cmd):
f = open(fname, 'wb+')
fcntl.lockf(f, cmd)
fcntl.lockf(f, fcntl.LOCK_UN)
f.close()
Reported by Pylint.
Line: 66
Column: 5
f.close()
def try_lockf_on_other_process(fname, cmd):
f = open(fname, 'wb+')
fcntl.lockf(f, cmd)
fcntl.lockf(f, fcntl.LOCK_UN)
f.close()
class TestFcntl(unittest.TestCase):
Reported by Pylint.
Lib/test/test_json/test_float.py
32 issues
Line: 8
Column: 13
class TestFloat:
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
self.assertEqual(float(self.dumps(num)), num)
self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
Reported by Pylint.
Line: 8
Column: 36
class TestFloat:
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
self.assertEqual(float(self.dumps(num)), num)
self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
Reported by Pylint.
Line: 9
Column: 30
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
self.assertEqual(float(self.dumps(num)), num)
self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
Reported by Pylint.
Line: 9
Column: 13
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
self.assertEqual(float(self.dumps(num)), num)
self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
Reported by Pylint.
Line: 9
Column: 41
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
self.assertEqual(float(self.dumps(num)), num)
self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
Reported by Pylint.
Line: 13
Column: 30
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
def test_out_of_range(self):
self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
Reported by Pylint.
Line: 13
Column: 13
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
def test_out_of_range(self):
self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
Reported by Pylint.
Line: 14
Column: 13
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
def test_out_of_range(self):
self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
Reported by Pylint.
Line: 14
Column: 34
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
self.assertEqual(self.dumps(num), str(num))
self.assertEqual(int(self.dumps(num)), num)
def test_out_of_range(self):
self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
Reported by Pylint.
Line: 17
Column: 9
self.assertEqual(int(self.dumps(num)), num)
def test_out_of_range(self):
self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
def test_allow_nan(self):
for val in (float('inf'), float('-inf'), float('nan')):
out = self.dumps([val])
Reported by Pylint.
Lib/test/test_asyncio/test_transports.py
32 issues
Line: 14
Column: 26
def test_ctor_extra_is_none(self):
transport = asyncio.Transport()
self.assertEqual(transport._extra, {})
def test_get_extra_info(self):
transport = asyncio.Transport({'extra': 'info'})
self.assertEqual('info', transport.get_extra_info('extra'))
self.assertIsNone(transport.get_extra_info('unknown'))
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.
Line: 27
Column: 9
def test_writelines(self):
writer = mock.Mock()
class MyTransport(asyncio.Transport):
def write(self, data):
writer(data)
transport = MyTransport()
Reported by Pylint.