Skip to content

Commit f371be9

Browse files
authored
chore: unskip tests / unignore linting in tests (#2180)
1 parent 248f3ec commit f371be9

File tree

7 files changed

+14
-24
lines changed

7 files changed

+14
-24
lines changed

playwright/_impl/_api_structures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Cookie(TypedDict, total=False):
3939
sameSite: Literal["Lax", "None", "Strict"]
4040

4141

42+
# TODO: We are waiting for PEP705 so SetCookieParam can be readonly and matches Cookie.
4243
class SetCookieParam(TypedDict, total=False):
4344
name: str
4445
value: str

scripts/generate_api.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,7 @@
1515
import re
1616
import sys
1717
from types import FunctionType
18-
from typing import ( # type: ignore
19-
Any,
20-
Dict,
21-
List,
22-
Match,
23-
Optional,
24-
Union,
25-
cast,
26-
get_args,
27-
get_origin,
28-
)
18+
from typing import Any, Dict, List, Match, Optional, Union, cast, get_args, get_origin
2919
from typing import get_type_hints as typing_get_type_hints
3020

3121
from playwright._impl._accessibility import Accessibility

tests/async/test_browsercontext_add_cookies.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def test_should_roundtrip_cookie(
4949
cookies = await context.cookies()
5050
await context.clear_cookies()
5151
assert await context.cookies() == []
52+
# TODO: We are waiting for PEP705 so SetCookieParam can be readonly and matches the Cookie type.
5253
await context.add_cookies(cookies) # type: ignore
5354
assert await context.cookies() == cookies
5455

tests/async/test_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async def test_browser_launch_should_return_background_pages(
130130
f"--disable-extensions-except={extension_path}",
131131
f"--load-extension={extension_path}",
132132
],
133-
}, # type: ignore
133+
},
134134
)
135135
background_page = None
136136
if len(context.background_pages):

tests/sync/test_assertions.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ def test_assertions_locator_to_contain_text(page: Page, server: Server) -> None:
9090
expect(page.locator("div#foobar")).to_contain_text("bar", timeout=100)
9191

9292
page.set_content("<div>Text \n1</div><div>Text2</div><div>Text3</div>")
93-
expect(page.locator("div")).to_contain_text(
94-
["ext 1", re.compile("ext3")] # type: ignore
95-
)
93+
expect(page.locator("div")).to_contain_text(["ext 1", re.compile("ext3")])
9694

9795

9896
def test_assertions_locator_to_have_attribute(page: Page, server: Server) -> None:
@@ -244,9 +242,7 @@ def test_assertions_locator_to_have_text(page: Page, server: Server) -> None:
244242

245243
page.set_content("<div>Text \n1</div><div>Text 2a</div>")
246244
# Should only normalize whitespace in the first item.
247-
expect(page.locator("div")).to_have_text(
248-
["Text 1", re.compile(r"Text \d+a")] # type: ignore
249-
)
245+
expect(page.locator("div")).to_have_text(["Text 1", re.compile(r"Text \d+a")])
250246

251247

252248
@pytest.mark.parametrize(

tests/sync/test_browsercontext_request_fallback.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ def capture_and_continue(route: Route, request: Request) -> None:
204204

205205
def delete_foo_header(route: Route, request: Request) -> None:
206206
headers = request.all_headers()
207-
route.fallback(headers={**headers, "foo": None}) # type: ignore
207+
del headers["foo"]
208+
route.fallback(headers=headers)
208209

209210
context.route(server.PREFIX + "/something", delete_foo_header)
210211
with server.expect_request("/something") as server_req_info:

tests/sync/test_fetch_browser_context.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from playwright.sync_api import BrowserContext, Error, FilePayload, Page
2222
from tests.server import Server
23+
from tests.utils import must
2324

2425

2526
def test_get_should_work(context: BrowserContext, server: Server) -> None:
@@ -150,11 +151,11 @@ def support_post_data(fetch_data: Any, request_post_data: Any) -> None:
150151
server.PREFIX + "/simple.json", data=fetch_data
151152
)
152153
assert request.value.method.decode() == method.upper()
153-
assert request.value.post_body == request_post_data # type: ignore
154+
assert request.value.post_body == request_post_data
154155
assert response.status == 200
155156
assert response.url == server.PREFIX + "/simple.json"
156157
assert request.value.getHeader("Content-Length") == str(
157-
len(request.value.post_body) # type: ignore
158+
len(must(request.value.post_body))
158159
)
159160

160161
support_post_data("My request", "My request".encode())
@@ -182,9 +183,9 @@ def test_should_support_application_x_www_form_urlencoded(
182183
server_req.value.getHeader("Content-Type")
183184
== "application/x-www-form-urlencoded"
184185
)
185-
body = server_req.value.post_body.decode() # type: ignore
186+
body = must(server_req.value.post_body).decode()
186187
assert server_req.value.getHeader("Content-Length") == str(len(body))
187-
params: Dict[bytes, List[bytes]] = parse_qs(server_req.value.post_body) # type: ignore
188+
params: Dict[bytes, List[bytes]] = parse_qs(server_req.value.post_body)
188189
assert params[b"firstName"] == [b"John"]
189190
assert params[b"lastName"] == [b"Doe"]
190191
assert params[b"file"] == [b"f.js"]
@@ -212,7 +213,7 @@ def test_should_support_multipart_form_data(
212213
assert content_type
213214
assert content_type.startswith("multipart/form-data; ")
214215
assert server_req.value.getHeader("Content-Length") == str(
215-
len(server_req.value.post_body) # type: ignore
216+
len(must(server_req.value.post_body))
216217
)
217218
assert server_req.value.args[b"firstName"] == [b"John"]
218219
assert server_req.value.args[b"lastName"] == [b"Doe"]

0 commit comments

Comments
 (0)