mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	Changed zero length assertions to falsy
This commit is contained in:
		
							parent
							
								
									01be700081
								
							
						
					
					
						commit
						4a0569e97f
					
				| 
						 | 
					@ -28,7 +28,7 @@ def test_bad():
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Assert that there is no unclosed file warning
 | 
					        # Assert that there is no unclosed file warning
 | 
				
			||||||
        assert len(record) == 0
 | 
					        assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_questionable():
 | 
					def test_questionable():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(TEST_FILE) as im:
 | 
					        with Image.open(TEST_FILE) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_invalid_file():
 | 
					def test_invalid_file():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(static_test_file) as im:
 | 
					        with Image.open(static_test_file) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_tell():
 | 
					def test_tell():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(TEST_GIF) as im:
 | 
					        with Image.open(TEST_GIF) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_invalid_file():
 | 
					def test_invalid_file():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ def test_sanity():
 | 
				
			||||||
        # Assert that there is no unclosed file warning
 | 
					        # Assert that there is no unclosed file warning
 | 
				
			||||||
        with pytest.warns(None) as record:
 | 
					        with pytest.warns(None) as record:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
        assert len(record) == 0
 | 
					        assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert im.mode == "RGBA"
 | 
					        assert im.mode == "RGBA"
 | 
				
			||||||
        assert im.size == (1024, 1024)
 | 
					        assert im.size == (1024, 1024)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -48,7 +48,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(TEST_IM) as im:
 | 
					        with Image.open(TEST_IM) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_tell():
 | 
					def test_tell():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -733,7 +733,7 @@ class TestFileJpeg:
 | 
				
			||||||
            out = str(tmp_path / "out.jpg")
 | 
					            out = str(tmp_path / "out.jpg")
 | 
				
			||||||
            with pytest.warns(None) as record:
 | 
					            with pytest.warns(None) as record:
 | 
				
			||||||
                im.save(out, exif=exif)
 | 
					                im.save(out, exif=exif)
 | 
				
			||||||
            assert len(record) == 0
 | 
					            assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with Image.open(out) as reloaded:
 | 
					        with Image.open(out) as reloaded:
 | 
				
			||||||
            assert reloaded.getexif()[282] == 180
 | 
					            assert reloaded.getexif()[282] == 180
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(test_files[0]) as im:
 | 
					        with Image.open(test_files[0]) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_app():
 | 
					def test_app():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ class TestFilePng:
 | 
				
			||||||
            # Assert that there is no unclosed file warning
 | 
					            # Assert that there is no unclosed file warning
 | 
				
			||||||
            with pytest.warns(None) as record:
 | 
					            with pytest.warns(None) as record:
 | 
				
			||||||
                im.verify()
 | 
					                im.verify()
 | 
				
			||||||
            assert len(record) == 0
 | 
					            assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with Image.open(TEST_PNG_FILE) as im:
 | 
					        with Image.open(TEST_PNG_FILE) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(test_file) as im:
 | 
					        with Image.open(test_file) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_invalid_file():
 | 
					def test_invalid_file():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ def test_closed_file():
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_context_manager():
 | 
					def test_context_manager():
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ def test_context_manager():
 | 
				
			||||||
        with Image.open(TEST_FILE) as im:
 | 
					        with Image.open(TEST_FILE) as im:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_save(tmp_path):
 | 
					def test_save(tmp_path):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ def test_close():
 | 
				
			||||||
        tar = TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg")
 | 
					        tar = TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg")
 | 
				
			||||||
        tar.close()
 | 
					        tar.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_contextmanager():
 | 
					def test_contextmanager():
 | 
				
			||||||
| 
						 | 
					@ -43,4 +43,4 @@ def test_contextmanager():
 | 
				
			||||||
        with TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg"):
 | 
					        with TarIO.TarIO(TEST_TAR_FILE, "hopper.jpg"):
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert len(record) == 0
 | 
					    assert not record
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,14 +64,14 @@ class TestFileTiff:
 | 
				
			||||||
            im.load()
 | 
					            im.load()
 | 
				
			||||||
            im.close()
 | 
					            im.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert len(record) == 0
 | 
					        assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_context_manager(self):
 | 
					    def test_context_manager(self):
 | 
				
			||||||
        with pytest.warns(None) as record:
 | 
					        with pytest.warns(None) as record:
 | 
				
			||||||
            with Image.open("Tests/images/multipage.tiff") as im:
 | 
					            with Image.open("Tests/images/multipage.tiff") as im:
 | 
				
			||||||
                im.load()
 | 
					                im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert len(record) == 0
 | 
					        assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_mac_tiff(self):
 | 
					    def test_mac_tiff(self):
 | 
				
			||||||
        # Read RGBa images from macOS [@PIL136]
 | 
					        # Read RGBa images from macOS [@PIL136]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,7 +147,7 @@ class TestFileWebp:
 | 
				
			||||||
            temp_file = str(tmp_path / "temp.webp")
 | 
					            temp_file = str(tmp_path / "temp.webp")
 | 
				
			||||||
            with pytest.warns(None) as record:
 | 
					            with pytest.warns(None) as record:
 | 
				
			||||||
                image.save(temp_file)
 | 
					                image.save(temp_file)
 | 
				
			||||||
            assert len(record) == 0
 | 
					            assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_file_pointer_could_be_reused(self):
 | 
					    def test_file_pointer_could_be_reused(self):
 | 
				
			||||||
        file_path = "Tests/images/hopper.webp"
 | 
					        file_path = "Tests/images/hopper.webp"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -638,7 +638,7 @@ class TestImage:
 | 
				
			||||||
        with Image.open(test_file) as im:
 | 
					        with Image.open(test_file) as im:
 | 
				
			||||||
            with pytest.warns(None) as record:
 | 
					            with pytest.warns(None) as record:
 | 
				
			||||||
                im.save(temp_file)
 | 
					                im.save(temp_file)
 | 
				
			||||||
            assert len(record) == 0
 | 
					            assert not record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_load_on_nonexclusive_multiframe(self):
 | 
					    def test_load_on_nonexclusive_multiframe(self):
 | 
				
			||||||
        with open("Tests/images/frozenpond.mpo", "rb") as fp:
 | 
					        with open("Tests/images/frozenpond.mpo", "rb") as fp:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -236,4 +236,4 @@ def test_no_resource_warning_for_numpy_array():
 | 
				
			||||||
        # Act/Assert
 | 
					        # Act/Assert
 | 
				
			||||||
        with pytest.warns(None) as record:
 | 
					        with pytest.warns(None) as record:
 | 
				
			||||||
            array(im)
 | 
					            array(im)
 | 
				
			||||||
        assert len(record) == 0
 | 
					        assert not record
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user