]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46198: rename duplicate tests and remove unused code (GH-30297)
authorNikita Sobolev <mail@sobolevn.me>
Thu, 10 Mar 2022 16:20:11 +0000 (19:20 +0300)
committerGitHub <noreply@github.com>
Thu, 10 Mar 2022 16:20:11 +0000 (08:20 -0800)
Lib/test/datetimetester.py
Lib/test/support/__init__.py
Lib/test/test_asyncio/test_sslproto.py
Lib/test/test_codecs.py
Lib/test/test_compile.py
Lib/test/test_dict.py
Lib/test/test_email/test__header_value_parser.py
Lib/test/test_enum.py
Lib/test/test_pty.py
Lib/test/test_tabnanny.py

index 810478c7db2bea6d3811de798d7232ed199f3b86..df3764d61b186932c93a19ef5856ad4e20a9b869 100644 (file)
@@ -1864,8 +1864,6 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
 
     def test_fromisoformat_fails_typeerror(self):
         # Test that fromisoformat fails when passed the wrong type
-        import io
-
         bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')]
         for bad_type in bad_types:
             with self.assertRaises(TypeError):
@@ -3988,8 +3986,6 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase):
 
     def test_fromisoformat_fails_typeerror(self):
         # Test the fromisoformat fails when passed the wrong type
-        import io
-
         bad_types = [b'12:30:45', None, io.StringIO('12:30:45')]
 
         for bad_type in bad_types:
index 865fb976f532e6b6f9c497b7feb2c2906921e54a..c7bee8be662cc0da467d7628fb627b3b9eebde3a 100644 (file)
@@ -1442,9 +1442,6 @@ class PythonSymlink:
 
         self._platform_specific()
 
-    def _platform_specific(self):
-        pass
-
     if sys.platform == "win32":
         def _platform_specific(self):
             import glob
@@ -1472,6 +1469,9 @@ class PythonSymlink:
             self._env["PYTHONHOME"] = os.path.dirname(self.real)
             if sysconfig.is_python_build(True):
                 self._env["PYTHONPATH"] = STDLIB_DIR
+    else:
+        def _platform_specific(self):
+            pass
 
     def __enter__(self):
         os.symlink(self.real, self.link)
index 6e8de7c84c0aa0e777894f0609e8e058869c3ba1..4095b4dfa84ebdce3d7527e1325c836e9ebb36bb 100644 (file)
@@ -2,7 +2,6 @@
 
 import logging
 import socket
-from test import support
 import unittest
 import weakref
 from unittest import mock
index 8118ec6f4727b8ed581fa15db5c08618101c9f85..5853e0881971536104d34ff877000ac9dc5006bf 100644 (file)
@@ -36,7 +36,7 @@ def coding_checker(self, coder):
 # On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present
 def is_code_page_present(cp):
     from ctypes import POINTER, WINFUNCTYPE, WinDLL
-    from ctypes.wintypes import BOOL, UINT, BYTE, WCHAR, UINT, DWORD
+    from ctypes.wintypes import BOOL, BYTE, WCHAR, UINT, DWORD
 
     MAX_LEADBYTES = 12  # 5 ranges, 2 bytes ea., 0 term.
     MAX_DEFAULTCHAR = 2 # single or double byte
index 79046b8615e3e038faee049cd39f833066f66a55..8499d2855bdd4472f187f35026a31739bc9605ba 100644 (file)
@@ -1189,7 +1189,7 @@ class TestExpressionStackSize(unittest.TestCase):
         kwargs = (f'a{i}=x' for i in range(self.N))
         self.check_stack_size("f(" +  ", ".join(kwargs) + ")")
 
-    def test_func_args(self):
+    def test_meth_args(self):
         self.check_stack_size("o.m(" + "x, " * self.N + ")")
 
     def test_meth_kwargs(self):
index e60ae4309cbc18314e3a9426be7399ff75e33687..5b8baaf9e6e280923d845fbfb508e14708c9905d 100644 (file)
@@ -1455,7 +1455,7 @@ class DictTest(unittest.TestCase):
         self.assertTrue(gc.is_tracked(next(it)))
 
     @support.cpython_only
-    def test_dict_items_result_gc(self):
+    def test_dict_items_result_gc_reversed(self):
         # Same as test_dict_items_result_gc above, but reversed.
         it = reversed({None: []}.items())
         gc.collect()
index 1bdcfa129b4c8717d05bee9118db5e6ea792a005..854f2ff009c61851f58af5213f21e678974c024c 100644 (file)
@@ -395,7 +395,7 @@ class TestParser(TestParserMixin, TestEmailBase):
             [errors.InvalidHeaderDefect],
             '')
 
-    def test_get_unstructured_invalid_ew(self):
+    def test_get_unstructured_invalid_ew2(self):
         self._test_get_x(self._get_unst,
             '=?utf-8?q?=somevalue?=',
             '=?utf-8?q?=somevalue?=',
index b8a7914355c5308475ab46f4eb5792e678ebcde9..f2572b2ac351a763d0f328008ccb28816ec64dc7 100644 (file)
@@ -3708,7 +3708,7 @@ class TestVerify(unittest.TestCase):
             triple = 3
             value = 4
 
-class TestHelpers(unittest.TestCase):
+class TestInternals(unittest.TestCase):
 
     sunder_names = '_bad_', '_good_', '_what_ho_'
     dunder_names = '__mal__', '__bien__', '__que_que__'
index 0781cde1e1582ec1545f6cb16b98f04a4c88c045..fa0dbcc16f3ce85517777feb6558fc260744ce86 100644 (file)
@@ -17,7 +17,6 @@ import io # readline
 import unittest
 
 import struct
-import tty
 import fcntl
 import warnings
 
index 59fdfc5573d373893d7739b9d6691e736ee38c40..e0a82e95c486be325aee0a211c890a215cfc3981 100644 (file)
@@ -4,7 +4,6 @@ Glossary:
     * errored    : Whitespace related problems present in file.
 """
 from unittest import TestCase, mock
-from unittest import mock
 import errno
 import os
 import tabnanny