Skip to content

Commit 6c83c8e

Browse files
authored
bpo-46198: rename duplicate tests and remove unused code (pythonGH-30297)
1 parent f537b2a commit 6c83c8e

10 files changed

+8
-15
lines changed

Lib/test/datetimetester.py

-4
Original file line numberDiff line numberDiff line change
@@ -1864,8 +1864,6 @@ def test_fromisoformat_fails(self):
18641864

18651865
def test_fromisoformat_fails_typeerror(self):
18661866
# Test that fromisoformat fails when passed the wrong type
1867-
import io
1868-
18691867
bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')]
18701868
for bad_type in bad_types:
18711869
with self.assertRaises(TypeError):
@@ -3988,8 +3986,6 @@ def test_fromisoformat_fails(self):
39883986

39893987
def test_fromisoformat_fails_typeerror(self):
39903988
# Test the fromisoformat fails when passed the wrong type
3991-
import io
3992-
39933989
bad_types = [b'12:30:45', None, io.StringIO('12:30:45')]
39943990

39953991
for bad_type in bad_types:

Lib/test/support/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1442,9 +1442,6 @@ def __init__(self, link=None):
14421442

14431443
self._platform_specific()
14441444

1445-
def _platform_specific(self):
1446-
pass
1447-
14481445
if sys.platform == "win32":
14491446
def _platform_specific(self):
14501447
import glob
@@ -1472,6 +1469,9 @@ def _platform_specific(self):
14721469
self._env["PYTHONHOME"] = os.path.dirname(self.real)
14731470
if sysconfig.is_python_build(True):
14741471
self._env["PYTHONPATH"] = STDLIB_DIR
1472+
else:
1473+
def _platform_specific(self):
1474+
pass
14751475

14761476
def __enter__(self):
14771477
os.symlink(self.real, self.link)

Lib/test/test_asyncio/test_sslproto.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import logging
44
import socket
5-
from test import support
65
import unittest
76
import weakref
87
from unittest import mock

Lib/test/test_codecs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def check(input, expect):
3636
# On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present
3737
def is_code_page_present(cp):
3838
from ctypes import POINTER, WINFUNCTYPE, WinDLL
39-
from ctypes.wintypes import BOOL, UINT, BYTE, WCHAR, UINT, DWORD
39+
from ctypes.wintypes import BOOL, BYTE, WCHAR, UINT, DWORD
4040

4141
MAX_LEADBYTES = 12 # 5 ranges, 2 bytes ea., 0 term.
4242
MAX_DEFAULTCHAR = 2 # single or double byte

Lib/test/test_compile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ def test_func_kwargs(self):
11891189
kwargs = (f'a{i}=x' for i in range(self.N))
11901190
self.check_stack_size("f(" + ", ".join(kwargs) + ")")
11911191

1192-
def test_func_args(self):
1192+
def test_meth_args(self):
11931193
self.check_stack_size("o.m(" + "x, " * self.N + ")")
11941194

11951195
def test_meth_kwargs(self):

Lib/test/test_dict.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ def test_dict_items_result_gc(self):
14551455
self.assertTrue(gc.is_tracked(next(it)))
14561456

14571457
@support.cpython_only
1458-
def test_dict_items_result_gc(self):
1458+
def test_dict_items_result_gc_reversed(self):
14591459
# Same as test_dict_items_result_gc above, but reversed.
14601460
it = reversed({None: []}.items())
14611461
gc.collect()

Lib/test/test_email/test__header_value_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def test_get_unstructured_without_trailing_whitespace_hang_case(self):
395395
[errors.InvalidHeaderDefect],
396396
'')
397397

398-
def test_get_unstructured_invalid_ew(self):
398+
def test_get_unstructured_invalid_ew2(self):
399399
self._test_get_x(self._get_unst,
400400
'=?utf-8?q?=somevalue?=',
401401
'=?utf-8?q?=somevalue?=',

Lib/test/test_enum.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3708,7 +3708,7 @@ class Sillier(IntEnum):
37083708
triple = 3
37093709
value = 4
37103710

3711-
class TestHelpers(unittest.TestCase):
3711+
class TestInternals(unittest.TestCase):
37123712

37133713
sunder_names = '_bad_', '_good_', '_what_ho_'
37143714
dunder_names = '__mal__', '__bien__', '__que_que__'

Lib/test/test_pty.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import unittest
1818

1919
import struct
20-
import tty
2120
import fcntl
2221
import warnings
2322

Lib/test/test_tabnanny.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* errored : Whitespace related problems present in file.
55
"""
66
from unittest import TestCase, mock
7-
from unittest import mock
87
import errno
98
import os
109
import tabnanny

0 commit comments

Comments
 (0)