From fb0ddadd3927fca04aab876ad27c1c6e861d6f56 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 22 Mar 2021 05:54:33 +0000 Subject: [PATCH 1/2] Remove unnecessary use of comprehension --- tests/test_async_py3.py | 14 +++++++------- tests/test_lazy_object_proxy.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_async_py3.py b/tests/test_async_py3.py index dba934f..37be6d9 100644 --- a/tests/test_async_py3.py +++ b/tests/test_async_py3.py @@ -133,7 +133,7 @@ async def foo(): pass with check(): - [i for i in coro] + list(coro) coro.close() @@ -157,7 +157,7 @@ async def foo(): # the following should pass without an error for el in lop.Proxy(bar): assert el == 1 - assert [el for el in lop.Proxy(bar)] == [1] + assert list(lop.Proxy(bar)) == [1] assert tuple(lop.Proxy(bar)) == (1,) assert next(iter(lop.Proxy(bar))) == 1 @@ -1090,7 +1090,7 @@ async def test2(): # Make sure that __aiter__ was called only once assert aiter_calls == 2 assert yielded == [100, 200] - assert buffer == [i for i in range(1, 21)] + ['end'] + assert buffer == list(range(1, 21)) + ['end'] buffer = [] @@ -1108,7 +1108,7 @@ async def test3(): # Make sure that __aiter__ was called only once assert aiter_calls == 3 assert yielded == [i * 100 for i in range(1, 11)] - assert buffer == [i for i in range(1, 21)] + \ + assert buffer == list(range(1, 21)) + \ ['what?', 'end'] @@ -1570,7 +1570,7 @@ async def run_list(): def test_comp_8(lop): async def f(): - return [i for i in [1, 2, 3]] + return list([1, 2, 3]) assert run_async(f()) == \ ([], [1, 2, 3]) @@ -1583,7 +1583,7 @@ async def gen(): async def f(): l = [i async for i in gen()] - return [i for i in l] + return list(l) assert run_async(f()) == \ ([], [1, 2]) @@ -1591,7 +1591,7 @@ async def f(): def test_comp_10(lop): async def f(): - xx = {i for i in [1, 2, 3]} + xx = set([1, 2, 3]) return {x: x for x in xx} assert run_async(f()) == \ diff --git a/tests/test_lazy_object_proxy.py b/tests/test_lazy_object_proxy.py index 879539a..d9755f8 100644 --- a/tests/test_lazy_object_proxy.py +++ b/tests/test_lazy_object_proxy.py @@ -779,7 +779,7 @@ def test_iteration(lop): wrapper = lop.Proxy(lambda: items) - result = [x for x in wrapper] + result = list(wrapper) assert result == items From 447521cf3b4c62dcc61a478c940d80ffb156d1c9 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 22 Mar 2021 05:56:20 +0000 Subject: [PATCH 2/2] Autofix issues in 1 file Resolved issues in tests/test_async_py3.py via DeepSource Autofix --- tests/test_async_py3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_async_py3.py b/tests/test_async_py3.py index 37be6d9..992569c 100644 --- a/tests/test_async_py3.py +++ b/tests/test_async_py3.py @@ -1591,7 +1591,7 @@ async def f(): def test_comp_10(lop): async def f(): - xx = set([1, 2, 3]) + xx = {1, 2, 3} return {x: x for x in xx} assert run_async(f()) == \
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: