From 88b21e725432d418e56bdf0721f8581d14a24e40 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 25 Jun 2024 21:38:47 +1000 Subject: [PATCH] Added test --- Tests/images/unknown_mode.j2k | Bin 0 -> 318 bytes Tests/test_file_jpeg2k.py | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 Tests/images/unknown_mode.j2k diff --git a/Tests/images/unknown_mode.j2k b/Tests/images/unknown_mode.j2k new file mode 100644 index 0000000000000000000000000000000000000000..38719fe2561bb1341b69ed96e63f23bfb2c45d58 GIT binary patch literal 318 zcmezG|38pHlK})cpcu>n5-d;*;j{8HGX4)@-~sX&8JJjD7#RP@FmO3EbaYGrqW>uj zstktDsYS(^`FRRPdM0`X|0ghTfsHc&YM*@mj{y%C z&*TFPKN$`%2pnLLWnpJ#2J#pWFjxuje6;1!2CHWT>M%yAuLr4Lz#z||z{q}pp+?Dp z!AgXIp@Yf&e?50US3Ot@6HtpOiWZ>pKx8N2z|717u|m*+fun)v&wOrsUWg`Upe8ef jCVQaa3P6|eFfc!4VPpo{^^*x=R||JSd_8wE None: assert im.getpixel((5, 5)) == 31 +def test_unknown_j2k_mode() -> None: + with pytest.raises(UnidentifiedImageError): + with Image.open("Tests/images/unknown_mode.j2k"): + pass + + def test_unbound_local() -> None: # prepatch, a malformed jp2 file could cause an UnboundLocalError exception. with pytest.raises(OSError):