[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 <alexei@users.noreply.github.com>
This commit is contained in:
Ethan Furman 2022-08-30 12:39:03 -07:00 committed by GitHub
parent d00a9e0176
commit 8f58db2279
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1904,7 +1904,7 @@ def _test_simple_enum(checked_enum, simple_enum):
else:
checked_value = checked_dict[key]
simple_value = simple_dict[key]
if callable(checked_value):
if callable(checked_value) or isinstance(checked_value, bltns.property):
continue
if key == '__doc__':
# remove all spaces/tabs

View file

@ -4337,10 +4337,16 @@ class TestStdLib(unittest.TestCase):
CYAN = 1
MAGENTA = 2
YELLOW = 3
@bltns.property
def zeroth(self):
return 'zeroed %s' % self.name
class CheckedColor(Enum):
CYAN = 1
MAGENTA = 2
YELLOW = 3
@bltns.property
def zeroth(self):
return 'zeroed %s' % self.name
self.assertTrue(_test_simple_enum(CheckedColor, SimpleColor) is None)
SimpleColor.MAGENTA._value_ = 9
self.assertRaisesRegex(