Skip to content

Commit 6670f51

Browse files
committed
use google format for docstrings
1 parent 23dd6f3 commit 6670f51

File tree

2 files changed

+12
-36
lines changed

2 files changed

+12
-36
lines changed

py/selenium/webdriver/common/bidi/emulation.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ def __init__(
3535
):
3636
"""Initialize GeolocationCoordinates.
3737
38-
Parameters:
39-
-----------
38+
Args:
4039
latitude: Latitude coordinate (-90.0 to 90.0).
4140
longitude: Longitude coordinate (-180.0 to 180.0).
4241
accuracy: Accuracy in meters (>= 0.0), defaults to 1.0.
@@ -46,7 +45,6 @@ def __init__(
4645
speed: Speed in meters per second (>= 0.0) or None, defaults to None.
4746
4847
Raises:
49-
------
5048
ValueError: If coordinates are out of valid range or if altitude_accuracy is provided without altitude.
5149
"""
5250
self.latitude = latitude
@@ -180,18 +178,16 @@ def set_geolocation_override(
180178
) -> None:
181179
"""Set geolocation override for the given contexts or user contexts.
182180
183-
Parameters:
184-
-----------
181+
Args:
185182
coordinates: Geolocation coordinates to emulate, or None.
186183
error: Geolocation error to emulate, or None.
187184
contexts: List of browsing context IDs to apply the override to.
188185
user_contexts: List of user context IDs to apply the override to.
189186
190187
Raises:
191-
------
192188
ValueError: If both coordinates and error are provided, or if both contexts
193-
and user_contexts are provided, or if neither contexts nor
194-
user_contexts are provided.
189+
and user_contexts are provided, or if neither contexts nor
190+
user_contexts are provided.
195191
"""
196192
if coordinates is not None and error is not None:
197193
raise ValueError("Cannot specify both coordinates and error")
@@ -224,17 +220,15 @@ def set_timezone_override(
224220
) -> None:
225221
"""Set timezone override for the given contexts or user contexts.
226222
227-
Parameters:
228-
-----------
223+
Args:
229224
timezone: Timezone identifier (IANA timezone name or offset string like '+01:00'),
230-
or None to clear the override.
225+
or None to clear the override.
231226
contexts: List of browsing context IDs to apply the override to.
232227
user_contexts: List of user context IDs to apply the override to.
233228
234229
Raises:
235-
------
236230
ValueError: If both contexts and user_contexts are provided, or if neither
237-
contexts nor user_contexts are provided.
231+
contexts nor user_contexts are provided.
238232
"""
239233
if contexts is not None and user_contexts is not None:
240234
raise ValueError("Cannot specify both contexts and user_contexts")
@@ -259,16 +253,14 @@ def set_locale_override(
259253
) -> None:
260254
"""Set locale override for the given contexts or user contexts.
261255
262-
Parameters:
263-
-----------
256+
Args:
264257
locale: Locale string as per BCP 47, or None to clear override.
265258
contexts: List of browsing context IDs to apply the override to.
266259
user_contexts: List of user context IDs to apply the override to.
267260
268261
Raises:
269-
------
270262
ValueError: If both contexts and user_contexts are provided, or if neither
271-
contexts nor user_contexts are provided, or if locale is invalid.
263+
contexts nor user_contexts are provided, or if locale is invalid.
272264
"""
273265
if contexts is not None and user_contexts is not None:
274266
raise ValueError("Cannot specify both contexts and userContexts")
@@ -293,17 +285,15 @@ def set_scripting_enabled(
293285
) -> None:
294286
"""Set scripting enabled override for the given contexts or user contexts.
295287
296-
Parameters:
297-
-----------
288+
Args:
298289
enabled: False to disable scripting, None to clear the override.
299-
Note: Only emulation of disabled JavaScript is supported.
290+
Note: Only emulation of disabled JavaScript is supported.
300291
contexts: List of browsing context IDs to apply the override to.
301292
user_contexts: List of user context IDs to apply the override to.
302293
303294
Raises:
304-
------
305295
ValueError: If both contexts and user_contexts are provided, or if neither
306-
contexts nor user_contexts are provided, or if enabled is True.
296+
contexts nor user_contexts are provided, or if enabled is True.
307297
"""
308298
if enabled:
309299
raise ValueError("Only emulation of disabled JavaScript is supported (enabled must be False or None)")

py/test/selenium/webdriver/common/bidi_emulation_tests.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ def get_browser_locale(driver):
7474

7575

7676
def test_emulation_initialized(driver):
77-
"""Test that the emulation module is initialized properly."""
7877
assert driver.emulation is not None
7978
assert isinstance(driver.emulation, Emulation)
8079

8180

8281
def test_set_geolocation_override_with_coordinates_in_context(driver, pages):
83-
"""Test setting geolocation override with coordinates."""
8482
context_id = driver.current_window_handle
8583
pages.load("blank.html")
8684
coords = GeolocationCoordinates(45.5, -122.4194, accuracy=10.0)
@@ -96,7 +94,6 @@ def test_set_geolocation_override_with_coordinates_in_context(driver, pages):
9694

