aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-11-02 12:50:00 +0100
committerChristian Tismer <tismer@stackless.com>2020-11-02 13:26:38 +0000
commit6e3e7b9ca0548430aaa5e2555d6e02c64625fa3f (patch)
treea821c90747c2376d1396a4bf58330f8b41ccbaad /sources/pyside2/tests
parent4544a943ca2df4e6f0ac24914f0c0f844dc6f748 (diff)
replace **locals by f-strings where possible
This change affects mostly only my own sources which were prepared for the migration to Python 3.6 . Task-number: PYSIDE-904 Change-Id: I0c2cd59f6f625f51f876099c33005ac70ca39db9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r--sources/pyside2/tests/registry/existence_test.py8
-rw-r--r--sources/pyside2/tests/registry/init_platform.py20
2 files changed, 13 insertions, 15 deletions
diff --git a/sources/pyside2/tests/registry/existence_test.py b/sources/pyside2/tests/registry/existence_test.py
index b8a42058d..c8185b140 100644
--- a/sources/pyside2/tests/registry/existence_test.py
+++ b/sources/pyside2/tests/registry/existence_test.py
@@ -115,8 +115,7 @@ except NameError as e:
have_refmodule = False
dict_name = "sig_dict"
if have_refmodule and not hasattr(sig_exists, dict_name):
- print("*** wrong module without '{dict_name}', removed:"
- .format(**locals()), shortpath)
+ print(f"*** wrong module without '{dict_name}', removed: {shortpath}")
os.unlink(effectiveRefPath)
have_refmodule = False
@@ -137,9 +136,8 @@ class TestSignaturesExists(unittest.TestCase):
def multi_signature_msg(key, actual, expect):
len_act = len(actual) if type(actual) is list else 1
len_exp = len(expect) if type(expect) is list else 1
- return ("multi-signature count mismatch for '{key}'. "
- "Actual {len_act} {actual} vs. expected {len_exp} {expect}')"
- .format(**locals()))
+ return (f"multi-signature count mismatch for '{key}'. "
+ f"Actual {len_act} {actual} vs. expected {len_exp} {expect}")
for key, value in sig_exists.sig_dict.items():
name = key.rsplit(".", 1)[-1]
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py
index 86548d7e5..e4b8d9cc3 100644
--- a/sources/pyside2/tests/registry/init_platform.py
+++ b/sources/pyside2/tests/registry/init_platform.py
@@ -170,16 +170,16 @@ class Formatter(object):
@contextmanager
def module(self, mod_name):
- self.print("")
- self.print("# Module", mod_name)
- self.print("sig_dict.update({")
+ self.print(f"")
+ self.print(f"# Module {mod_name}")
+ self.print(f"sig_dict.update({{")
yield
- self.print(' }}) if "{mod_name}" in sys.modules else None'.format(**locals()))
+ self.print(f' }}) if "{mod_name}" in sys.modules else None')
@contextmanager
def klass(self, class_name, class_str):
self.print()
- self.print("# class {self.mod_name}.{class_name}:".format(**locals()))
+ self.print(f"# class {self.mod_name}.{class_name}:")
yield
@contextmanager
@@ -189,15 +189,15 @@ class Formatter(object):
self.last_level = self.level
class_name = self.class_name
if class_name is None:
- key = viskey = "{self.mod_name}.{func_name}".format(**locals())
+ key = viskey = f"{self.mod_name}.{func_name}"
else:
- key = viskey = "{self.mod_name}.{class_name}.{func_name}".format(**locals())
+ key = viskey = f"{self.mod_name}.{class_name}.{func_name}"
if key.endswith("lY"):
# Some classes like PySide2.QtGui.QContextMenuEvent have functions
# globalX and the same with Y. The gerrit robot thinks that this
# is a badly written "globally". Convince it by hiding this word.
viskey = viskey[:-1] + '""Y'
- self.print(' "{viskey}": {signature},'.format(**locals()))
+ self.print(f' "{viskey}": {signature},')
yield key
@@ -223,7 +223,7 @@ def generate_all():
fmt.print("".join(lines[:license_line + 3]))
version = sys.version.replace('\n', ' ')
build = qt_build()
- fmt.print(dedent('''\
+ fmt.print(dedent(f'''\
"""
This file contains the simplified signatures for all functions in PySide
for module '{module}' using
@@ -236,7 +236,7 @@ def generate_all():
identical for Python 2 and 3. '__div__' is also removed,
since it exists in Python 2, only.
"""
- '''.format(**locals())))
+ '''))
fmt.print("import sys")
fmt.print("")
fmt.print("sig_dict = {}")