Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: lint examples and fix to_{have,contain}_text with lists #1675

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-pyOpenSSL==22.1.0.1]
exclude: examples/
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->108.0.5359.29<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->108.0.5359.48<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->106.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ def assert_number_of_todos_in_local_storage(page: Page, expected: int) -> None:


def check_todos_in_local_storage(page: Page, title: str) -> None:
title in page.evaluate("JSON.parse(localStorage['react-todos']).map(i => i.title)")
assert title in page.evaluate(
"JSON.parse(localStorage['react-todos']).map(i => i.title)"
)
52 changes: 44 additions & 8 deletions playwright/_impl/_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ def _not(self) -> "LocatorAssertions":

async def to_contain_text(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
use_inner_text: bool = None,
timeout: float = None,
ignore_case: bool = None,
Expand Down Expand Up @@ -163,7 +169,13 @@ async def to_contain_text(

async def not_to_contain_text(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
use_inner_text: bool = None,
timeout: float = None,
ignore_case: bool = None,
Expand Down Expand Up @@ -199,7 +211,13 @@ async def not_to_have_attribute(

async def to_have_class(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
timeout: float = None,
) -> None:
__tracebackhide__ = True
Expand All @@ -222,7 +240,13 @@ async def to_have_class(

async def not_to_have_class(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
timeout: float = None,
) -> None:
__tracebackhide__ = True
Expand Down Expand Up @@ -346,7 +370,7 @@ async def not_to_have_value(

async def to_have_values(
self,
values: List[Union[Pattern[str], str]],
values: Union[List[str], List[Pattern[str]], List[Union[Pattern[str], str]]],
timeout: float = None,
) -> None:
__tracebackhide__ = True
Expand All @@ -360,15 +384,21 @@ async def to_have_values(

async def not_to_have_values(
self,
values: List[Union[Pattern[str], str]],
values: Union[List[str], List[Pattern[str]], List[Union[Pattern[str], str]]],
timeout: float = None,
) -> None:
__tracebackhide__ = True
await self._not.to_have_values(values, timeout)

async def to_have_text(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
use_inner_text: bool = None,
timeout: float = None,
ignore_case: bool = None,
Expand Down Expand Up @@ -407,7 +437,13 @@ async def to_have_text(

async def not_to_have_text(
self,
expected: Union[List[Union[Pattern[str], str]], Pattern[str], str],
expected: Union[
List[str],
List[Pattern[str]],
List[Union[Pattern[str], str]],
Pattern[str],
str,
],
use_inner_text: bool = None,
timeout: float = None,
ignore_case: bool = None,
Expand Down