Skip to content

Commit 546d8e4

Browse files
authored
fix test heat map selenium (#1586)
1 parent 5567397 commit 546d8e4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/selenium/test_heat_map_selenium.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import base64
2+
import io
23
import os
34

5+
from PIL import Image
6+
47
import folium
58
from folium.plugins.heat_map import HeatMap
69
from folium.utilities import temp_html_filepath
@@ -34,10 +37,10 @@ def test_heat_map_with_weights(driver):
3437
# get the canvas as a PNG base64 string
3538
canvas_base64 = driver.execute_script(
3639
"return arguments[0].toDataURL('image/png').substring(21);", canvas)
37-
screenshot = base64.b64decode(canvas_base64)
40+
screenshot_bytes = base64.b64decode(canvas_base64)
41+
screenshot = Image.open(io.BytesIO(screenshot_bytes))
3842
path = os.path.dirname(__file__)
3943
with open(os.path.join(path, 'test_heat_map_selenium_screenshot.png'), 'rb') as f:
40-
screenshot_expected = f.read()
41-
if hash(screenshot) != hash(screenshot_expected):
42-
print(screenshot)
43-
assert False, 'screenshot is not as expected'
44+
screenshot_expected = Image.open(f)
45+
if list(screenshot.getdata()) != list(screenshot_expected.getdata()):
46+
assert False, 'screenshot is not as expected'

0 commit comments

Comments
 (0)