Skip to content

Commit 7142e8a

Browse files
committed
refact: fix on changes with ruff and applied changes to tests
1 parent 74ee62e commit 7142e8a

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

pydoll/browser/page.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ async def get_screenshot(self, path: str):
205205
if fmt not in ['jpeg', 'jpg', 'png']:
206206
raise InvalidFileExtension(f'{fmt} extension is not supported.')
207207

208-
response = await self._execute_command(PageCommands.screenshot(fmt=fmt))
208+
response = await self._execute_command(
209+
PageCommands.screenshot(fmt=fmt)
210+
)
209211
screenshot_b64 = response['result']['data'].encode('utf-8')
210212
screenshot_bytes = decode_image_to_bytes(screenshot_b64)
211213
async with aiofiles.open(path, 'wb') as file:

pydoll/element.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async def get_screenshot(self, path: str):
189189
'scale': 1,
190190
}
191191
screenshot = await self._connection_handler.execute_command(
192-
PageCommands.screenshot(format='jpeg', clip=clip)
192+
PageCommands.screenshot(fmt='jpeg', clip=clip)
193193
)
194194
async with aiofiles.open(path, 'wb') as file:
195195
image_bytes = decode_image_to_bytes(screenshot['result']['data'])

pydoll/exceptions.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ class ElementNotInteractable(Exception):
8181
def __str__(self):
8282
return self.message
8383

84+
8485
class InvalidFileExtension(Exception):
8586
message = 'The file extension provided is not supported'
8687

8788
def __str__(self):
88-
return self.message
89+
return self.message

tests/test_page_commands.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_screenshot_jpeg():
3333
},
3434
}
3535
assert (
36-
PageCommands.screenshot(format='jpeg', quality=80) == expected_command
36+
PageCommands.screenshot(fmt='jpeg', quality=80) == expected_command
3737
)
3838

3939

@@ -45,7 +45,7 @@ def test_screenshot_png():
4545
'quality': 100,
4646
},
4747
}
48-
assert PageCommands.screenshot(format='png') == expected_command
48+
assert PageCommands.screenshot(fmt='png') == expected_command
4949

5050

5151
def test_screenshot_with_clip():

0 commit comments

Comments
 (0)