From dcbc93a117b0efaa0e42fa6359eed4a71a9ca341 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 10 Jun 2022 02:04:30 +0300 Subject: tests: Convert to formatted string literals Use formatted string literals to replace legacy printf-style string formatting. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- tests/kms-test-crc.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'tests/kms-test-crc.py') diff --git a/tests/kms-test-crc.py b/tests/kms-test-crc.py index 5b8a679..efb3cf0 100755 --- a/tests/kms-test-crc.py +++ b/tests/kms-test-crc.py @@ -121,7 +121,7 @@ class CRCTest(kmstest.KMSTest): connectors[crtc] = connector for crtc in self.card.crtcs: - self.start('CRC calculation on CRTC %u' % crtc.id) + self.start(f'CRC calculation on CRTC {crtc.id}') # Get the connector and default mode try: @@ -141,8 +141,8 @@ class CRCTest(kmstest.KMSTest): self.skip('no plane available for CRTC') continue - self.logger.log('Testing connector %s, CRTC %u, mode %s with %u planes' % \ - (connector.fullname, crtc.id, mode.name, len(planes))) + self.logger.log(f'Testing connector {connector.fullname}, CRTC {crtc.id}, ' + f'mode {mode.name} with {len(planes)} planes') # Create a frame buffer and draw a test pattern. fb = pykms.DumbFramebuffer(self.card, mode.hdisplay, mode.vdisplay, 'XR24') @@ -154,7 +154,7 @@ class CRCTest(kmstest.KMSTest): # Set the mode and add all planes ret = self.atomic_crtc_mode_set(crtc, connector, mode, sync=True) if ret < 0: - self.fail('atomic mode set failed with %d' % ret) + self.fail(f'atomic mode set failed with {ret}') continue req = kmstest.AtomicRequest(self) @@ -177,7 +177,7 @@ class CRCTest(kmstest.KMSTest): ret = req.commit(0) if ret < 0: - self.fail('atomic plane set failed with %d' % ret) + self.fail(f'atomic plane set failed with {ret}') continue # Wait for one second and make sure the page flip has completed. @@ -191,9 +191,9 @@ class CRCTest(kmstest.KMSTest): if source == crtc: crc_source = 'auto' else: - crc_source = 'plane%u' % source.id + crc_source = f'plane{source.id}' - self.logger.log('Computing CRC from source %s' % crc_source) + self.logger.log(f'Computing CRC from source {crc_source}') # Set the CRC source and acquire 10 CRC values. Discard the # first value, as the device is running and the new source @@ -204,7 +204,7 @@ class CRCTest(kmstest.KMSTest): crc_reader.stop() crcs = [c.crcs[0] for c in crcs[1:]] - self.logger.log('CRC value[0] 0x%08x' % crcs[0]) + self.logger.log(f'CRC value[0] 0x{crcs[0]:08x}') failures = 0 ref_crc = composer.crc(source) @@ -212,12 +212,11 @@ class CRCTest(kmstest.KMSTest): for i in range(len(crcs)): crc = crcs[i] if crc != ref_crc: - self.logger.log('CRC value[%u] 0x%08x does not match reference 0x%08x' - % (i, crc, ref_crc)) + self.logger.log(f'CRC value[{i}] 0x{crc:08x} does not match reference 0x{ref_crc:08x}') failures += 1 if failures: - self.fail('Incorrect CRC values on source %s' % crc_source) + self.fail(f'Incorrect CRC values on source {crc_source}') break else: -- cgit v1.2.3