mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Migrated from deprecated numpy bool and float
This commit is contained in:
		
							parent
							
								
									585683ce25
								
							
						
					
					
						commit
						3e670d7737
					
				| 
						 | 
					@ -31,7 +31,7 @@ def test_numpy_to_image():
 | 
				
			||||||
        return i
 | 
					        return i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check supported 1-bit integer formats
 | 
					    # Check supported 1-bit integer formats
 | 
				
			||||||
    assert_image(to_image(numpy.bool, 1, 1), "1", TEST_IMAGE_SIZE)
 | 
					    assert_image(to_image(bool, 1, 1), "1", TEST_IMAGE_SIZE)
 | 
				
			||||||
    assert_image(to_image(numpy.bool8, 1, 1), "1", TEST_IMAGE_SIZE)
 | 
					    assert_image(to_image(numpy.bool8, 1, 1), "1", TEST_IMAGE_SIZE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check supported 8-bit integer formats
 | 
					    # Check supported 8-bit integer formats
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ def test_numpy_to_image():
 | 
				
			||||||
        to_image(numpy.int64)
 | 
					        to_image(numpy.int64)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Check floating-point formats
 | 
					    # Check floating-point formats
 | 
				
			||||||
    assert_image(to_image(numpy.float), "F", TEST_IMAGE_SIZE)
 | 
					    assert_image(to_image(float), "F", TEST_IMAGE_SIZE)
 | 
				
			||||||
    with pytest.raises(TypeError):
 | 
					    with pytest.raises(TypeError):
 | 
				
			||||||
        to_image(numpy.float16)
 | 
					        to_image(numpy.float16)
 | 
				
			||||||
    assert_image(to_image(numpy.float32), "F", TEST_IMAGE_SIZE)
 | 
					    assert_image(to_image(numpy.float32), "F", TEST_IMAGE_SIZE)
 | 
				
			||||||
| 
						 | 
					@ -191,7 +191,7 @@ def test_putdata():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_roundtrip_eye():
 | 
					def test_roundtrip_eye():
 | 
				
			||||||
    for dtype in (
 | 
					    for dtype in (
 | 
				
			||||||
        numpy.bool,
 | 
					        bool,
 | 
				
			||||||
        numpy.bool8,
 | 
					        numpy.bool8,
 | 
				
			||||||
        numpy.int8,
 | 
					        numpy.int8,
 | 
				
			||||||
        numpy.int16,
 | 
					        numpy.int16,
 | 
				
			||||||
| 
						 | 
					@ -199,7 +199,7 @@ def test_roundtrip_eye():
 | 
				
			||||||
        numpy.uint8,
 | 
					        numpy.uint8,
 | 
				
			||||||
        numpy.uint16,
 | 
					        numpy.uint16,
 | 
				
			||||||
        numpy.uint32,
 | 
					        numpy.uint32,
 | 
				
			||||||
        numpy.float,
 | 
					        float,
 | 
				
			||||||
        numpy.float32,
 | 
					        numpy.float32,
 | 
				
			||||||
        numpy.float64,
 | 
					        numpy.float64,
 | 
				
			||||||
    ):
 | 
					    ):
 | 
				
			||||||
| 
						 | 
					@ -218,7 +218,7 @@ def test_zero_size():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_bool():
 | 
					def test_bool():
 | 
				
			||||||
    # https://github.com/python-pillow/Pillow/issues/2044
 | 
					    # https://github.com/python-pillow/Pillow/issues/2044
 | 
				
			||||||
    a = numpy.zeros((10, 2), dtype=numpy.bool)
 | 
					    a = numpy.zeros((10, 2), dtype=bool)
 | 
				
			||||||
    a[0][0] = True
 | 
					    a[0][0] = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    im2 = Image.fromarray(a)
 | 
					    im2 = Image.fromarray(a)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user