Skip to content

Commit 77b4bb0

Browse files
lp07Skn0tt
authored andcommitted
Fix ignore_default_args bool handling
1 parent 797946e commit 77b4bb0

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

playwright/_impl/_browser_type.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ def normalize_launch_params(params: Dict) -> None:
357357
if params["ignoreDefaultArgs"] is True:
358358
params["ignoreAllDefaultArgs"] = True
359359
del params["ignoreDefaultArgs"]
360+
elif params["ignoreDefaultArgs"] is False:
361+
del params["ignoreDefaultArgs"]
360362
if "executablePath" in params:
361363
params["executablePath"] = str(Path(params["executablePath"]))
362364
if "downloadsPath" in params:

tests/async/test_launcher.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,12 @@ async def test_browser_close_should_be_callable_twice(
107107
browser.close(),
108108
)
109109
await browser.close()
110+
111+
112+
async def test_browser_type_launch_should_accept_ignore_default_args_false(
113+
browser_type: BrowserType, launch_arguments: Dict
114+
) -> None:
115+
# Regression for https://github.com/microsoft/playwright-python/issues/3005:
116+
# passing False used to crash with "expected array, got boolean".
117+
browser = await browser_type.launch(**launch_arguments, ignore_default_args=False)
118+
await browser.close()

tests/sync/test_launcher.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,10 @@ def test_browser_close_should_be_callable_twice(
8888
browser = browser_type.launch(**launch_arguments)
8989
browser.close()
9090
browser.close()
91+
92+
93+
def test_browser_type_launch_should_accept_ignore_default_args_false(
94+
browser_type: BrowserType, launch_arguments: Dict
95+
) -> None:
96+
browser = browser_type.launch(**launch_arguments, ignore_default_args=False)
97+
browser.close()

0 commit comments

Comments
 (0)