Upgrade pyupgrade to 3.9
This commit is contained in:
parent
30d44b9674
commit
656506d2a6
|
@ -50,7 +50,7 @@ repos:
|
|||
rev: v3.19.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py3-plus]
|
||||
args: [--py39-plus]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||
rev: v9.15.0
|
||||
|
|
|
@ -306,7 +306,7 @@ class BaseReport:
|
|||
|
||||
def _format_duration(duration):
|
||||
if duration < 1:
|
||||
return "{} ms".format(round(duration * 1000))
|
||||
return f"{round(duration * 1000)} ms"
|
||||
|
||||
hours = math.floor(duration / 3600)
|
||||
remaining_seconds = duration % 3600
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
|
||||
FORMAT_HTML = "html"
|
||||
|
@ -18,7 +17,7 @@ def extra(
|
|||
name: Optional[str] = None,
|
||||
mime_type: Optional[str] = None,
|
||||
extension: Optional[str] = None,
|
||||
) -> Dict[str, Optional[str]]:
|
||||
) -> dict[str, Optional[str]]:
|
||||
return {
|
||||
"name": name,
|
||||
"format_type": format_type,
|
||||
|
@ -28,7 +27,7 @@ def extra(
|
|||
}
|
||||
|
||||
|
||||
def html(content: str) -> Dict[str, Optional[str]]:
|
||||
def html(content: str) -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_HTML)
|
||||
|
||||
|
||||
|
@ -37,31 +36,31 @@ def image(
|
|||
name: str = "Image",
|
||||
mime_type: str = "image/png",
|
||||
extension: str = "png",
|
||||
) -> Dict[str, Optional[str]]:
|
||||
) -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_IMAGE, name, mime_type, extension)
|
||||
|
||||
|
||||
def png(content: str, name: str = "Image") -> Dict[str, Optional[str]]:
|
||||
def png(content: str, name: str = "Image") -> dict[str, Optional[str]]:
|
||||
return image(content, name, mime_type="image/png", extension="png")
|
||||
|
||||
|
||||
def jpg(content: str, name: str = "Image") -> Dict[str, Optional[str]]:
|
||||
def jpg(content: str, name: str = "Image") -> dict[str, Optional[str]]:
|
||||
return image(content, name, mime_type="image/jpeg", extension="jpg")
|
||||
|
||||
|
||||
def svg(content: str, name: str = "Image") -> Dict[str, Optional[str]]:
|
||||
def svg(content: str, name: str = "Image") -> dict[str, Optional[str]]:
|
||||
return image(content, name, mime_type="image/svg+xml", extension="svg")
|
||||
|
||||
|
||||
def json(content: str, name: str = "JSON") -> Dict[str, Optional[str]]:
|
||||
def json(content: str, name: str = "JSON") -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_JSON, name, "application/json", "json")
|
||||
|
||||
|
||||
def text(content: str, name: str = "Text") -> Dict[str, Optional[str]]:
|
||||
def text(content: str, name: str = "Text") -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_TEXT, name, "text/plain", "txt")
|
||||
|
||||
|
||||
def url(content: str, name: str = "URL") -> Dict[str, Optional[str]]:
|
||||
def url(content: str, name: str = "URL") -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_URL, name)
|
||||
|
||||
|
||||
|
@ -70,9 +69,9 @@ def video(
|
|||
name: str = "Video",
|
||||
mime_type: str = "video/mp4",
|
||||
extension: str = "mp4",
|
||||
) -> Dict[str, Optional[str]]:
|
||||
) -> dict[str, Optional[str]]:
|
||||
return extra(content, FORMAT_VIDEO, name, mime_type, extension)
|
||||
|
||||
|
||||
def mp4(content: str, name: str = "Video") -> Dict[str, Optional[str]]:
|
||||
def mp4(content: str, name: str = "Video") -> dict[str, Optional[str]]:
|
||||
return video(content, name)
|
||||
|
|
|
@ -28,7 +28,7 @@ def read_html(path):
|
|||
|
||||
def assert_results_by_outcome(html, test_outcome, test_outcome_number, label=None):
|
||||
# Asserts if the test number of this outcome in the summary is correct
|
||||
regex_summary = r"(\d)+ {}".format(label or test_outcome)
|
||||
regex_summary = rf"(\d)+ {label or test_outcome}"
|
||||
assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
|
||||
|
||||
# Asserts if the generated checkbox of this outcome is correct
|
||||
|
|
Loading…
Reference in New Issue