Skip to content

Commit c47f221

Browse files
TEST: Adjusting tests that use images due to some PIL deprecated methods
1 parent f372151 commit c47f221

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_browser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55
import conftest
66

7-
from PIL import Image
7+
from PIL import Image, ImageFile
88
from botcity.web import WebBot, By, Browser
99

1010

@@ -92,7 +92,7 @@ def test_get_image_from_map(web: WebBot):
9292
web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png'))
9393
img = web.get_image_from_map('mouse')
9494

95-
assert Image.isImageType(img)
95+
assert isinstance(img, ImageFile.ImageFile)
9696

9797

9898
def test_get_js_dialog(web: WebBot):
@@ -119,15 +119,15 @@ def test_get_screen_image(web: WebBot):
119119
web.browse(conftest.INDEX_PAGE)
120120
img = web.get_screen_image(region=(0, 0, 400, 200))
121121

122-
assert Image.isImageType(img)
122+
assert isinstance(img, Image.Image)
123123

124124

125125
def test_get_screenshot(web: WebBot):
126126
web.browse(conftest.INDEX_PAGE)
127127
fp = os.path.join(conftest.PROJECT_DIR, 'resources', 'screenshot_test.png')
128128
img = web.get_screenshot(fp)
129129

130-
assert Image.isImageType(img) and os.path.isfile(fp)
130+
assert isinstance(img, Image.Image) and os.path.isfile(fp)
131131
os.remove(fp)
132132

133133

@@ -137,7 +137,7 @@ def test_screen_cut(web: WebBot):
137137
img = web.screen_cut(0, 0, 100, 200)
138138
img.save(fp)
139139

140-
assert Image.isImageType(img) and os.path.isfile(fp)
140+
assert isinstance(img, Image.Image) and os.path.isfile(fp)
141141
os.remove(fp)
142142

143143

0 commit comments

Comments
 (0)