diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 810478c7db2..4ffc02277df 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -254,7 +254,6 @@ def test_str(self): self.assertEqual(str(tz), tz.tzname(None)) def test_repr(self): - datetime = datetime_module for tz in [self.ACDT, self.EST, timezone.utc, timezone.min, timezone.max]: # test round-trip @@ -1864,8 +1863,6 @@ def test_fromisoformat_fails(self): 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 +3985,6 @@ def test_fromisoformat_fails(self): 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: diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index f924826db94..c55b063b999 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -32,7 +32,7 @@ def check(input, expect): # 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 diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 11615b32232..dd4c8eb3843 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -1175,7 +1175,7 @@ def test_func_kwargs(self): 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): diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 66f5d56deea..01081bbc427 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -1438,7 +1438,7 @@ def test_dict_items_result_gc(self): 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() diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index eecb9fd4835..134921858fe 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -857,14 +857,14 @@ def __format__(self, spec): python_version < (3, 12), 'mixin-format is still using member.value', ) - def test_mixin_format_warning(self): + def test_mixin_format_future_warning(self): class Grades(int, Enum): A = 5 B = 4 C = 3 D = 2 F = 0 - self.assertEqual(f'{self.Grades.B}', 'B') + self.assertEqual(f'{Grades.B}', 'B') @unittest.skipIf( python_version >= (3, 12), diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index c95bc15e727..f0021dd781f 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -1522,9 +1522,6 @@ def error2(): """ self._check_error(source, "parameter and nonlocal", lineno=3) - def test_break_outside_loop(self): - self._check_error("break", "outside loop") - def test_yield_outside_function(self): self._check_error("if 0: yield", "outside function") self._check_error("if 0: yield\nelse: x=1", "outside function") @@ -1553,6 +1550,7 @@ def test_return_outside_function(self): "outside function") def test_break_outside_loop(self): + self._check_error("break", "outside loop") self._check_error("if 0: break", "outside loop") self._check_error("if 0: break\nelse: x=1", "outside loop") self._check_error("if 1: pass\nelse: break", "outside loop")