Modernise
This commit is contained in:
parent
4c6441182b
commit
8faee98ec6
44 changed files with 214 additions and 201 deletions
12
tests/external/test_internals.py
vendored
12
tests/external/test_internals.py
vendored
|
|
@ -24,7 +24,8 @@ class Wrapped:
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_done_callback_cancelled(loop):
|
||||
async def test_done_callback_cancelled():
|
||||
loop = asyncio.get_running_loop()
|
||||
task = loop.create_future()
|
||||
fut = loop.create_future()
|
||||
|
||||
|
|
@ -38,7 +39,8 @@ async def test_done_callback_cancelled(loop):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_done_callback_exception(loop):
|
||||
async def test_done_callback_exception():
|
||||
loop = asyncio.get_running_loop()
|
||||
task = loop.create_future()
|
||||
fut = loop.create_future()
|
||||
|
||||
|
|
@ -60,7 +62,8 @@ async def test_done_callback_exception(loop):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_done_callback(loop):
|
||||
async def test_done_callback():
|
||||
loop = asyncio.get_running_loop()
|
||||
task = loop.create_future()
|
||||
fut = loop.create_future()
|
||||
|
||||
|
|
@ -228,7 +231,8 @@ def test_close(loop):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_wait_closed(loop):
|
||||
async def test_wait_closed():
|
||||
loop = asyncio.get_running_loop()
|
||||
wrapped = Wrapped()
|
||||
wrapped.tasks = set()
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,11 @@ def test_simple() -> None:
|
|||
assert c.first_key == "András"
|
||||
assert c.second_key == "test 2"
|
||||
assert c.third_key == "test= 2=="
|
||||
assert (
|
||||
c.fourth_key
|
||||
== """
|
||||
assert c.fourth_key == """
|
||||
this#
|
||||
is
|
||||
multiline
|
||||
"""
|
||||
)
|
||||
assert c.whitespace == "hardly matters"
|
||||
with pytest.raises(KeyError):
|
||||
c.this
|
||||
|
|
@ -34,14 +31,11 @@ def test_simple_dict() -> None:
|
|||
assert c["my_hashtag"] == "#great_ai"
|
||||
assert c["second_key"] == "test 2"
|
||||
assert c["third_key"] == "test= 2=="
|
||||
assert (
|
||||
c["fourth_key"]
|
||||
== """
|
||||
assert c["fourth_key"] == """
|
||||
this#
|
||||
is
|
||||
multiline
|
||||
"""
|
||||
)
|
||||
assert c["whitespace"] == "hardly matters"
|
||||
with pytest.raises(KeyError):
|
||||
c["#this"]
|
||||
|
|
@ -55,14 +49,11 @@ def test_string_path() -> None:
|
|||
|
||||
assert c.second_key == "test 2"
|
||||
assert c.third_key == "test= 2=="
|
||||
assert (
|
||||
c.fourth_key
|
||||
== """
|
||||
assert c.fourth_key == """
|
||||
this#
|
||||
is
|
||||
multiline
|
||||
"""
|
||||
)
|
||||
assert c.whitespace == "hardly matters"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ def test_with_iterable() -> None:
|
|||
|
||||
expected = [v**3 for v in range(10)]
|
||||
|
||||
assert (
|
||||
list(parallel_map(lambda x: x**3, my_generator(), chunk_size=1)) == expected
|
||||
)
|
||||
assert list(parallel_map(lambda x: x**3, my_generator(), chunk_size=1)) == expected
|
||||
|
||||
|
||||
def test_simple_case_invalid_values() -> None:
|
||||
|
|
@ -44,14 +42,10 @@ def test_this_process_exception() -> None:
|
|||
assert False
|
||||
|
||||
with pytest.raises(AssertionError):
|
||||
list(
|
||||
parallel_map(lambda v: v**2, my_generator(), concurrency=2, chunk_size=2)
|
||||
)
|
||||
list(parallel_map(lambda v: v**2, my_generator(), concurrency=2, chunk_size=2))
|
||||
|
||||
with pytest.raises(AssertionError):
|
||||
list(
|
||||
parallel_map(lambda v: v**2, my_generator(), concurrency=1, chunk_size=2)
|
||||
)
|
||||
list(parallel_map(lambda v: v**2, my_generator(), concurrency=1, chunk_size=2))
|
||||
|
||||
|
||||
def test_ignore_this_process_exception() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue