Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-38839: Fix some unused functions in tests #17189

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/distutils/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ def _log(self, level, msg, args):
self.logs.append((level, msg, args))

def get_logs(self, *levels):
def _format(msg, args):
return msg % args
return [msg % args for level, msg, args
in self.logs if level in levels]

Expand Down
14 changes: 7 additions & 7 deletions Lib/test/test_asynchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def __init__(self, terminator, server_port):
self.set_terminator(terminator)
self.buffer = b""

def handle_connect(self):
pass
def handle_connect(self):
pass

if sys.platform == 'darwin':
# select.poll returns a select.POLLHUP at the end of the tests
# on darwin, so just ignore it
def handle_expt(self):
pass
if sys.platform == 'darwin':
# select.poll returns a select.POLLHUP at the end of the tests
# on darwin, so just ignore it
def handle_expt(self):
pass

def collect_incoming_data(self, data):
self.buffer += data
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,6 @@ def check_memoryview(m, expected_readonly=readonly):
m.tobytes() # Releasing mm didn't release m

def verify_getbuf(self, orig_ex, ex, req, sliced=False):
def simple_fmt(ex):
return ex.format == '' or ex.format == 'B'
def match(req, flag):
return ((req&flag) == flag)

Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ def test_hash(self):
self.assertEqual(hash('spam'), hash(b'spam'))
hash((0,1,2,3))
def f(): pass
hash(f)
self.assertRaises(TypeError, hash, [])
self.assertRaises(TypeError, hash, {})
# Bug 1536021: Allow hash to return long objects
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def func():
def func2():
y = 2
return y
code2 = func.__code__
code2 = func2.__code__

for attr, value in (
("co_argcount", 0),
Expand Down
1 change: 1 addition & 0 deletions Lib/test/test_importlib/import_/test_relative_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def callback(global_):
self.assertEqual(module.__name__, 'pkg')
self.assertTrue(hasattr(module, 'subpkg2'))
self.assertEqual(module.subpkg2.attr, 'pkg.subpkg2.__init__')
self.relative_import_test(create, globals_, callback)

def test_deep_import(self):
# [deep import]
Expand Down
1 change: 1 addition & 0 deletions Lib/unittest/test/testmock/testasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def test_is_AsyncMock_patch(self):
@patch.object(AsyncClass, 'async_method', spec_set=True)
def test_async(async_method):
self.assertIsInstance(async_method, AsyncMock)
test_async()

def test_is_async_AsyncMock(self):
mock = AsyncMock(spec_set=AsyncClass.async_method)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix some unused functions in tests. Patch by Adam Johnson.
7 changes: 0 additions & 7 deletions Tools/ccbench/ccbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ def task_regex():
pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)', re.MULTILINE)
with open(__file__, "r") as f:
arg = f.read(2000)

def findall(s):
t = time.time()
try:
return pat.findall(s)
finally:
print(time.time() - t)
return pat.findall, (arg, )

def task_sort():
Expand Down