Skip to content

Commit 5d65e02

Browse files
author
interop-scores-bot
committed
Update assert_png to check for magic bytes directly
This avoids the use of imghdr which was removed in Ptyhon 3.13
1 parent aabd606 commit 5d65e02

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

webdriver/tests/support/asserts.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import imghdr
2-
import json
31
from base64 import decodebytes
42

53
from webdriver import NoSuchAlertException, WebDriverException, WebElement
@@ -235,6 +233,5 @@ def assert_png(screenshot):
235233
image = decodebytes(screenshot.encode())
236234
else:
237235
image = screenshot
238-
mime_type = imghdr.what("", image)
239-
assert mime_type == "png", "Expected image to be PNG, but it was {}".format(mime_type)
236+
assert image.startswith(b'\211PNG\r\n\032\n'), "Expected image to be PNG"
240237
return image

0 commit comments

Comments
 (0)