[3.12] gh-111181: Fix enum doctests (GH-111180) (GH-111518)

gh-111181: Fix enum doctests (GH-111180)
(cherry picked from commit c4dc5a6ae8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
This commit is contained in:
Miss Islington (bot) 2023-10-31 23:01:28 +01:00 committed by GitHub
parent 4f619e83fe
commit ec00397912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 15 deletions

View file

@ -18,7 +18,7 @@ from enum import member, nonmember, _iter_bits_lsb
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from test.support import ALWAYS_EQ
from test.support import ALWAYS_EQ, REPO_ROOT
from test.support import threading_helper
from datetime import timedelta
@ -26,14 +26,19 @@ python_version = sys.version_info[:2]
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(enum))
if os.path.exists('Doc/library/enum.rst'):
lib_tests = os.path.join(REPO_ROOT, 'Doc/library/enum.rst')
if os.path.exists(lib_tests):
tests.addTests(doctest.DocFileSuite(
'../../Doc/library/enum.rst',
lib_tests,
module_relative=False,
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
))
if os.path.exists('Doc/howto/enum.rst'):
howto_tests = os.path.join(REPO_ROOT, 'Doc/howto/enum.rst')
if os.path.exists(howto_tests):
tests.addTests(doctest.DocFileSuite(
'../../Doc/howto/enum.rst',
howto_tests,
module_relative=False,
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
))
return tests
@ -5127,7 +5132,7 @@ def member_dir(member):
allowed.add(name)
else:
allowed.discard(name)
else:
elif name not in member._member_map_:
allowed.add(name)
return sorted(allowed)