Skip to content

bpo-41477: Make ctypes optional in test_genericalias #21766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 42 additions & 38 deletions Lib/test/test_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
from dataclasses import Field
from functools import partial, partialmethod, cached_property
from mailbox import Mailbox, _PartialFile
from ctypes import Array, LibraryLoader
try:
import ctypes
except ImportError:
ctypes = None
from difflib import SequenceMatcher
from filecmp import dircmp
from fileinput import FileInput
Expand Down Expand Up @@ -46,43 +49,44 @@ class BaseTest(unittest.TestCase):
"""Test basics."""

def test_subscriptable(self):
for t in (type, tuple, list, dict, set, frozenset, enumerate,
defaultdict, deque,
SequenceMatcher,
dircmp,
FileInput,
OrderedDict, Counter, UserDict, UserList,
Pattern, Match,
partial, partialmethod, cached_property,
AbstractContextManager, AbstractAsyncContextManager,
Awaitable, Coroutine,
AsyncIterable, AsyncIterator,
AsyncGenerator, Generator,
Iterable, Iterator,
Reversible,
Container, Collection,
Callable,
Mailbox, _PartialFile,
ContextVar, Token,
Field,
Set, MutableSet,
Mapping, MutableMapping, MappingView,
KeysView, ItemsView, ValuesView,
Sequence, MutableSequence,
MappingProxyType, AsyncGeneratorType,
DirEntry,
chain,
TemporaryDirectory, SpooledTemporaryFile,
Queue, SimpleQueue,
_AssertRaisesContext,
Array, LibraryLoader,
SplitResult, ParseResult,
ValueProxy, ApplyResult,
WeakSet, ReferenceType, ref,
ShareableList, SimpleQueue,
Future, _WorkItem,
Morsel,
):
types = [type, tuple, list, dict, set, frozenset, enumerate,
defaultdict, deque,
SequenceMatcher,
dircmp,
FileInput,
OrderedDict, Counter, UserDict, UserList,
Pattern, Match,
partial, partialmethod, cached_property,
AbstractContextManager, AbstractAsyncContextManager,
Awaitable, Coroutine,
AsyncIterable, AsyncIterator,
AsyncGenerator, Generator,
Iterable, Iterator,
Reversible,
Container, Collection,
Callable,
Mailbox, _PartialFile,
ContextVar, Token,
Field,
Set, MutableSet,
Mapping, MutableMapping, MappingView,
KeysView, ItemsView, ValuesView,
Sequence, MutableSequence,
MappingProxyType, AsyncGeneratorType,
DirEntry,
chain,
TemporaryDirectory, SpooledTemporaryFile,
Queue, SimpleQueue,
_AssertRaisesContext,
SplitResult, ParseResult,
ValueProxy, ApplyResult,
WeakSet, ReferenceType, ref,
ShareableList, SimpleQueue,
Future, _WorkItem,
Morsel]
if ctypes is not None:
types.extend((ctypes.Array, ctypes.LibraryLoader))
for t in types:
if t is None:
continue
tname = t.__name__
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make ctypes optional in test_genericalias.