The following issues were found
Lib/test/test_codecencodings_cn.py
9 issues
Line: 1
Column: 1
#
# test_codecencodings_cn.py
# Codec encoding tests for PRC encodings.
#
from test import multibytecodec_support
import unittest
class Test_GB2312(multibytecodec_support.TestBase, unittest.TestCase):
Reported by Pylint.
Line: 9
Column: 1
from test import multibytecodec_support
import unittest
class Test_GB2312(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb2312'
tstring = multibytecodec_support.load_teststring('gb2312')
codectests = (
# invalid bytes
(b"abc\x81\x81\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 9
Column: 1
from test import multibytecodec_support
import unittest
class Test_GB2312(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb2312'
tstring = multibytecodec_support.load_teststring('gb2312')
codectests = (
# invalid bytes
(b"abc\x81\x81\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 22
Column: 1
(b"\xc1\x64", "strict", None),
)
class Test_GBK(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gbk'
tstring = multibytecodec_support.load_teststring('gbk')
codectests = (
# invalid bytes
(b"abc\x80\x80\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 22
Column: 1
(b"\xc1\x64", "strict", None),
)
class Test_GBK(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gbk'
tstring = multibytecodec_support.load_teststring('gbk')
codectests = (
# invalid bytes
(b"abc\x80\x80\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 36
Column: 1
("\u30fb", "strict", None),
)
class Test_GB18030(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb18030'
tstring = multibytecodec_support.load_teststring('gb18030')
codectests = (
# invalid bytes
(b"abc\x80\x80\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 36
Column: 1
("\u30fb", "strict", None),
)
class Test_GB18030(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb18030'
tstring = multibytecodec_support.load_teststring('gb18030')
codectests = (
# invalid bytes
(b"abc\x80\x80\xc1\xc4", "strict", None),
Reported by Pylint.
Line: 60
Column: 1
)
has_iso10646 = True
class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'hz'
tstring = multibytecodec_support.load_teststring('hz')
codectests = (
# test '~\n' (3 lines)
(b'This sentence is in ASCII.\n'
Reported by Pylint.
Line: 60
Column: 1
)
has_iso10646 = True
class Test_HZ(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'hz'
tstring = multibytecodec_support.load_teststring('hz')
codectests = (
# test '~\n' (3 lines)
(b'This sentence is in ASCII.\n'
Reported by Pylint.
Lib/test/dataclass_module_1_str.py
9 issues
Line: 1
Column: 1
from __future__ import annotations
USING_STRINGS = True
# dataclass_module_1.py and dataclass_module_1_str.py are identical
# except only the latter uses string annotations.
import dataclasses
import typing
Reported by Pylint.
Line: 7
Column: 1
# dataclass_module_1.py and dataclass_module_1_str.py are identical
# except only the latter uses string annotations.
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
Reported by Pylint.
Line: 8
Column: 1
# except only the latter uses string annotations.
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
Reported by Pylint.
Line: 10
Column: 1
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
T_IV3 = dataclasses.InitVar
Reported by Pylint.
Line: 14
Column: 1
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
T_IV3 = dataclasses.InitVar
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
Reported by Pylint.
Line: 17
Column: 1
T_IV3 = dataclasses.InitVar
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
cv1: typing.ClassVar = 30
cv2: T_CV2
cv3: T_CV3
Reported by Pylint.
Line: 18
Column: 5
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
cv1: typing.ClassVar = 30
cv2: T_CV2
cv3: T_CV3
not_cv4: T_CV4 # When using string annotations, this field is not recognized as a ClassVar.
Reported by Pylint.
Line: 26
Column: 1
not_cv4: T_CV4 # When using string annotations, this field is not recognized as a ClassVar.
@dataclasses.dataclass
class IV:
T_IV4 = dataclasses.InitVar
iv0: dataclasses.InitVar[int]
iv1: dataclasses.InitVar
iv2: T_IV2
iv3: T_IV3
Reported by Pylint.
Line: 27
Column: 5
@dataclasses.dataclass
class IV:
T_IV4 = dataclasses.InitVar
iv0: dataclasses.InitVar[int]
iv1: dataclasses.InitVar
iv2: T_IV2
iv3: T_IV3
not_iv4: T_IV4 # When using string annotations, this field is not recognized as an InitVar.
Reported by Pylint.
Lib/test/test_email/test_inversion.py
9 issues
Line: 39
Column: 3
g.flatten(m)
self.assertEqual(b.getvalue(), msg)
# XXX: spaces are not preserved correctly here yet in the general case.
msg_params = {
'header_with_one_space_body': (dedent(b"""\
From: abc@xyz.com
X-Status:\x20
Subject: test
Reported by Pylint.
Line: 16
Column: 1
# This is like textwrap.dedent for bytes, except that it uses \r\n for the line
# separators on the rebuilt string.
def dedent(bstr):
lines = bstr.splitlines()
if not lines[0].strip():
raise ValueError("First line must contain text")
stripamt = len(lines[0]) - len(lines[0].lstrip())
return b'\r\n'.join(
Reported by Pylint.
Line: 27
Column: 1
@parameterize
class TestInversion(TestEmailBase):
policy = policy.default
message = EmailMessage
def msg_as_input(self, msg):
Reported by Pylint.
Line: 32
Column: 5
policy = policy.default
message = EmailMessage
def msg_as_input(self, msg):
m = message_from_bytes(msg, policy=policy.SMTP)
b = io.BytesIO()
g = BytesGenerator(b)
g.flatten(m)
self.assertEqual(b.getvalue(), msg)
Reported by Pylint.
Line: 33
Column: 9
message = EmailMessage
def msg_as_input(self, msg):
m = message_from_bytes(msg, policy=policy.SMTP)
b = io.BytesIO()
g = BytesGenerator(b)
g.flatten(m)
self.assertEqual(b.getvalue(), msg)
Reported by Pylint.
Line: 34
Column: 9
def msg_as_input(self, msg):
m = message_from_bytes(msg, policy=policy.SMTP)
b = io.BytesIO()
g = BytesGenerator(b)
g.flatten(m)
self.assertEqual(b.getvalue(), msg)
# XXX: spaces are not preserved correctly here yet in the general case.
Reported by Pylint.
Line: 35
Column: 9
def msg_as_input(self, msg):
m = message_from_bytes(msg, policy=policy.SMTP)
b = io.BytesIO()
g = BytesGenerator(b)
g.flatten(m)
self.assertEqual(b.getvalue(), msg)
# XXX: spaces are not preserved correctly here yet in the general case.
msg_params = {
Reported by Pylint.
Line: 65
Column: 5
'qp_text': dict(payload=(('xy a'*40+'\n')*5), cte='quoted-printable'),
}
def payload_as_body(self, payload, **kw):
msg = self._make_message()
msg['From'] = 'foo'
msg['To'] = 'bar'
msg['Subject'] = 'payload round trip test'
msg.set_content(payload, **kw)
Reported by Pylint.
Line: 71
Column: 9
msg['To'] = 'bar'
msg['Subject'] = 'payload round trip test'
msg.set_content(payload, **kw)
b = bytes(msg)
msg2 = message_from_bytes(b, policy=self.policy)
self.assertEqual(bytes(msg2), b)
self.assertEqual(msg2.get_content(), payload)
Reported by Pylint.
Lib/test/dataclass_module_1.py
9 issues
Line: 1
Column: 1
#from __future__ import annotations
USING_STRINGS = False
# dataclass_module_1.py and dataclass_module_1_str.py are identical
# except only the latter uses string annotations.
import dataclasses
import typing
Reported by Pylint.
Line: 7
Column: 1
# dataclass_module_1.py and dataclass_module_1_str.py are identical
# except only the latter uses string annotations.
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
Reported by Pylint.
Line: 8
Column: 1
# except only the latter uses string annotations.
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
Reported by Pylint.
Line: 10
Column: 1
import dataclasses
import typing
T_CV2 = typing.ClassVar[int]
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
T_IV3 = dataclasses.InitVar
Reported by Pylint.
Line: 14
Column: 1
T_CV3 = typing.ClassVar
T_IV2 = dataclasses.InitVar[int]
T_IV3 = dataclasses.InitVar
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
Reported by Pylint.
Line: 17
Column: 1
T_IV3 = dataclasses.InitVar
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
cv1: typing.ClassVar = 30
cv2: T_CV2
cv3: T_CV3
Reported by Pylint.
Line: 18
Column: 5
@dataclasses.dataclass
class CV:
T_CV4 = typing.ClassVar
cv0: typing.ClassVar[int] = 20
cv1: typing.ClassVar = 30
cv2: T_CV2
cv3: T_CV3
not_cv4: T_CV4 # When using string annotations, this field is not recognized as a ClassVar.
Reported by Pylint.
Line: 26
Column: 1
not_cv4: T_CV4 # When using string annotations, this field is not recognized as a ClassVar.
@dataclasses.dataclass
class IV:
T_IV4 = dataclasses.InitVar
iv0: dataclasses.InitVar[int]
iv1: dataclasses.InitVar
iv2: T_IV2
iv3: T_IV3
Reported by Pylint.
Line: 27
Column: 5
@dataclasses.dataclass
class IV:
T_IV4 = dataclasses.InitVar
iv0: dataclasses.InitVar[int]
iv1: dataclasses.InitVar
iv2: T_IV2
iv3: T_IV3
not_iv4: T_IV4 # When using string annotations, this field is not recognized as an InitVar.
Reported by Pylint.
Lib/test/test_charmapcodec.py
9 issues
Line: 30
Column: 25
def setUp(self):
codecs.register(codec_search_function)
self.addCleanup(codecs.unregister, codec_search_function)
def test_constructorx(self):
self.assertEqual(str(b'abc', codecname), 'abc')
self.assertEqual(str(b'xdef', codecname), 'abcdef')
self.assertEqual(str(b'defx', codecname), 'defabc')
Reported by Pylint.
Line: 17
Column: 1
import codecs
# Register a search function which knows about our codec
def codec_search_function(encoding):
if encoding == 'testcodec':
from test import testcodec
return tuple(testcodec.getregentry())
return None
Reported by Pylint.
Line: 19
Column: 9
# Register a search function which knows about our codec
def codec_search_function(encoding):
if encoding == 'testcodec':
from test import testcodec
return tuple(testcodec.getregentry())
return None
# test codec's name (see test/testcodec.py)
codecname = 'testcodec'
Reported by Pylint.
Line: 24
Column: 1
return None
# test codec's name (see test/testcodec.py)
codecname = 'testcodec'
class CharmapCodecTest(unittest.TestCase):
def setUp(self):
codecs.register(codec_search_function)
Reported by Pylint.
Line: 26
Column: 1
# test codec's name (see test/testcodec.py)
codecname = 'testcodec'
class CharmapCodecTest(unittest.TestCase):
def setUp(self):
codecs.register(codec_search_function)
self.addCleanup(codecs.unregister, codec_search_function)
Reported by Pylint.
Line: 32
Column: 5
codecs.register(codec_search_function)
self.addCleanup(codecs.unregister, codec_search_function)
def test_constructorx(self):
self.assertEqual(str(b'abc', codecname), 'abc')
self.assertEqual(str(b'xdef', codecname), 'abcdef')
self.assertEqual(str(b'defx', codecname), 'defabc')
self.assertEqual(str(b'dxf', codecname), 'dabcf')
self.assertEqual(str(b'dxfx', codecname), 'dabcfabc')
Reported by Pylint.
Line: 39
Column: 5
self.assertEqual(str(b'dxf', codecname), 'dabcf')
self.assertEqual(str(b'dxfx', codecname), 'dabcfabc')
def test_encodex(self):
self.assertEqual('abc'.encode(codecname), b'abc')
self.assertEqual('xdef'.encode(codecname), b'abcdef')
self.assertEqual('defx'.encode(codecname), b'defabc')
self.assertEqual('dxf'.encode(codecname), b'dabcf')
self.assertEqual('dxfx'.encode(codecname), b'dabcfabc')
Reported by Pylint.
Line: 46
Column: 5
self.assertEqual('dxf'.encode(codecname), b'dabcf')
self.assertEqual('dxfx'.encode(codecname), b'dabcfabc')
def test_constructory(self):
self.assertEqual(str(b'ydef', codecname), 'def')
self.assertEqual(str(b'defy', codecname), 'def')
self.assertEqual(str(b'dyf', codecname), 'df')
self.assertEqual(str(b'dyfy', codecname), 'df')
Reported by Pylint.
Line: 52
Column: 5
self.assertEqual(str(b'dyf', codecname), 'df')
self.assertEqual(str(b'dyfy', codecname), 'df')
def test_maptoundefined(self):
self.assertRaises(UnicodeError, str, b'abc\001', codecname)
if __name__ == "__main__":
unittest.main()
Reported by Pylint.
Lib/test/badsyntax_future6.py
9 issues
Line: 2
Column: 1
"""This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
Reported by Pylint.
Line: 3
Column: 1
"""This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
Reported by Pylint.
Line: 3
Column: 1
"""This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
Reported by Pylint.
Line: 5
Column: 1
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 5
Column: 1
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 5
Column: 1
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 6
Column: 5
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 6
Column: 5
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 10
Column: 1
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Lib/test/test_genexps.py
9 issues
Line: 297
Column: 25
for i in range(len(counts)):
support.run_doctest(test_genexps, verbose)
gc.collect()
counts[i] = sys.gettotalrefcount()
print(counts)
if __name__ == "__main__":
test_main(verbose=True)
Reported by Pylint.
Line: 1
Column: 1
doctests = """
Test simple loop with conditional
>>> sum(i*i for i in range(100) if i&1 == 1)
166650
Test simple nesting
Reported by Pylint.
Line: 1
Column: 1
doctests = """
Test simple loop with conditional
>>> sum(i*i for i in range(100) if i&1 == 1)
166650
Test simple nesting
Reported by Pylint.
Line: 277
Column: 1
"""
import sys
# Trace function can throw off the tuple reuse test.
if hasattr(sys, 'gettrace') and sys.gettrace():
__test__ = {}
else:
Reported by Pylint.
Line: 285
Column: 1
else:
__test__ = {'doctests' : doctests}
def test_main(verbose=None):
from test import support
from test import test_genexps
support.run_doctest(test_genexps, verbose)
# verify reference counting
Reported by Pylint.
Line: 286
Column: 5
__test__ = {'doctests' : doctests}
def test_main(verbose=None):
from test import support
from test import test_genexps
support.run_doctest(test_genexps, verbose)
# verify reference counting
if verbose and hasattr(sys, "gettotalrefcount"):
Reported by Pylint.
Line: 287
Column: 5
def test_main(verbose=None):
from test import support
from test import test_genexps
support.run_doctest(test_genexps, verbose)
# verify reference counting
if verbose and hasattr(sys, "gettotalrefcount"):
import gc
Reported by Pylint.
Line: 292
Column: 9
# verify reference counting
if verbose and hasattr(sys, "gettotalrefcount"):
import gc
counts = [None] * 5
for i in range(len(counts)):
support.run_doctest(test_genexps, verbose)
gc.collect()
counts[i] = sys.gettotalrefcount()
Reported by Pylint.
Line: 294
Column: 9
if verbose and hasattr(sys, "gettotalrefcount"):
import gc
counts = [None] * 5
for i in range(len(counts)):
support.run_doctest(test_genexps, verbose)
gc.collect()
counts[i] = sys.gettotalrefcount()
print(counts)
Reported by Pylint.
Lib/test/reperf.py
9 issues
Line: 14
Column: 13
def timefunc(n, func, *args, **kw):
t0 = time.perf_counter()
try:
for i in range(n):
result = func(*args, **kw)
return result
finally:
t1 = time.perf_counter()
if n > 1:
Reported by Pylint.
Line: 1
Column: 1
import re
import time
def main():
s = "\13hello\14 \13world\14 " * 1000
p = re.compile(r"([\13\14])")
timefunc(10, p.sub, "", s)
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
Reported by Pylint.
Line: 4
Column: 1
import re
import time
def main():
s = "\13hello\14 \13world\14 " * 1000
p = re.compile(r"([\13\14])")
timefunc(10, p.sub, "", s)
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
Reported by Pylint.
Line: 5
Column: 5
import time
def main():
s = "\13hello\14 \13world\14 " * 1000
p = re.compile(r"([\13\14])")
timefunc(10, p.sub, "", s)
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
Reported by Pylint.
Line: 6
Column: 5
def main():
s = "\13hello\14 \13world\14 " * 1000
p = re.compile(r"([\13\14])")
timefunc(10, p.sub, "", s)
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
def timefunc(n, func, *args, **kw):
Reported by Pylint.
Line: 11
Column: 1
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
def timefunc(n, func, *args, **kw):
t0 = time.perf_counter()
try:
for i in range(n):
result = func(*args, **kw)
return result
Reported by Pylint.
Line: 11
Column: 1
timefunc(10, p.split, s)
timefunc(10, p.findall, s)
def timefunc(n, func, *args, **kw):
t0 = time.perf_counter()
try:
for i in range(n):
result = func(*args, **kw)
return result
Reported by Pylint.
Line: 12
Column: 5
timefunc(10, p.findall, s)
def timefunc(n, func, *args, **kw):
t0 = time.perf_counter()
try:
for i in range(n):
result = func(*args, **kw)
return result
finally:
Reported by Pylint.
Line: 18
Column: 9
result = func(*args, **kw)
return result
finally:
t1 = time.perf_counter()
if n > 1:
print(n, "times", end=' ')
print(func.__name__, "%.3f" % (t1-t0), "CPU seconds")
main()
Reported by Pylint.
Lib/test/dtracedata/line.py
9 issues
Line: 1
Column: 1
def test_line():
a = 1
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
Reported by Pylint.
Line: 1
Column: 1
def test_line():
a = 1
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
Reported by Pylint.
Line: 2
Column: 5
def test_line():
a = 1
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
Reported by Pylint.
Line: 5
Column: 9
a = 1
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
d = a + b +c
Reported by Pylint.
Line: 6
Column: 9
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
d = a + b +c
print('#', a, b, c, d)
Reported by Pylint.
Line: 7
Column: 9
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
d = a + b +c
print('#', a, b, c, d)
a = 1
Reported by Pylint.
Line: 9
Column: 13
b = i+2
c = i+3
if c < 4:
a = c
d = a + b +c
print('#', a, b, c, d)
a = 1
print('# Epilogue', a)
Reported by Pylint.
Line: 10
Column: 9
c = i+3
if c < 4:
a = c
d = a + b +c
print('#', a, b, c, d)
a = 1
print('# Epilogue', a)
Reported by Pylint.
Line: 12
Column: 5
a = c
d = a + b +c
print('#', a, b, c, d)
a = 1
print('# Epilogue', a)
if __name__ == '__main__':
test_line()
Reported by Pylint.
Lib/test/test_asyncio/test_threads.py
9 issues
Line: 11
Column: 1
from test.test_asyncio import utils as test_utils
def tearDownModule():
asyncio.set_event_loop_policy(None)
class ToThreadTests(test_utils.TestCase):
def setUp(self):
Reported by Pylint.
Line: 11
Column: 1
from test.test_asyncio import utils as test_utils
def tearDownModule():
asyncio.set_event_loop_policy(None)
class ToThreadTests(test_utils.TestCase):
def setUp(self):
Reported by Pylint.
Line: 15
Column: 1
asyncio.set_event_loop_policy(None)
class ToThreadTests(test_utils.TestCase):
def setUp(self):
super().setUp()
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
Reported by Pylint.
Line: 29
Column: 5
self.loop = None
super().tearDown()
def test_to_thread(self):
async def main():
return await asyncio.to_thread(sum, [40, 2])
result = self.loop.run_until_complete(main())
self.assertEqual(result, 42)
Reported by Pylint.
Line: 36
Column: 5
result = self.loop.run_until_complete(main())
self.assertEqual(result, 42)
def test_to_thread_exception(self):
def raise_runtime():
raise RuntimeError("test")
async def main():
await asyncio.to_thread(raise_runtime)
Reported by Pylint.
Line: 46
Column: 5
with self.assertRaisesRegex(RuntimeError, "test"):
self.loop.run_until_complete(main())
def test_to_thread_once(self):
func = mock.Mock()
async def main():
await asyncio.to_thread(func)
Reported by Pylint.
Line: 55
Column: 5
self.loop.run_until_complete(main())
func.assert_called_once()
def test_to_thread_concurrent(self):
func = mock.Mock()
async def main():
futs = []
for _ in range(10):
Reported by Pylint.
Line: 68
Column: 5
self.loop.run_until_complete(main())
self.assertEqual(func.call_count, 10)
def test_to_thread_args_kwargs(self):
# Unlike run_in_executor(), to_thread() should directly accept kwargs.
func = mock.Mock()
async def main():
await asyncio.to_thread(func, 'test', something=True)
Reported by Pylint.
Line: 78
Column: 5
self.loop.run_until_complete(main())
func.assert_called_once_with('test', something=True)
def test_to_thread_contextvars(self):
test_ctx = ContextVar('test_ctx')
def get_ctx():
return test_ctx.get()
Reported by Pylint.