src/img2pdf_test.py: cater for endianess->endianness in 1.0 output format

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-04-07 08:06:59 +02:00
parent b5f0912e13
commit b8bfa98218
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1005,7 +1005,8 @@ def jpg_img(tmp_path_factory, tmp_normal_png):
assert "resolution" not in identify[0]["image"] assert "resolution" not in identify[0]["image"]
assert identify[0]["image"].get("units") == "Undefined", str(identify) assert identify[0]["image"].get("units") == "Undefined", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") == "Undefined", str(identify) endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) == "Undefined", str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
@ -2361,7 +2362,8 @@ def tiff_float_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -2417,7 +2419,8 @@ def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -2477,7 +2480,8 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
@ -2527,7 +2531,8 @@ def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -2578,7 +2583,8 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 12, str(identify) assert identify[0]["image"].get("depth") == 12, str(identify)
@ -2629,7 +2635,8 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 14, str(identify) assert identify[0]["image"].get("depth") == 14, str(identify)
@ -2680,7 +2687,8 @@ def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
@ -2731,7 +2739,8 @@ def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify) assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -2782,7 +2791,8 @@ def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify) assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
@ -2831,7 +2841,8 @@ def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
@ -2881,7 +2892,8 @@ def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 2, str(identify) assert identify[0]["image"].get("depth") == 2, str(identify)
@ -2931,7 +2943,8 @@ def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 4, str(identify) assert identify[0]["image"].get("depth") == 4, str(identify)
@ -2981,7 +2994,8 @@ def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3031,7 +3045,8 @@ def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
@ -3085,7 +3100,8 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3128,7 +3144,8 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3178,7 +3195,8 @@ def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3229,7 +3247,8 @@ def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3280,7 +3299,8 @@ def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3331,7 +3351,8 @@ def tiff_palette8_img(tmp_path_factory, tmp_palette8_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
@ -3395,7 +3416,8 @@ def tiff_ccitt_lsb_m2l_white_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
@ -3476,7 +3498,8 @@ def tiff_ccitt_msb_m2l_white_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in [ endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"MSB", "MSB",
] # FIXME: should be MSB ] # FIXME: should be MSB
@ -3558,7 +3581,8 @@ def tiff_ccitt_msb_l2m_white_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in [ endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"MSB", "MSB",
] # FIXME: should be MSB ] # FIXME: should be MSB
@ -3645,7 +3669,8 @@ def tiff_ccitt_lsb_m2l_black_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
@ -3735,7 +3760,8 @@ def tiff_ccitt_nometa1_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
@ -3819,7 +3845,8 @@ def tiff_ccitt_nometa2_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("units") == "PixelsPerInch", str(identify) assert identify[0]["image"].get("units") == "PixelsPerInch", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
assert identify[0]["image"].get("endianess") in ["Undefined", "LSB",], str( endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
identify identify
) # FIXME: should be LSB ) # FIXME: should be LSB
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)