mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fix PT018: Assert only one thing
This commit is contained in:
parent
5c282d0299
commit
5747267eb3
|
@ -1019,13 +1019,16 @@ class TestFileJpeg:
|
||||||
|
|
||||||
# SOI, EOI
|
# SOI, EOI
|
||||||
for marker in b"\xff\xd8", b"\xff\xd9":
|
for marker in b"\xff\xd8", b"\xff\xd9":
|
||||||
assert marker in data[1] and marker in data[2]
|
assert marker in data[1]
|
||||||
|
assert marker in data[2]
|
||||||
# DHT, DQT
|
# DHT, DQT
|
||||||
for marker in b"\xff\xc4", b"\xff\xdb":
|
for marker in b"\xff\xc4", b"\xff\xdb":
|
||||||
assert marker in data[1] and marker not in data[2]
|
assert marker in data[1]
|
||||||
|
assert marker not in data[2]
|
||||||
# SOF0, SOS, APP0 (JFIF header)
|
# SOF0, SOS, APP0 (JFIF header)
|
||||||
for marker in b"\xff\xc0", b"\xff\xda", b"\xff\xe0":
|
for marker in b"\xff\xc0", b"\xff\xda", b"\xff\xe0":
|
||||||
assert marker not in data[1] and marker in data[2]
|
assert marker not in data[1]
|
||||||
|
assert marker in data[2]
|
||||||
|
|
||||||
with Image.open(BytesIO(data[0])) as interchange_im:
|
with Image.open(BytesIO(data[0])) as interchange_im:
|
||||||
with Image.open(BytesIO(data[1] + data[2])) as combined_im:
|
with Image.open(BytesIO(data[1] + data[2])) as combined_im:
|
||||||
|
|
|
@ -398,7 +398,8 @@ def test_logical() -> None:
|
||||||
for y in (a, b):
|
for y in (a, b):
|
||||||
imy = Image.new("1", (1, 1), y)
|
imy = Image.new("1", (1, 1), y)
|
||||||
value = op(imx, imy).getpixel((0, 0))
|
value = op(imx, imy).getpixel((0, 0))
|
||||||
assert not isinstance(value, tuple) and value is not None
|
assert not isinstance(value, tuple)
|
||||||
|
assert value is not None
|
||||||
out.append(value)
|
out.append(value)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@ def img_to_string(im: Image.Image) -> str:
|
||||||
line = ""
|
line = ""
|
||||||
for c in range(im.width):
|
for c in range(im.width):
|
||||||
value = im.getpixel((c, r))
|
value = im.getpixel((c, r))
|
||||||
assert not isinstance(value, tuple) and value is not None
|
assert not isinstance(value, tuple)
|
||||||
|
assert value is not None
|
||||||
line += chars[value > 0]
|
line += chars[value > 0]
|
||||||
result.append(line)
|
result.append(line)
|
||||||
return "\n".join(result)
|
return "\n".join(result)
|
||||||
|
|
|
@ -54,8 +54,8 @@ def test_nonetype() -> None:
|
||||||
assert xres.denominator is not None
|
assert xres.denominator is not None
|
||||||
assert yres._val is not None
|
assert yres._val is not None
|
||||||
|
|
||||||
assert xres and 1
|
assert xres
|
||||||
assert xres and yres
|
assert yres
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
@ -127,7 +127,6 @@ lint.ignore = [
|
||||||
"PT012", # pytest-raises-with-multiple-statements
|
"PT012", # pytest-raises-with-multiple-statements
|
||||||
"PT016", # pytest-fail-without-message
|
"PT016", # pytest-fail-without-message
|
||||||
"PT017", # pytest-assert-in-except
|
"PT017", # pytest-assert-in-except
|
||||||
"PT018", # pytest-composite-assertion
|
|
||||||
"PYI026", # flake8-pyi: typing.TypeAlias added in Python 3.10
|
"PYI026", # flake8-pyi: typing.TypeAlias added in Python 3.10
|
||||||
"PYI034", # flake8-pyi: typing.Self added in Python 3.11
|
"PYI034", # flake8-pyi: typing.Self added in Python 3.11
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user