Changed zero length assertions to falsy

This commit is contained in:
Andrew Murray 2021-02-11 13:48:31 +11:00
parent 01be700081
commit 4a0569e97f
16 changed files with 25 additions and 25 deletions

View File

@ -28,7 +28,7 @@ def test_bad():
pass
# Assert that there is no unclosed file warning
assert len(record) == 0
assert not record
def test_questionable():

View File

@ -36,7 +36,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -44,7 +44,7 @@ def test_context_manager():
with Image.open(TEST_FILE) as im:
im.load()
assert len(record) == 0
assert not record
def test_invalid_file():

View File

@ -43,7 +43,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -51,7 +51,7 @@ def test_context_manager():
with Image.open(static_test_file) as im:
im.load()
assert len(record) == 0
assert not record
def test_tell():

View File

@ -43,7 +43,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -51,7 +51,7 @@ def test_context_manager():
with Image.open(TEST_GIF) as im:
im.load()
assert len(record) == 0
assert not record
def test_invalid_file():

View File

@ -21,7 +21,7 @@ def test_sanity():
# Assert that there is no unclosed file warning
with pytest.warns(None) as record:
im.load()
assert len(record) == 0
assert not record
assert im.mode == "RGBA"
assert im.size == (1024, 1024)

View File

@ -40,7 +40,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -48,7 +48,7 @@ def test_context_manager():
with Image.open(TEST_IM) as im:
im.load()
assert len(record) == 0
assert not record
def test_tell():

View File

@ -733,7 +733,7 @@ class TestFileJpeg:
out = str(tmp_path / "out.jpg")
with pytest.warns(None) as record:
im.save(out, exif=exif)
assert len(record) == 0
assert not record
with Image.open(out) as reloaded:
assert reloaded.getexif()[282] == 180

View File

@ -46,7 +46,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -54,7 +54,7 @@ def test_context_manager():
with Image.open(test_files[0]) as im:
im.load()
assert len(record) == 0
assert not record
def test_app():

View File

@ -326,7 +326,7 @@ class TestFilePng:
# Assert that there is no unclosed file warning
with pytest.warns(None) as record:
im.verify()
assert len(record) == 0
assert not record
with Image.open(TEST_PNG_FILE) as im:
im.load()

View File

@ -34,7 +34,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -42,7 +42,7 @@ def test_context_manager():
with Image.open(test_file) as im:
im.load()
assert len(record) == 0
assert not record
def test_invalid_file():

View File

@ -33,7 +33,7 @@ def test_closed_file():
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager():
@ -41,7 +41,7 @@ def test_context_manager():
with Image.open(TEST_FILE) as im:
im.load()
assert len(record) == 0
assert not record
def test_save(tmp_path):

View File

@ -35,7 +35,7 @@ def test_close():
tar = TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg")
tar.close()
assert len(record) == 0
assert not record
def test_contextmanager():
@ -43,4 +43,4 @@ def test_contextmanager():
with TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg"):
pass
assert len(record) == 0
assert not record

View File

@ -64,14 +64,14 @@ class TestFileTiff:
im.load()
im.close()
assert len(record) == 0
assert not record
def test_context_manager(self):
with pytest.warns(None) as record:
with Image.open("Tests/images/multipage.tiff") as im:
im.load()
assert len(record) == 0
assert not record
def test_mac_tiff(self):
# Read RGBa images from macOS [@PIL136]

View File

@ -147,7 +147,7 @@ class TestFileWebp:
temp_file = str(tmp_path / "temp.webp")
with pytest.warns(None) as record:
image.save(temp_file)
assert len(record) == 0
assert not record
def test_file_pointer_could_be_reused(self):
file_path = "Tests/images/hopper.webp"

View File

@ -638,7 +638,7 @@ class TestImage:
with Image.open(test_file) as im:
with pytest.warns(None) as record:
im.save(temp_file)
assert len(record) == 0
assert not record
def test_load_on_nonexclusive_multiframe(self):
with open("Tests/images/frozenpond.mpo", "rb") as fp:

View File

@ -236,4 +236,4 @@ def test_no_resource_warning_for_numpy_array():
# Act/Assert
with pytest.warns(None) as record:
array(im)
assert len(record) == 0
assert not record