Skip to content

test_png is failing #20560

@jklymak

Description

@jklymak
lib/matplotlib/tests/test_png.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
lib/matplotlib/pyplot.py:2378: in imread
    return matplotlib.image.imread(fname, format)
lib/matplotlib/image.py:1544: in imread
    if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pil_png = <PIL.PngImagePlugin.PngImageFile image mode=1 size=32x32 at 0x7F4A53D83910>

    def _pil_png_to_float_array(pil_png):
        """Convert a PIL `PNGImageFile` to a 0-1 float array."""
        # Unlike pil_to_array this converts to 0-1 float32s for backcompat with the
        # old libpng-based loader.
        # The supported rawmodes are from PIL.PngImagePlugin._MODES.  When
        # mode == "RGB(A)", the 16-bit raw data has already been coarsened to 8-bit
        # by Pillow.
        mode = pil_png.mode
        rawmode = pil_png.png.im_rawmode
        if rawmode == "1":  # Grayscale.
>           return np.asarray(pil_png, np.float32)
E           TypeError: __array__() takes 1 positional argument but 2 were given

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions