Skip to content

Commit 109657e

Browse files
Apply pyupgrade
1 parent 8f8efd9 commit 109657e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/pytest_html/basereport.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from pathlib import Path
1414
from typing import Any
1515
from typing import DefaultDict
16-
from typing import Dict
17-
from typing import List
1816

1917
import pytest
2018
from _pytest.config import Config
@@ -90,7 +88,7 @@ def _generate_report(self, self_contained: bool = False) -> None:
9088

9189
self._write_report(rendered_report)
9290

93-
def _generate_environment(self) -> Dict[str, Any]:
91+
def _generate_environment(self) -> dict[str, Any]:
9492
try:
9593
from pytest_metadata.plugin import metadata_key
9694

@@ -125,7 +123,7 @@ def _data_content(self, *args, **kwargs) -> None:
125123
def _media_content(self, *args, **kwargs) -> None:
126124
pass
127125

128-
def _process_extras(self, report: CollectReport, test_id: str) -> List[Any]:
126+
def _process_extras(self, report: CollectReport, test_id: str) -> list[Any]:
129127
test_index = hasattr(report, "rerun") and report.rerun + 1 or 0
130128
report_extras = getattr(report, "extras", [])
131129
for extra_index, extra in enumerate(report_extras):
@@ -161,7 +159,7 @@ def _write_report(self, rendered_report: str) -> None:
161159
f.write(rendered_report)
162160

163161
def _run_count(self) -> str:
164-
relevant_outcomes: List[str] = ["passed", "failed", "xpassed", "xfailed"]
162+
relevant_outcomes: list[str] = ["passed", "failed", "xpassed", "xfailed"]
165163
counts = 0
166164
for outcome in self._report.outcomes.keys():
167165
if outcome in relevant_outcomes:
@@ -175,7 +173,7 @@ def _run_count(self) -> str:
175173

176174
return f"{counts}/{self._report.collected_items} {'tests' if plural else 'test'} done."
177175

178-
def _hydrate_data(self, data: Dict[str, List], cells: List[str]) -> None:
176+
def _hydrate_data(self, data: dict[str, list], cells: list[str]) -> None:
179177
for index, cell in enumerate(cells):
180178
# extract column name and data if column is sortable
181179
if "sortable" in self._report.table_header[index]:
@@ -280,7 +278,7 @@ def pytest_runtest_logreport(self, report: TestReport) -> None:
280278
self._generate_report()
281279

282280
def _process_report(
283-
self, report: TestReport, duration: int, processed_extras: List
281+
self, report: TestReport, duration: int, processed_extras: list
284282
) -> None:
285283
outcome = _process_outcome(report)
286284
try:
@@ -345,7 +343,7 @@ def _is_error(report: BaseReport) -> bool:
345343
)
346344

347345

348-
def _process_logs(report) -> List[str]:
346+
def _process_logs(report) -> list[str]:
349347
log = []
350348
if report.longreprtext:
351349
log.append(escape(report.longreprtext) + "\n")
@@ -382,7 +380,7 @@ def _process_links(links) -> str:
382380
return "".join([a_tag.format_map(link) for link in links])
383381

384382

385-
def _fix_py(cells: List[str]) -> List[str]:
383+
def _fix_py(cells: list[str]) -> list[str]:
386384
# backwards-compat
387385
new_cells = []
388386
for html in cells:

0 commit comments

Comments
 (0)