Skip to content

Commit 6f3d5ad

Browse files
committed
test: use f-strings in feature_asmap.py
1 parent b5c468c commit 6f3d5ad

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/functional/feature_asmap.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
VERSION = 'fec61fa21a9f46f3b17bdcd660d7f4cd90b966aad3aec593c99b35f0aca15853'
3232

3333
def expected_messages(filename):
34-
return ['Opened asmap file "{}" (59 bytes) from disk'.format(filename),
35-
'Using asmap version {} for IP bucketing'.format(VERSION)]
34+
return [f'Opened asmap file "{filename}" (59 bytes) from disk',
35+
f'Using asmap version {VERSION} for IP bucketing']
3636

3737
class AsmapTest(BitcoinTestFramework):
3838
def set_test_params(self):
@@ -50,7 +50,7 @@ def test_asmap_with_absolute_path(self):
5050
filename = os.path.join(self.datadir, 'my-map-file.map')
5151
shutil.copyfile(self.asmap_raw, filename)
5252
with self.node.assert_debug_log(expected_messages(filename)):
53-
self.start_node(0, ['-asmap={}'.format(filename)])
53+
self.start_node(0, [f'-asmap={filename}'])
5454
os.remove(filename)
5555

5656
def test_asmap_with_relative_path(self):
@@ -60,13 +60,13 @@ def test_asmap_with_relative_path(self):
6060
filename = os.path.join(self.datadir, name)
6161
shutil.copyfile(self.asmap_raw, filename)
6262
with self.node.assert_debug_log(expected_messages(filename)):
63-
self.start_node(0, ['-asmap={}'.format(name)])
63+
self.start_node(0, [f'-asmap={name}'])
6464
os.remove(filename)
6565

6666
def test_default_asmap(self):
6767
shutil.copyfile(self.asmap_raw, self.default_asmap)
6868
for arg in ['-asmap', '-asmap=']:
69-
self.log.info('Test bitcoind {} (using default map file)'.format(arg))
69+
self.log.info(f'Test bitcoind {arg} (using default map file)')
7070
self.stop_node(0)
7171
with self.node.assert_debug_log(expected_messages(self.default_asmap)):
7272
self.start_node(0, [arg])
@@ -75,15 +75,15 @@ def test_default_asmap(self):
7575
def test_default_asmap_with_missing_file(self):
7676
self.log.info('Test bitcoind -asmap with missing default map file')
7777
self.stop_node(0)
78-
msg = "Error: Could not find asmap file \"{}\"".format(self.default_asmap)
78+
msg = f"Error: Could not find asmap file \"{self.default_asmap}\""
7979
self.node.assert_start_raises_init_error(extra_args=['-asmap'], expected_msg=msg)
8080

8181
def test_empty_asmap(self):
8282
self.log.info('Test bitcoind -asmap with empty map file')
8383
self.stop_node(0)
8484
with open(self.default_asmap, "w", encoding="utf-8") as f:
8585
f.write("")
86-
msg = "Error: Could not parse asmap file \"{}\"".format(self.default_asmap)
86+
msg = f"Error: Could not parse asmap file \"{self.default_asmap}\""
8787
self.node.assert_start_raises_init_error(extra_args=['-asmap'], expected_msg=msg)
8888
os.remove(self.default_asmap)
8989

0 commit comments

Comments
 (0)