Skip to content

Commit 8f58db2

Browse files
ethanfurmanalexei
andauthored
[3.11] [Enum] fix check in _test_simple_enum (GH-96435)
The builtin `property` is not a callable, so was failing the check in `_test_simple_enum` causing a match failure; this adds `property` to the bypass list. Co-authored-by: Alexandru Mărășteanu <[email protected]>
1 parent d00a9e0 commit 8f58db2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/enum.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@ def _test_simple_enum(checked_enum, simple_enum):
19041904
else:
19051905
checked_value = checked_dict[key]
19061906
simple_value = simple_dict[key]
1907-
if callable(checked_value):
1907+
if callable(checked_value) or isinstance(checked_value, bltns.property):
19081908
continue
19091909
if key == '__doc__':
19101910
# remove all spaces/tabs

Lib/test/test_enum.py

+6
Original file line numberDiff line numberDiff line change
@@ -4337,10 +4337,16 @@ class SimpleColor:
43374337
CYAN = 1
43384338
MAGENTA = 2
43394339
YELLOW = 3
4340+
@bltns.property
4341+
def zeroth(self):
4342+
return 'zeroed %s' % self.name
43404343
class CheckedColor(Enum):
43414344
CYAN = 1
43424345
MAGENTA = 2
43434346
YELLOW = 3
4347+
@bltns.property
4348+
def zeroth(self):
4349+
return 'zeroed %s' % self.name
43444350
self.assertTrue(_test_simple_enum(CheckedColor, SimpleColor) is None)
43454351
SimpleColor.MAGENTA._value_ = 9
43464352
self.assertRaisesRegex(

0 commit comments

Comments
 (0)