Skip to content

Commit d76efe1

Browse files
committed
Run ruff over.
1 parent bdcc696 commit d76efe1

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

Diff for: .pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
rev: v0.7.4
1010
hooks:
1111
- id: ruff
12-
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
12+
args: [--fix, --exit-non-zero-on-fix, --show-fixes, --unsafe-fixes]
1313
- id: ruff-format
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
1515
rev: v5.0.0

Diff for: tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class FakeModule:
2828
elif name == 'django':
2929
Proxy = pytest.importorskip('django.utils.functional').SimpleLazyObject
3030
else:
31-
raise RuntimeError('Unsupported param: %r.' % name)
31+
raise RuntimeError(f'Unsupported param: {name!r}.')
3232

3333
Proxy # noqa: B018
3434

@@ -68,7 +68,7 @@ def lop(request, lop_subclass):
6868
if request.node.get_closest_marker('xfail_subclass'):
6969
request.applymarker(
7070
pytest.mark.xfail(
71-
reason="This test can't work because subclassing disables certain " "features like __doc__ and __module__ proxying."
71+
reason="This test can't work because subclassing disables certain features like __doc__ and __module__ proxying."
7272
)
7373
)
7474
if request.node.get_closest_marker('xfail_simple'):

Diff for: tests/test_async_py3.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_func_2(lop):
9999
async def foo():
100100
raise StopIteration
101101

102-
with pytest.raises(RuntimeError, match="coroutine raised StopIteration"):
102+
with pytest.raises(RuntimeError, match='coroutine raised StopIteration'):
103103
run_async(lop.Proxy(foo))
104104

105105

@@ -275,7 +275,7 @@ async def g():
275275
await foo
276276

277277
me = lop.Proxy(g)
278-
with pytest.raises(ValueError, match="coroutine already executing"):
278+
with pytest.raises(ValueError, match='coroutine already executing'):
279279
me.send(None)
280280

281281

@@ -303,7 +303,7 @@ async def coro():
303303

304304
c = lop.Proxy(coro)
305305
c.send(None)
306-
with pytest.raises(RuntimeError, match="coroutine ignored GeneratorExit"):
306+
with pytest.raises(RuntimeError, match='coroutine ignored GeneratorExit'):
307307
c.close()
308308

309309

@@ -498,15 +498,15 @@ def test_await_1(lop):
498498
async def foo():
499499
await 1
500500

501-
with pytest.raises(TypeError, match="object int can.t.*await"):
501+
with pytest.raises(TypeError, match='object int can.t.*await'):
502502
run_async(lop.Proxy(foo))
503503

504504

505505
def test_await_2(lop):
506506
async def foo():
507507
await []
508508

509-
with pytest.raises(TypeError, match="object list can.t.*await"):
509+
with pytest.raises(TypeError, match='object list can.t.*await'):
510510
run_async(lop.Proxy(foo))
511511

512512

@@ -536,7 +536,7 @@ def __await__(self):
536536
async def foo():
537537
return await lop.Proxy(Awaitable)
538538

539-
with pytest.raises(TypeError, match="__await__.*returned non-iterator of type"):
539+
with pytest.raises(TypeError, match='__await__.*returned non-iterator of type'):
540540
run_async(lop.Proxy(foo))
541541

542542

@@ -644,7 +644,7 @@ def __await__(self):
644644
async def foo():
645645
return await lop.Proxy(Awaitable)
646646

647-
with pytest.raises(TypeError, match=r"__await__\(\) returned a coroutine"):
647+
with pytest.raises(TypeError, match=r'__await__\(\) returned a coroutine'):
648648
run_async(lop.Proxy(foo))
649649

650650
c.close()
@@ -658,7 +658,7 @@ def __await__(self):
658658
async def foo():
659659
return await lop.Proxy(Awaitable)
660660

661-
with pytest.raises(TypeError, match="__await__.*returned non-iterator of type"):
661+
with pytest.raises(TypeError, match='__await__.*returned non-iterator of type'):
662662
run_async(lop.Proxy(foo))
663663

664664

@@ -713,7 +713,7 @@ async def waiter(coro):
713713
coro = lop.Proxy(coroutine)
714714
coro.send(None)
715715

716-
with pytest.raises(RuntimeError, match="coroutine is being awaited already"):
716+
with pytest.raises(RuntimeError, match='coroutine is being awaited already'):
717717
waiter(coro).send(None)
718718

719719

@@ -749,7 +749,7 @@ async def __aexit__(self, *args):
749749
return True
750750