9795

9896
def test_set_geolocation_override_with_coordinates_in_user_context(driver, pages):
99-
"""Test setting geolocation override with coordinates in a user context."""
10097
# Create a user context
10198
user_context = driver.browser.create_user_context()
10299

@@ -121,7 +118,6 @@ def test_set_geolocation_override_with_coordinates_in_user_context(driver, pages
121118

122119

123120
def test_set_geolocation_override_all_coords(driver, pages):
124-
"""Test setting geolocation override with coordinates."""
125121
context_id = driver.current_window_handle
126122
pages.load("blank.html")
127123
coords = GeolocationCoordinates(
@@ -147,7 +143,6 @@ def test_set_geolocation_override_all_coords(driver, pages):
147143

148144

149145
def test_set_geolocation_override_with_multiple_contexts(driver, pages):
150-
"""Test setting geolocation override with multiple browsing contexts."""
151146
# Create two browsing contexts
152147
context1_id = driver.browsing_context.create(type=WindowTypes.TAB)
153148
context2_id = driver.browsing_context.create(type=WindowTypes.TAB)
@@ -181,7 +176,6 @@ def test_set_geolocation_override_with_multiple_contexts(driver, pages):
181176

182177

183178
def test_set_geolocation_override_with_multiple_user_contexts(driver, pages):
184-
"""Test setting geolocation override with multiple user contexts."""
185179
# Create two user contexts
186180
user_context1 = driver.browser.create_user_context()
187181
user_context2 = driver.browser.create_user_context()
@@ -229,7 +223,6 @@ def test_set_geolocation_override_with_multiple_user_contexts(driver, pages):
229223

230224
@pytest.mark.xfail_firefox
231225
def test_set_geolocation_override_with_error(driver, pages):
232-
"""Test setting geolocation override with error."""
233226
context_id = driver.current_window_handle
234227
pages.load("blank.html")
235228

@@ -242,7 +235,6 @@ def test_set_geolocation_override_with_error(driver, pages):
242235

243236

244237
def test_set_timezone_override_with_context(driver, pages):
245-
"""Test setting timezone override with a browsing context."""
246238
context_id = driver.current_window_handle
247239
pages.load("blank.html")
248240

@@ -267,7 +259,6 @@ def test_set_timezone_override_with_context(driver, pages):
267259

268260

269261
def test_set_timezone_override_with_user_context(driver, pages):
270-
"""Test setting timezone override with a user context."""
271262
user_context = driver.browser.create_user_context()
272263
context_id = driver.browsing_context.create(type=WindowTypes.TAB, user_context=user_context)
273264

@@ -287,7 +278,6 @@ def test_set_timezone_override_with_user_context(driver, pages):
287278

288279
@pytest.mark.xfail_firefox(reason="Firefox returns UTC as timezone string in case of offset.")
289280
def test_set_timezone_override_using_offset(driver, pages):
290-
"""Test setting timezone override using offset."""
291281
context_id = driver.current_window_handle
292282
pages.load("blank.html")
293283

@@ -320,7 +310,6 @@ def test_set_timezone_override_using_offset(driver, pages):
320310
],
321311
)
322312
def test_set_locale_override_with_contexts(driver, pages, locale, expected_locale):
323-
"""Test setting locale override with browsing contexts."""
324313
context_id = driver.current_window_handle
325314

326315
driver.emulation.set_locale_override(locale=locale, contexts=[context_id])
@@ -345,7 +334,6 @@ def test_set_locale_override_with_contexts(driver, pages, locale, expected_local
345334
],
346335
)
347336
def test_set_locale_override_with_user_contexts(driver, pages, value):
348-
"""Test setting locale override with user contexts."""
349337
user_context = driver.browser.create_user_context()
350338
try:
351339
context_id = driver.browsing_context.create(type=WindowTypes.TAB, user_context=user_context)
@@ -366,7 +354,6 @@ def test_set_locale_override_with_user_contexts(driver, pages, value):
366354

367355
@pytest.mark.xfail_firefox(reason="Not yet supported")
368356
def test_set_scripting_enabled_with_contexts(driver, pages):
369-
"""Test disabling scripting with browsing contexts."""
370357
context_id = driver.current_window_handle
371358

372359
# disable scripting
@@ -393,7 +380,6 @@ def test_set_scripting_enabled_with_contexts(driver, pages):
393380

394381
@pytest.mark.xfail_firefox(reason="Not yet supported")
395382
def test_set_scripting_enabled_with_user_contexts(driver, pages):
396-
"""Test disabling scripting with user contexts."""
397383
user_context = driver.browser.create_user_context()
398384
try:
399385
context_id = driver.browsing_context.create(type=WindowTypes.TAB, user_context=user_context)

0 commit comments

Comments
 (0)