Use @skipUnless(). Add nightly Python build. Ignore .cache.
This commit is contained in:
parent
128a08c8df
commit
f08310f635
|
@ -3,6 +3,7 @@ build/
|
|||
dist/
|
||||
.tox/
|
||||
.idea/
|
||||
.cache/
|
||||
__pycache__/
|
||||
tmp/
|
||||
*.swp
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- "nightly"
|
||||
- "3.5"
|
||||
- "3.4"
|
||||
- "3.3"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pickle
|
||||
import re
|
||||
import sys
|
||||
from unittest import TestCase, main
|
||||
from unittest import TestCase, main, skipUnless
|
||||
|
||||
from typing import Any
|
||||
from typing import TypeVar, AnyStr
|
||||
|
@ -1040,40 +1040,42 @@ class CollectionsAbcTests(TestCase):
|
|||
assert isinstance(it, typing.Iterator[int])
|
||||
assert not isinstance(42, typing.Iterator)
|
||||
|
||||
if PY35:
|
||||
def test_awaitable(self):
|
||||
ns = {}
|
||||
exec(
|
||||
"async def foo() -> typing.Awaitable[int]:\n"
|
||||
" return await AwaitableWrapper(42)\n",
|
||||
globals(), ns)
|
||||
foo = ns['foo']
|
||||
g = foo()
|
||||
assert issubclass(type(g), typing.Awaitable[int])
|
||||
assert isinstance(g, typing.Awaitable)
|
||||
assert not isinstance(foo, typing.Awaitable)
|
||||
assert issubclass(typing.Awaitable[Manager],
|
||||
typing.Awaitable[Employee])
|
||||
assert not issubclass(typing.Awaitable[Employee],
|
||||
typing.Awaitable[Manager])
|
||||
g.send(None) # Run foo() till completion, to avoid warning.
|
||||
@skipUnless(PY35, 'Python 3.5 required')
|
||||
def test_awaitable(self):
|
||||
ns = {}
|
||||
exec(
|
||||
"async def foo() -> typing.Awaitable[int]:\n"
|
||||
" return await AwaitableWrapper(42)\n",
|
||||
globals(), ns)
|
||||
foo = ns['foo']
|
||||
g = foo()
|
||||
assert issubclass(type(g), typing.Awaitable[int])
|
||||
assert isinstance(g, typing.Awaitable)
|
||||
assert not isinstance(foo, typing.Awaitable)
|
||||
assert issubclass(typing.Awaitable[Manager],
|
||||
typing.Awaitable[Employee])
|
||||
assert not issubclass(typing.Awaitable[Employee],
|
||||
typing.Awaitable[Manager])
|
||||
g.send(None) # Run foo() till completion, to avoid warning.
|
||||
|
||||
def test_async_iterable(self):
|
||||
base_it = range(10) # type: Iterator[int]
|
||||
it = AsyncIteratorWrapper(base_it)
|
||||
assert isinstance(it, typing.AsyncIterable)
|
||||
assert isinstance(it, typing.AsyncIterable)
|
||||
assert issubclass(typing.AsyncIterable[Manager],
|
||||
typing.AsyncIterable[Employee])
|
||||
assert not isinstance(42, typing.AsyncIterable)
|
||||
@skipUnless(PY35, 'Python 3.5 required')
|
||||
def test_async_iterable(self):
|
||||
base_it = range(10) # type: Iterator[int]
|
||||
it = AsyncIteratorWrapper(base_it)
|
||||
assert isinstance(it, typing.AsyncIterable)
|
||||
assert isinstance(it, typing.AsyncIterable)
|
||||
assert issubclass(typing.AsyncIterable[Manager],
|
||||
typing.AsyncIterable[Employee])
|
||||
assert not isinstance(42, typing.AsyncIterable)
|
||||
|
||||
def test_async_iterator(self):
|
||||
base_it = range(10) # type: Iterator[int]
|
||||
it = AsyncIteratorWrapper(base_it)
|
||||
assert isinstance(it, typing.AsyncIterator)
|
||||
assert issubclass(typing.AsyncIterator[Manager],
|
||||
typing.AsyncIterator[Employee])
|
||||
assert not isinstance(42, typing.AsyncIterator)
|
||||
@skipUnless(PY35, 'Python 3.5 required')
|
||||
def test_async_iterator(self):
|
||||
base_it = range(10) # type: Iterator[int]
|
||||
it = AsyncIteratorWrapper(base_it)
|
||||
assert isinstance(it, typing.AsyncIterator)
|
||||
assert issubclass(typing.AsyncIterator[Manager],
|
||||
typing.AsyncIterator[Employee])
|
||||
assert not isinstance(42, typing.AsyncIterator)
|
||||
|
||||
def test_sized(self):
|
||||
assert isinstance([], typing.Sized)
|
||||
|
|
Loading…
Reference in New Issue