aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-11-28 00:32:17 +0100
committerPatrick Lehmann <Patrick.Lehmann@plc2.de>2022-11-30 23:32:47 +0100
commit51f0ead16d60c63d1b069f807e3513bba11d8947 (patch)
tree50094f57aeb7f9562341908864624199f4d7bc4a /testsuite
parent473ed87bb505916e74441f01508c109bf39b30a7 (diff)
downloadghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.tar.gz
ghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.tar.bz2
ghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.zip
Converted string formatting to f-strings.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/pyunit/libghdl/Comments.py4
-rw-r--r--testsuite/pyunit/libghdl/VHDL.py0
-rw-r--r--testsuite/pyunit/lsp/LanguageServer.py28
3 files changed, 16 insertions, 16 deletions
diff --git a/testsuite/pyunit/libghdl/Comments.py b/testsuite/pyunit/libghdl/Comments.py
index 850d6137a..69571d966 100644
--- a/testsuite/pyunit/libghdl/Comments.py
+++ b/testsuite/pyunit/libghdl/Comments.py
@@ -41,7 +41,7 @@ class Instantiate(TestCase):
while idx != file_comments.No_Comment_Index:
s = file_comments.Get_Comment(f, idx)
self.assertTrue(s.find(':'+name+':') >= 0,
- "no :{}: in '{}'".format(name, s))
+ f"no :{name}: in '{s}'")
idx = file_comments.Get_Next_Comment(f, idx)
def checkFlist(self, flist) -> None:
@@ -83,7 +83,7 @@ class Instantiate(TestCase):
file_id = name_table.Get_Identifier(str(filename))
sfe = files_map.Read_Source_File(name_table.Null_Identifier, file_id)
if sfe == files_map.No_Source_File_Entry:
- self.fail("Cannot read file '{!s}'".format(filename))
+ self.fail(f"Cannot read file '{filename!s}'")
# Parse
file = sem_lib.Load_File(sfe)
diff --git a/testsuite/pyunit/libghdl/VHDL.py b/testsuite/pyunit/libghdl/VHDL.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/testsuite/pyunit/libghdl/VHDL.py
diff --git a/testsuite/pyunit/lsp/LanguageServer.py b/testsuite/pyunit/lsp/LanguageServer.py
index 79c891868..a757d653f 100644
--- a/testsuite/pyunit/lsp/LanguageServer.py
+++ b/testsuite/pyunit/lsp/LanguageServer.py
@@ -30,29 +30,29 @@ def show_diffs(name, ref, res):
if isinstance(ref, dict) and isinstance(res, dict):
for k in ref:
if k not in res:
- print("{}.{} not in the result".format(name, k))
+ print(f"{name}.{k} not in the result")
else:
- show_diffs("{}.{}".format(name, k), ref[k], res[k])
+ show_diffs(f"{name}.{k}", ref[k], res[k])
for k in res:
if k not in ref:
- print("{}.{} unexpected in the result".format(name, k))
+ print(f"{name}.{k} unexpected in the result")
elif isinstance(ref, str) and isinstance(res, str):
if res != ref:
- print("{}: mismatch (ref: {}, result: {})".format(name, ref, res))
+ print(f"{name}: mismatch (ref: {ref}, result: {res})")
elif isinstance(ref, int) and isinstance(res, int):
if res != ref:
- print("{}: mismatch (ref: {}, result: {})".format(name, ref, res))
+ print(f"{name}: mismatch (ref: {ref}, result: {res})")
elif isinstance(ref, list) and isinstance(res, list):
for i in range(max(len(ref), len(res))):
if i >= len(res):
- print("{}[{}]: missing element:".format(name, i))
- print(" {}".format(res[i]))
+ print(f"{name}[{i}]: missing element:")
+ print(f" {res[i]}")
elif i >= len(ref):
- print("{}[{}]: extra elements".format(name, i))
+ print(f"{name}[{i}]: extra elements")
else:
- show_diffs("{}[{}]".format(name, i), ref[i], res[i])
+ show_diffs(f"{name}[{i}]", ref[i], res[i])
else:
- print("unhandle type {} in {}".format(type(ref), name))
+ print(f"unhandle type {type(ref)} in {name}")
def root_subst(obj, path, uri):
@@ -81,7 +81,7 @@ def root_subst(obj, path, uri):
res.append(root_subst(v, path, uri))
return res
else:
- raise AssertionError("root_subst: unhandled type {}".format(type(obj)))
+ raise AssertionError(f"root_subst: unhandled type {type(obj)}")
class JSONTest(TestCase):
@@ -140,17 +140,17 @@ class JSONTest(TestCase):
rep = json_loads(rep)
json_res.append(rep)
- # self.assertEqual(rep, r, "reply does not match for {!s}".format(requestFile))
+ # self.assertEqual(rep, r, f"reply does not match for {requestFile!s}")
if rep != r:
print(self.__class__.__name__)
- show_diffs("[{}]".format(i), r, rep)
+ show_diffs(f"[{i}]", r, rep)
errs += 1
rep = ls.read_request()
self.assertIsNone(rep, "Too many replies.")
if errs != 0:
- print("FAILURE between output and {!s} (for {!s})".format(responseFile, requestFile))
+ print(f"FAILURE between output and {responseFile!s} (for {requestFile!s})")
print("Writing result output to result.json")
with open("result.json", "w") as f:
f.write(json_dumps(json_res, indent=2))