playwright-python icon indicating copy to clipboard operation
playwright-python copied to clipboard

[BUG] Can't pass a list into to_have_values

Open mxschmitt opened this issue 3 years ago • 1 comments

Repro:

import typing
from playwright.sync_api import Page, expect

def to_have_text(
   expected: typing.List[typing.Union[typing.Pattern[str], str]],
#  this works:   expected: typing.Union[typing.List[typing.Pattern[str]], typing.List[str]],
):
    pass


def test_should_persist_its_data(page: Page) -> None:
    my_list = ["a", "b", "c"]
    to_have_text(my_list)
    expect(page.locator("")).to_have_text(my_list)

Verified with latest mypy and pyright.

mxschmitt avatar Aug 22 '22 19:08 mxschmitt

Once fixed, make sure to remove the linting exclude rules in:

  • .pre-commit-config.yaml
  • pyproject.toml

mxschmitt avatar Aug 23 '22 07:08 mxschmitt