Skip to content

Commit c031cf4

Browse files
sobolevnJelleZijlstra
authored andcommitted
[3.10] bpo-46198: rename duplicate tests and remove unused code (pythonGH-30297).
(cherry picked from commit 6c83c8e) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 5dfe981 commit c031cf4

9 files changed

+7
-14
lines changed

Lib/test/datetimetester.py

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

18621862
def test_fromisoformat_fails_typeerror(self):
18631863
# Test that fromisoformat fails when passed the wrong type
1864-
import io
1865-
18661864
bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')]
18671865
for bad_type in bad_types:
18681866
with self.assertRaises(TypeError):
@@ -3985,8 +3983,6 @@ def test_fromisoformat_fails(self):
39853983

39863984
def test_fromisoformat_fails_typeerror(self):
39873985
# Test the fromisoformat fails when passed the wrong type
3988-
import io
3989-
39903986
bad_types = [b'12:30:45', None, io.StringIO('12:30:45')]
39913987

39923988
for bad_type in bad_types:

Lib/test/support/__init__.py

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

13821382
self._platform_specific()
13831383

1384-
def _platform_specific(self):
1385-
pass
1386-
13871384
if sys.platform == "win32":
13881385
def _platform_specific(self):
13891386
import glob
@@ -1411,6 +1408,9 @@ def _platform_specific(self):
14111408
self._env["PYTHONHOME"] = os.path.dirname(self.real)
14121409
if sysconfig.is_python_build(True):
14131410
self._env["PYTHONPATH"] = os.path.dirname(os.__file__)
1411+
else:
1412+
def _platform_specific(self):
1413+
pass
14141414

14151415
def __enter__(self):
14161416
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
@@ -32,7 +32,7 @@ def check(input, expect):
3232
# On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present
3333
def is_code_page_present(cp):
3434
from ctypes import POINTER, WINFUNCTYPE, WinDLL
35-
from ctypes.wintypes import BOOL, UINT, BYTE, WCHAR, UINT, DWORD
35+
from ctypes.wintypes import BOOL, BYTE, WCHAR, UINT, DWORD
3636

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

Lib/test/test_compile.py

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

1026-
def test_func_args(self):
1026+
def test_meth_args(self):
10271027
self.check_stack_size("o.m(" + "x, " * self.N + ")")
10281028

10291029
def test_meth_kwargs(self):

Lib/test/test_dict.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ def test_dict_items_result_gc(self):
14651465
self.assertTrue(gc.is_tracked(next(it)))
14661466

14671467
@support.cpython_only
1468-
def test_dict_items_result_gc(self):
1468+
def test_dict_items_result_gc_reversed(self):
14691469
# Same as test_dict_items_result_gc above, but reversed.
14701470
it = reversed({None: []}.items())
14711471
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_pty.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import unittest
1717

1818
import struct
19-
import tty
2019
import fcntl
2120
import warnings
2221

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)