Skip to content

Commit a363941

Browse files
committed
fix last few files
1 parent b58dc58 commit a363941

File tree

6 files changed

+10
-50
lines changed

6 files changed

+10
-50
lines changed

Lib/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __setitem__(self, key, value):
9797
if _is_private(self._cls_name, key):
9898
import warnings
9999
warnings.warn(
100-
"private variables, such as %r, will be normal attributes in 3.10"
100+
"private variables, such as %r, will be normal attributes in 3.11"
101101
% (key, ),
102102
DeprecationWarning,
103103
stacklevel=2,

Lib/plistlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
from xml.parsers.expat import ParserCreate
6262

6363

64-
PlistFormat = enum.global_enum(enum.Enum('PlistFormat', 'FMT_XML FMT_BINARY', module=__name__))
64+
PlistFormat = enum.Enum('PlistFormat', 'FMT_XML FMT_BINARY', module=__name__)
65+
globals().update(PlistFormat.__members__)
6566

6667

6768
class UID:

Lib/test/test_ast.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ast
22
import builtins
33
import dis
4-
import enum
54
import os
65
import sys
76
import types
@@ -699,35 +698,6 @@ def test_constant_as_name(self):
699698
with self.assertRaisesRegex(ValueError, f"Name node can't be used with '{constant}' constant"):
700699
compile(expr, "<test>", "eval")
701700

702-
def test_precedence_enum(self):
703-
class _Precedence(enum.IntEnum):
704-
"""Precedence table that originated from python grammar."""
705-
TUPLE = enum.auto()
706-
YIELD = enum.auto() # 'yield', 'yield from'
707-
TEST = enum.auto() # 'if'-'else', 'lambda'
708-
OR = enum.auto() # 'or'
709-
AND = enum.auto() # 'and'
710-
NOT = enum.auto() # 'not'
711-
CMP = enum.auto() # '<', '>', '==', '>=', '<=', '!=',
712-
# 'in', 'not in', 'is', 'is not'
713-
EXPR = enum.auto()
714-
BOR = EXPR # '|'
715-
BXOR = enum.auto() # '^'
716-
BAND = enum.auto() # '&'
717-
SHIFT = enum.auto() # '<<', '>>'
718-
ARITH = enum.auto() # '+', '-'
719-
TERM = enum.auto() # '*', '@', '/', '%', '//'
720-
FACTOR = enum.auto() # unary '+', '-', '~'
721-
POWER = enum.auto() # '**'
722-
AWAIT = enum.auto() # 'await'
723-
ATOM = enum.auto()
724-
def next(self):
725-
try:
726-
return self.__class__(self + 1)
727-
except ValueError:
728-
return self
729-
enum._test_simple_enum(_Precedence, ast._Precedence)
730-
731701

732702
class ASTHelpers_Test(unittest.TestCase):
733703
maxDiff = None

Lib/test/test_re.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,13 +2177,11 @@ def test_flags_repr(self):
21772177
"re.IGNORECASE|re.DOTALL|re.VERBOSE")
21782178
self.assertEqual(repr(re.I|re.S|re.X|(1<<20)),
21792179
"re.IGNORECASE|re.DOTALL|re.VERBOSE|0x100000")
2180-
self.assertEqual(
2181-
repr(~re.I),
2182-
"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.DOTALL|re.VERBOSE|re.TEMPLATE|re.DEBUG")
2180+
self.assertEqual(repr(~re.I), "~re.IGNORECASE")
21832181
self.assertEqual(repr(~(re.I|re.S|re.X)),
2184-
"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG")
2182+
"~(re.IGNORECASE|re.DOTALL|re.VERBOSE)")
21852183
self.assertEqual(repr(~(re.I|re.S|re.X|(1<<20))),
2186-
"re.ASCII|re.LOCALE|re.UNICODE|re.MULTILINE|re.TEMPLATE|re.DEBUG|0xffe00")
2184+
"~(re.IGNORECASE|re.DOTALL|re.VERBOSE|0x100000)")
21872185

21882186

21892187
class ImplementationTest(unittest.TestCase):

Lib/test/test_unicode.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,21 +1466,20 @@ class Float(float, enum.Enum):
14661466
PI = 3.1415926
14671467
class Int(enum.IntEnum):
14681468
IDES = 15
1469-
class Str(enum.StrEnum):
1470-
# StrEnum uses the value and not the name for %s etc.
1469+
class Str(str, enum.Enum):
14711470
ABC = 'abc'
14721471
# Testing Unicode formatting strings...
14731472
self.assertEqual("%s, %s" % (Str.ABC, Str.ABC),
1474-
'abc, abc')
1473+
'Str.ABC, Str.ABC')
14751474
self.assertEqual("%s, %s, %d, %i, %u, %f, %5.2f" %
14761475
(Str.ABC, Str.ABC,
14771476
Int.IDES, Int.IDES, Int.IDES,
14781477
Float.PI, Float.PI),
1479-
'abc, abc, 15, 15, 15, 3.141593, 3.14')
1478+
'Str.ABC, Str.ABC, 15, 15, 15, 3.141593, 3.14')
14801479

14811480
# formatting jobs delegated from the string implementation:
14821481
self.assertEqual('...%(foo)s...' % {'foo':Str.ABC},
1483-
'...abc...')
1482+
'...Str.ABC...')
14841483
self.assertEqual('...%(foo)s...' % {'foo':Int.IDES},
14851484
'...Int.IDES...')
14861485
self.assertEqual('...%(foo)i...' % {'foo':Int.IDES},

Lib/test/test_uuid.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import builtins
55
import contextlib
66
import copy
7-
import enum
87
import io
98
import os
109
import pickle
@@ -32,13 +31,6 @@ def get_command_stdout(command, args):
3231
class BaseTestUUID:
3332
uuid = None
3433

35-
def test_safe_uuid_enum(self):
36-
class CheckedSafeUUID(enum.Enum):
37-
safe = 0
38-
unsafe = -1
39-
unknown = None
40-
enum._test_simple_enum(CheckedSafeUUID, py_uuid.SafeUUID)
41-
4234
def test_UUID(self):
4335
equal = self.assertEqual
4436
ascending = []

0 commit comments

Comments
 (0)