Skip to content

Commit 0f20ace

Browse files
committed
Add validation docstrings to PointerParameters, PointerCommonProperties, and PointerSourceActions
1 parent 2e74079 commit 0f20ace

File tree

1 file changed

+14
-0
lines changed
  • py/selenium/webdriver/common/bidi

1 file changed

+14
-0
lines changed

py/selenium/webdriver/common/bidi/input.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ class PointerParameters:
6363
pointer_type: str = PointerType.MOUSE
6464

6565
def __post_init__(self):
66+
"""Validate the pointer type after dataclass initialization.
67+
68+
Raises:
69+
ValueError: If the pointer_type is not one of the valid types.
70+
"""
6671
if self.pointer_type not in PointerType.VALID_TYPES:
6772
raise ValueError(f"Invalid pointer type: {self.pointer_type}. Must be one of {PointerType.VALID_TYPES}")
6873

@@ -84,6 +89,11 @@ class PointerCommonProperties:
8489
azimuth_angle: float = 0.0
8590

8691
def __post_init__(self):
92+
"""Validate pointer common properties after dataclass initialization.
93+
94+
Raises:
95+
ValueError: If any of the properties are outside their valid ranges.
96+
"""
8797
if self.width < 1:
8898
raise ValueError("width must be at least 1")
8999
if self.height < 1:
@@ -309,6 +319,10 @@ class PointerSourceActions:
309319
)
310320

311321
def __post_init__(self):
322+
"""Initialize default pointer parameters if not provided.
323+
324+
Sets default PointerParameters if none are specified during initialization.
325+
"""
312326
if self.parameters is None:
313327
self.parameters = PointerParameters()
314328

0 commit comments

Comments
 (0)