diff mbox series

[14/14] treewide: don't use "+" operator for concatenating strings

Message ID 20230313094431.507952-15-tzungbi@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series cros-ec-tests: fix some exceptions and clean-ups | expand

Commit Message

Tzung-Bi Shih March 13, 2023, 9:44 a.m. UTC
Don't use "+" operator for concatenating strings.  Use f-string instead.

Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 cros/helpers/mcu.py         | 4 ++--
 cros/tests/cros_ec_accel.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/cros/helpers/mcu.py b/cros/helpers/mcu.py
index e2d2db0ef1ed..d756f25a9c6e 100644
--- a/cros/helpers/mcu.py
+++ b/cros/helpers/mcu.py
@@ -134,7 +134,7 @@  def check_mcu_abi(s, name):
     """
     dev = os.path.join("/dev", name)
     if not os.path.exists(dev):
-        s.skipTest("MCU " + name + " not supported, skipping")
+        s.skipTest(f"MCU {name} not supported, skipping")
     files = ["flashinfo", "reboot", "version"]
     sysfs_check_attributes_exists(
         s, "/sys/class/chromeos/", name, files, False
@@ -145,7 +145,7 @@  def mcu_hello(s, name):
     """ Checks basic comunication with MCU. """
     dev = os.path.join("/dev", name)
     if not os.path.exists(dev):
-        s.skipTest("MCU " + name + " not present, skipping")
+        s.skipTest(f"MCU {name} not present, skipping")
     param = ec_params_hello()
     param.in_data = 0xA0B0C0D0  # magic number that the EC expects on HELLO
 
diff --git a/cros/tests/cros_ec_accel.py b/cros/tests/cros_ec_accel.py
index 15a92b7dd35d..22d7affe3632 100755
--- a/cros/tests/cros_ec_accel.py
+++ b/cros/tests/cros_ec_accel.py
@@ -66,7 +66,7 @@  class TestCrosECAccel(unittest.TestCase):
                     err = exp * ACCEL_MAG_VALID_OFFSET
                     mag = 0
                     for axis in ["x", "y", "z"]:
-                        axis_path = os.path.join(base_path, "in_accel_" + axis + "_raw")
+                        axis_path = os.path.join(base_path, f"in_accel_{axis}_raw")
                         value = int(read_file(axis_path))
                         value *= accel_scale
                         mag += value * value