22import pytest
33import conftest
44
5- from PIL import Image
5+ from PIL import Image , ImageFile
66from botcity .web import WebBot , By
77
88
@@ -90,7 +90,7 @@ def test_get_image_from_map(web: WebBot):
9090 web .add_image ('mouse' , os .path .join (conftest .PROJECT_DIR , 'resources' , 'mouse.png' ))
9191 img = web .get_image_from_map ('mouse' )
9292
93- assert Image . isImageType (img )
93+ assert isinstance (img , ImageFile . ImageFile )
9494
9595
9696def test_get_js_dialog (web : WebBot ):
@@ -117,15 +117,15 @@ def test_get_screen_image(web: WebBot):
117117 web .browse (conftest .INDEX_PAGE )
118118 img = web .get_screen_image (region = (0 , 0 , 400 , 200 ))
119119
120- assert Image . isImageType (img )
120+ assert isinstance (img , Image . Image )
121121
122122
123123def test_get_screenshot (web : WebBot ):
124124 web .browse (conftest .INDEX_PAGE )
125125 fp = os .path .join (conftest .PROJECT_DIR , 'resources' , 'screenshot_test.png' )
126126 img = web .get_screenshot (fp )
127127
128- assert Image . isImageType (img ) and os .path .isfile (fp )
128+ assert isinstance (img , Image . Image ) and os .path .isfile (fp )
129129 os .remove (fp )
130130
131131
@@ -135,7 +135,7 @@ def test_screen_cut(web: WebBot):
135135 img = web .screen_cut (0 , 0 , 100 , 200 )
136136 img .save (fp )
137137
138- assert Image . isImageType (img ) and os .path .isfile (fp )
138+ assert isinstance (img , Image . Image ) and os .path .isfile (fp )
139139 os .remove (fp )
140140
141141
0 commit comments