From afc675a2c7d453a4d9a7cf9ea331a90239155a08 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 10 May 2023 11:31:26 +0200 Subject: [PATCH] tests/sys: fix E275 missing whitespace after keyword + cleanup a bit --- tests/sys/evtimer_msg/tests/01-run.py | 3 +-- tests/sys/evtimer_underflow/tests/01-run.py | 1 - tests/sys/pthread_barrier/tests/01-run.py | 2 +- tests/sys/puf_sram/tests/puf_sram_if.py | 20 ++++++++++---------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/sys/evtimer_msg/tests/01-run.py b/tests/sys/evtimer_msg/tests/01-run.py index b45bd67d3d..9746ab6207 100755 --- a/tests/sys/evtimer_msg/tests/01-run.py +++ b/tests/sys/evtimer_msg/tests/01-run.py @@ -6,7 +6,6 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. -from __future__ import print_function import sys from testrunner import run @@ -23,7 +22,7 @@ def testfunc(child): # check if output is correct expected = int(child.match.group(2)) actual = int(child.match.group(1)) - assert(actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR + 1)) + assert actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR + 1) print(".", end="", flush=True) print("") print("All tests successful") diff --git a/tests/sys/evtimer_underflow/tests/01-run.py b/tests/sys/evtimer_underflow/tests/01-run.py index a20360e230..7465faa503 100755 --- a/tests/sys/evtimer_underflow/tests/01-run.py +++ b/tests/sys/evtimer_underflow/tests/01-run.py @@ -6,7 +6,6 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. -from __future__ import print_function import sys from testrunner import run diff --git a/tests/sys/pthread_barrier/tests/01-run.py b/tests/sys/pthread_barrier/tests/01-run.py index f7831b1d00..eb671d73cc 100755 --- a/tests/sys/pthread_barrier/tests/01-run.py +++ b/tests/sys/pthread_barrier/tests/01-run.py @@ -19,7 +19,7 @@ def testfunc(child): sleeps.append([sleep, child_num]) for _, child_num in sorted(sleeps): child.expect(r'Done (\d+)\r\n') - assert(child_num == int(child.match.group(1))) + assert child_num == int(child.match.group(1)) child.expect('SUCCESS') diff --git a/tests/sys/puf_sram/tests/puf_sram_if.py b/tests/sys/puf_sram/tests/puf_sram_if.py index ec801adfa8..8fce4635d3 100644 --- a/tests/sys/puf_sram/tests/puf_sram_if.py +++ b/tests/sys/puf_sram/tests/puf_sram_if.py @@ -14,7 +14,7 @@ class PufSram: def __init__(self, port, baud): self.__dev = serial.Serial(port, baud, timeout=10) - if(self.__dev.isOpen() is False): + if self.__dev.isOpen() is False: self.__dev.open() def repower(self, shutdown_time): @@ -26,15 +26,15 @@ class PufSram: data = None start = False str = 'no_exit' - while (str != ''): + while str != '': str = self.__dev.readline() - if (b'Start: ' in str): + if b'Start: ' in str: start = True - if ((b'Success: ' in str) and (start is True)): - if (b'[' in str) and (b']' in str): - data_str = str[str.find(b"[")+1:str.find(b"]")] + if b'Success: ' in str and start is True: + if b'[' in str and b']' in str: + data_str = str[str.find(b"[") + 1:str.find(b"]")] data = int(data_str, 0) - if ((b'End: ' in str) and (data is not None)): + if b'End: ' in str and data is not None: return data return None @@ -43,16 +43,16 @@ class PufSram: for i in range(0, n): self.repower(off_time) data.append(self.read_data()) - if (allow_print): + if allow_print: print('Iteration %i/%i' % (i, n)) print(data[-1]) return data def connect(self, dev): - if (dev.isOpen()): + if dev.isOpen(): dev.close() self.__dev = self - if(self.__dev.isOpen() is False): + if self.__dev.isOpen() is False: self.__dev.open() def disconnect(self):