[3.9] bpo-46198: rename duplicate tests and remove unused code (GH-30297) (GH-31797)

(cherry picked from commit 6c83c8e6b5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Jelle Zijlstra 2022-03-10 13:18:27 -08:00 committed by GitHub
parent 0c47008f8b
commit f7f7838b41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 6 additions and 12 deletions

View file

@ -1861,8 +1861,6 @@ def test_fromisoformat_fails(self):
def test_fromisoformat_fails_typeerror(self): def test_fromisoformat_fails_typeerror(self):
# Test that fromisoformat fails when passed the wrong type # Test that fromisoformat fails when passed the wrong type
import io
bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')] bad_types = [b'2009-03-01', None, io.StringIO('2009-03-01')]
for bad_type in bad_types: for bad_type in bad_types:
with self.assertRaises(TypeError): with self.assertRaises(TypeError):
@ -3985,8 +3983,6 @@ def test_fromisoformat_fails(self):
def test_fromisoformat_fails_typeerror(self): def test_fromisoformat_fails_typeerror(self):
# Test the fromisoformat fails when passed the wrong type # Test the fromisoformat fails when passed the wrong type
import io
bad_types = [b'12:30:45', None, io.StringIO('12:30:45')] bad_types = [b'12:30:45', None, io.StringIO('12:30:45')]
for bad_type in bad_types: for bad_type in bad_types:

View file

@ -2390,9 +2390,6 @@ def __init__(self, link=None):
self._platform_specific() self._platform_specific()
def _platform_specific(self):
pass
if sys.platform == "win32": if sys.platform == "win32":
def _platform_specific(self): def _platform_specific(self):
import _winapi import _winapi
@ -2419,6 +2416,9 @@ def _platform_specific(self):
self._env["PYTHONHOME"] = os.path.dirname(self.real) self._env["PYTHONHOME"] = os.path.dirname(self.real)
if sysconfig.is_python_build(True): if sysconfig.is_python_build(True):
self._env["PYTHONPATH"] = os.path.dirname(os.__file__) self._env["PYTHONPATH"] = os.path.dirname(os.__file__)
else:
def _platform_specific(self):
pass
def __enter__(self): def __enter__(self):
os.symlink(self.real, self.link) os.symlink(self.real, self.link)

View file

@ -2,7 +2,6 @@
import logging import logging
import socket import socket
from test import support
import unittest import unittest
import weakref import weakref
from unittest import mock from unittest import mock

View file

@ -30,7 +30,7 @@ def check(input, expect):
# On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present # On small versions of Windows like Windows IoT or Windows Nano Server not all codepages are present
def is_code_page_present(cp): def is_code_page_present(cp):
from ctypes import POINTER, WINFUNCTYPE, WinDLL 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_LEADBYTES = 12 # 5 ranges, 2 bytes ea., 0 term.
MAX_DEFAULTCHAR = 2 # single or double byte MAX_DEFAULTCHAR = 2 # single or double byte

View file

@ -1435,7 +1435,7 @@ def test_dict_items_result_gc(self):
self.assertTrue(gc.is_tracked(next(it))) self.assertTrue(gc.is_tracked(next(it)))
@support.cpython_only @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. # Same as test_dict_items_result_gc above, but reversed.
it = reversed({None: []}.items()) it = reversed({None: []}.items())
gc.collect() gc.collect()

View file

@ -395,7 +395,7 @@ def test_get_unstructured_without_trailing_whitespace_hang_case(self):
[errors.InvalidHeaderDefect], [errors.InvalidHeaderDefect],
'') '')
def test_get_unstructured_invalid_ew(self): def test_get_unstructured_invalid_ew2(self):
self._test_get_x(self._get_unst, self._test_get_x(self._get_unst,
'=?utf-8?q?=somevalue?=', '=?utf-8?q?=somevalue?=',
'=?utf-8?q?=somevalue?=', '=?utf-8?q?=somevalue?=',

View file

@ -4,7 +4,6 @@
* errored : Whitespace related problems present in file. * errored : Whitespace related problems present in file.
""" """
from unittest import TestCase, mock from unittest import TestCase, mock
from unittest import mock
import errno import errno
import os import os
import tabnanny import tabnanny