Skip to content

Commit cfed622

Browse files
nejchJohnVillalovos
authored andcommitted
style: use f-strings where applicable
1 parent dc32d54 commit cfed622

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

docs/ext/docstrings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ def classref(value, short=True):
1111
return value
1212

1313
if not inspect.isclass(value):
14-
return ":class:%s" % value
14+
return f":class:{value}"
1515
tilde = "~" if short else ""
16-
return ":class:`%sgitlab.objects.%s`" % (tilde, value.__name__)
16+
return f":class:`{tilde}gitlab.objects.{value.__name__}`"
1717

1818

1919
def setup(app):

tests/functional/api/test_projects.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,11 @@ def test_project_file_uploads(project):
106106
file_contents = "testing contents"
107107

108108
uploaded_file = project.upload(filename, file_contents)
109-
assert uploaded_file["alt"] == filename
110-
assert uploaded_file["url"].startswith("/uploads/")
111-
assert uploaded_file["url"].endswith(f"/{filename}")
112-
assert uploaded_file["markdown"] == "[{}]({})".format(
113-
uploaded_file["alt"], uploaded_file["url"]
114-
)
109+
alt, url = uploaded_file["alt"], uploaded_file["url"]
110+
assert alt == filename
111+
assert url.startswith("/uploads/")
112+
assert url.endswith(f"/{filename}")
113+
assert uploaded_file["markdown"] == f"[{alt}]({url})"
115114

116115

117116
def test_project_forks(gl, project, user):

tests/unit/objects/test_packages.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,7 @@
107107
package_version = "v1.0.0"
108108
file_name = "hello.tar.gz"
109109
file_content = "package content"
110-
package_url = "http://localhost/api/v4/projects/1/packages/generic/{}/{}/{}".format(
111-
package_name,
112-
package_version,
113-
file_name,
114-
)
110+
package_url = f"http://localhost/api/v4/projects/1/packages/generic/{package_name}/{package_version}/{file_name}"
115111

116112

117113
@pytest.fixture

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy