Skip to content

Commit

Permalink
chore: lint examples and fix to_{have,contain}_text with lists (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Dec 2, 2022
1 parent d87e105 commit eaf3f15
Show file tree
Hide file tree
Showing 21 changed files with 7,389 additions and 4,128 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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

0 comments on commit eaf3f15

Please sign in to comment.