751751
async def foo():
752-
async with lop.Proxy(lambda: Manager("A")) as a, lop.Proxy(lambda: Manager("B")) as b:
752+
async with lop.Proxy(lambda: Manager('A')) as a, lop.Proxy(lambda: Manager('B')) as b:
753753
await lop.Proxy(lambda: AsyncYieldFrom([('managers', a.name, b.name)]))
754754
1 / 0
755755

@@ -769,7 +769,7 @@ async def foo():
769769
]
770770

771771
async def foo():
772-
async with lop.Proxy(lambda: Manager("A")) as a, lop.Proxy(lambda: Manager("C")) as c:
772+
async with lop.Proxy(lambda: Manager('A')) as a, lop.Proxy(lambda: Manager('C')) as c:
773773
await lop.Proxy(lambda: AsyncYieldFrom([('managers', a.name, c.name)]))
774774
1 / 0
775775

@@ -857,7 +857,7 @@ async def foo():
857857
async with lop.Proxy(CM):
858858
pass
859859

860-
with pytest.raises(TypeError, match="'async with' received an object from __aenter__ " "that does not implement __await__: int"):
860+
with pytest.raises(TypeError, match="'async with' received an object from __aenter__ " 'that does not implement __await__: int'):
861861
# it's important that __aexit__ wasn't called
862862
run_async(lop.Proxy(foo))
863863

@@ -879,7 +879,7 @@ async def foo():
879879
try:
880880
run_async(lop.Proxy(foo))
881881
except TypeError as exc:
882-
assert re.search("'async with' received an object from __aexit__ " "that does not implement __await__: int", exc.args[0])
882+
assert re.search("'async with' received an object from __aexit__ " 'that does not implement __await__: int', exc.args[0])
883883
assert exc.__context__ is not None
884884
assert isinstance(exc.__context__, ZeroDivisionError)
885885
else:
@@ -903,7 +903,7 @@ async def foo():
903903
async with lop.Proxy(CM):
904904
CNT += 1
905905

906-
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " "that does not implement __await__: int"):
906+
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " 'that does not implement __await__: int'):
907907
run_async(lop.Proxy(foo))
908908
assert CNT == 1
909909

@@ -915,7 +915,7 @@ async def foo():
915915
CNT += 1
916916
break
917917

918-
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " "that does not implement __await__: int"):
918+
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " 'that does not implement __await__: int'):
919919
run_async(lop.Proxy(foo))
920920
assert CNT == 2
921921

@@ -927,7 +927,7 @@ async def foo():
927927
CNT += 1
928928
continue
929929

930-
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " "that does not implement __await__: int"):
930+
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " 'that does not implement __await__: int'):
931931
run_async(lop.Proxy(foo))
932932
assert CNT == 3
933933

@@ -938,7 +938,7 @@ async def foo():
938938
CNT += 1
939939
return
940940

941-
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " "that does not implement __await__: int"):
941+
with pytest.raises(TypeError, match="'async with' received an object from __aexit__ " 'that does not implement __await__: int'):
942942
run_async(lop.Proxy(foo))
943943
assert CNT == 4
944944

@@ -1224,7 +1224,7 @@ async def main():
12241224
I += 1000
12251225

12261226
with warnings.catch_warnings():
1227-
warnings.simplefilter("error")
1227+
warnings.simplefilter('error')
12281228
# Test that __aiter__ that returns an asynchronous iterator
12291229
# directly does not throw any warnings.
12301230
run_async(main())
@@ -1309,7 +1309,7 @@ async def foo():
13091309

13101310
with pytest.raises(ZeroDivisionError):
13111311
with warnings.catch_warnings():
1312-
warnings.simplefilter("error")
1312+
warnings.simplefilter('error')
13131313
# Test that if __aiter__ raises an exception it propagates
13141314
# without any kind of warning.
13151315
run_async(lop.Proxy(foo))
@@ -1622,7 +1622,7 @@ async def func():
16221622
aw.close()
16231623

16241624

1625-
@pytest.mark.skipif("sys.version_info[1] < 8")
1625+
@pytest.mark.skipif('sys.version_info[1] < 8')
16261626
def test_for_assign_raising_stop_async_iteration(lop):
16271627
class BadTarget:
16281628
def __setitem__(self, key, value):
@@ -1662,7 +1662,7 @@ async def run_gen():
16621662
assert run_async(run_gen()) == ([], 'end')
16631663

16641664

1665-
@pytest.mark.skipif("sys.version_info[1] < 8")
1665+
@pytest.mark.skipif('sys.version_info[1] < 8')
16661666
def test_for_assign_raising_stop_async_iteration_2(lop):
16671667
class BadIterable:
16681668
def __iter__(self):

0 commit comments

Comments
 (0)