aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2020-07-13 14:49:31 +1000
committerAnthony Towns <aj@erisian.com.au>2020-11-09 17:53:50 +1000
commit97c738ff1b592270491551cc0a43472d244ffbb0 (patch)
tree29975a939ddadfae70270780fc3fec7d720be162 /test/functional
parent8ae9d314e9af7bcce1e8bc52f0317b9d565109bf (diff)
downloadbitcoin-97c738ff1b592270491551cc0a43472d244ffbb0.tar.xz
[tests] Recommend f-strings for formatting, update feature_block to use them
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/README.md2
-rwxr-xr-xtest/functional/feature_block.py10
2 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/README.md b/test/functional/README.md
index 82b30fed51..2764acbf18 100644
--- a/test/functional/README.md
+++ b/test/functional/README.md
@@ -34,7 +34,7 @@ don't have test cases for.
- When subclassing the BitcoinTestFramework, place overrides for the
`set_test_params()`, `add_options()` and `setup_xxxx()` methods at the top of
the subclass, then locally-defined helper methods, then the `run_test()` method.
-- Use `'{}'.format(x)` for string formatting, not `'%s' % x`.
+- Use `f'{x}'` for string formatting in preference to `'{}'.format(x)` or `'%s' % x`.
#### Naming guidelines
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py
index 3cf7f3890c..158efb52c9 100755
--- a/test/functional/feature_block.py
+++ b/test/functional/feature_block.py
@@ -119,7 +119,7 @@ class FullBlockTest(BitcoinTestFramework):
# Allow the block to mature
blocks = []
for i in range(NUM_BUFFER_BLOCKS_TO_GENERATE):
- blocks.append(self.next_block("maturitybuffer.{}".format(i)))
+ blocks.append(self.next_block(f"maturitybuffer.{i}"))
self.save_spendable_output()
self.send_blocks(blocks)
@@ -151,8 +151,8 @@ class FullBlockTest(BitcoinTestFramework):
if template.valid_in_block:
continue
- self.log.info("Reject block with invalid tx: %s", TxTemplate.__name__)
- blockname = "for_invalid.%s" % TxTemplate.__name__
+ self.log.info(f"Reject block with invalid tx: {TxTemplate.__name__}")
+ blockname = f"for_invalid.{TxTemplate.__name__}"
badblock = self.next_block(blockname)
badtx = template.get_tx()
if TxTemplate != invalid_txs.InputMissing:
@@ -1355,12 +1355,12 @@ class FullBlockTest(BitcoinTestFramework):
# save the current tip so it can be spent by a later block
def save_spendable_output(self):
- self.log.debug("saving spendable output %s" % self.tip.vtx[0])
+ self.log.debug(f"saving spendable output {self.tip.vtx[0]}")
self.spendable_outputs.append(self.tip)
# get an output that we previously marked as spendable
def get_spendable_output(self):
- self.log.debug("getting spendable output %s" % self.spendable_outputs[0].vtx[0])
+ self.log.debug(f"getting spendable output {self.spendable_outputs[0].vtx[0]}")
return self.spendable_outputs.pop(0).vtx[0]
# move the tip back to a previous block