Skip to content

Commit d44ff4f

Browse files
committed
Use standard python comparison operator
The `to_equal` doesn't seem to exist in playwright for python. There is a NodeJS equivalent, but there is no supported GenericAssertion equivalent for python https://playwright.dev/docs/api/class-genericassertions
1 parent ad7f414 commit d44ff4f

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

tests/test.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import time
2-
31
import pytest
42
from playwright.sync_api import Page, expect
53

@@ -16,23 +14,23 @@
1614

1715
@pytest.mark.parametrize("url", routes)
1816
def test_destination(
19-
page: Page,
20-
url: str,
17+
page: Page,
18+
url: str,
2119
) -> None:
2220
"""Test that the destinations page loads with seeded data"""
2321
# Create a destination
2422
response = page.goto(f"{live_server_url}/{url}")
25-
page.on("response", lambda response: expect(response.status).to_equal(200))
23+
assert response.status == 200
2624
assert response.url.endswith(f"/{url}/") # Load the index.html
2725

2826

2927
@pytest.mark.parametrize(
3028
"title, url",
3129
(
32-
("Acerca de", "/es/about/"),
33-
("Inicio", "/es/"),
34-
("Eventos", "/es/events/"),
35-
("Comunidad", "/es/community/"),
30+
("Acerca de", "/es/about/"),
31+
("Inicio", "/es/"),
32+
("Eventos", "/es/events/"),
33+
("Comunidad", "/es/community/"),
3634
),
3735
)
3836
def test_headers_in_language(page: Page, title: str, url: str) -> None:
@@ -57,10 +55,10 @@ def test_switching_lang_es_about(page: Page) -> None:
5755
@pytest.mark.parametrize(
5856
"title, url",
5957
(
60-
("Kutuhusu", "/sw/about/"),
61-
("Nyumbani", "/sw/"),
62-
("Matukio", "/sw/events/"),
63-
("Jumuiya", "/sw/community/"),
58+
("Kutuhusu", "/sw/about/"),
59+
("Nyumbani", "/sw/"),
60+
("Matukio", "/sw/events/"),
61+
("Jumuiya", "/sw/community/"),
6462
),
6563
)
6664
def test_headers_in_sw(page: Page, title: str, url: str) -> None:
@@ -85,11 +83,11 @@ def test_switching_lang_sw_about(page: Page) -> None:
8583
@pytest.mark.parametrize(
8684
"title, url",
8785
(
88-
("Black Python Devs | Home", "/"),
89-
("Black Python Devs | Blog", "/blog"),
90-
("Black Python Devs | About Us", "/about/"),
91-
("Black Python Devs | Events", "/events/"),
92-
("Black Python Devs | Community", "/community/"),
86+
("Black Python Devs | Home", "/"),
87+
("Black Python Devs | Blog", "/blog"),
88+
("Black Python Devs | About Us", "/about/"),
89+
("Black Python Devs | Events", "/events/"),
90+
("Black Python Devs | Community", "/community/"),
9391
),
9492
)
9593
def test_bpdevs_title_en(page: Page, title: str, url: str) -> None:

0 commit comments

Comments
 (0)