From e8b61c35bbf60331e581c661065503f8a33c945f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20M=C3=BCller?= Date: Thu, 27 Feb 2025 20:39:46 +0100 Subject: [PATCH] chore: needed fixes due to newly integrated PRs (#809) --- docs/conf.py | 21 +++-- src/NanoVNASaver/Charts/TDR.py | 101 +++++++++++++++------ src/NanoVNASaver/Hardware/Hardware.py | 1 + src/NanoVNASaver/Hardware/NanoVNA_F_V2.py | 19 ++-- src/NanoVNASaver/Hardware/NanoVNA_H4.py | 8 -- src/NanoVNASaver/Hardware/TinySA.py | 1 - src/NanoVNASaver/Hardware/VNA.py | 2 +- src/NanoVNASaver/Windows/DeviceSettings.py | 19 ++-- src/NanoVNASaver/Windows/Screenshot.py | 16 ++-- src/NanoVNASaver/Windows/TDR.py | 14 ++- tests/Hardware/test_litevna_64.py | 7 +- tests/conftest.py | 10 +- tests/test_analytics.py | 1 - tests/test_formatSweepFrequency.py | 1 - tests/test_formatting.py | 1 - tests/test_parseFrequency.py | 1 - tests/test_rftools.py | 2 - tests/test_settings.py | 1 - tests/test_sitools.py | 2 - tests/test_sweep.py | 1 - tests/test_touchstone.py | 1 - tests/test_truncate.py | 1 - tests/utils/test_app_versions.py | 3 +- tests/utils/test_version.py | 2 - 24 files changed, 137 insertions(+), 99 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 60b4c92e..24e8019f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,7 +43,9 @@ try: import sphinx - cmd_line = f"sphinx-apidoc --implicit-namespaces -f -o {output_dir} {module_dir}" + cmd_line = ( + f"sphinx-apidoc --implicit-namespaces -f -o {output_dir} {module_dir}" + ) args = cmd_line.split(" ") if tuple(sphinx.__version__.split(".")) >= ("1", "7"): @@ -105,7 +107,9 @@ version = "" if not version or version.lower() == "unknown": - version = os.getenv("READTHEDOCS_VERSION", "unknown") # automatically set by RTD + version = os.getenv( + "READTHEDOCS_VERSION", "unknown" + ) # automatically set by RTD release = version @@ -159,10 +163,7 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = { - "sidebar_width": "300px", - "page_width": "1200px" -} +html_theme_options = {"sidebar_width": "300px", "page_width": "1200px"} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] @@ -247,7 +248,13 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ("index", "user_guide.tex", "nanovna-saver Documentation", "Holger Mueller", "manual") + ( + "index", + "user_guide.tex", + "nanovna-saver Documentation", + "Holger Mueller", + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of diff --git a/src/NanoVNASaver/Charts/TDR.py b/src/NanoVNASaver/Charts/TDR.py index 9c6527db..e66b9989 100644 --- a/src/NanoVNASaver/Charts/TDR.py +++ b/src/NanoVNASaver/Charts/TDR.py @@ -20,10 +20,12 @@ import math import numpy as np -from PySide6.QtCore import QPoint, Qt, QRect +from PySide6.QtCore import QPoint, QRect, Qt from PySide6.QtGui import ( QAction, QActionGroup, + QColor, + QFontMetrics, QMouseEvent, QPainter, QPaintEvent, @@ -32,8 +34,6 @@ QResizeEvent, QShortcut, QWheelEvent, - QColor, - QFontMetrics, ) from PySide6.QtWidgets import QDialog, QInputDialog, QMenu, QSizePolicy @@ -394,19 +394,29 @@ def mouseMoveEvent(self, a0: QMouseEvent) -> None: self.update() def _draw_ticks( - self, height, width, x_step, min_index, qp: QPainter + self, height, _width, x_step, min_index, qp: QPainter ) -> None: - desired_steps = math.ceil((self.width() - self.leftMargin - self.rightMargin) / 100) + desired_steps = math.ceil( + (self.width() - self.leftMargin - self.rightMargin) / 100 + ) min_length, max_length, m_per_pixel = self._get_chart_parameters() delta_length = max_length - min_length step_length = delta_length / desired_steps decimals = math.ceil(abs(math.log10(step_length))) - step_length_rounded = math.ceil(step_length * (10 ** decimals)) / (10 ** decimals) + step_length_rounded = math.ceil(step_length * (10**decimals)) / ( + 10**decimals + ) - start_length = min_length - (min_length % step_length_rounded) + step_length_rounded + start_length = ( + min_length + - (min_length % step_length_rounded) + + step_length_rounded + ) - for distance in np.arange(start_length, max_length, step_length_rounded): + for distance in np.arange( + start_length, max_length, step_length_rounded + ): x = self.leftMargin + round((distance - min_length) / m_per_pixel) # lines @@ -415,14 +425,22 @@ def _draw_ticks( # text qp.setPen(QPen(Chart.color.text)) - self._draw_centered_hanging_text(qp, f"{{:.{decimals}f}} m".format(distance), - QPoint(x, self.topMargin + height), False) + self._draw_centered_hanging_text( + qp, + f"{{:.{decimals}f}} m".format(distance), + QPoint(x, self.topMargin + height), + False, + ) # text at origin qp.setPen(QPen(Chart.color.text)) distance = self.tdrWindow.distance_axis[min_index] / 2 - self._draw_centered_hanging_text(qp, f"{{:.{decimals}f}} m".format(distance), - QPoint(self.leftMargin, self.topMargin + height), False) + self._draw_centered_hanging_text( + qp, + f"{{:.{decimals}f}} m".format(distance), + QPoint(self.leftMargin, self.topMargin + height), + False, + ) def _draw_y_ticks( self, height, width, min_impedance, max_impedance, qp: QPainter @@ -461,17 +479,20 @@ def _draw_max_point( self._draw_centered_hanging_text( qp, f"{round(self.tdrWindow.distance_axis[id_max] / 2, 2)}m", - max_point, - True) + max_point, + True, + ) def _draw_marker(self, height, x_step, y_step, min_index, qp: QPainter): marker_point = QPoint( self.positionAtLength(self.marker_location, limit=False), - (self.topMargin + height) + (self.topMargin + height), ) qp.setPen(Chart.color.text) qp.drawEllipse(marker_point, 2, 2) - self._draw_centered_hanging_text(qp, f"{self.marker_location:.3f} m", marker_point, True) + self._draw_centered_hanging_text( + qp, f"{self.marker_location:.3f} m", marker_point, True + ) def _draw_graph(self, height, width, qp: QPainter) -> None: min_index = 0 @@ -513,13 +534,21 @@ def _draw_graph(self, height, width, qp: QPainter) -> None: tdr_points = [ QPoint( self.leftMargin + int((i - min_index) / x_step), - (self.topMargin + height) - int(np.real(self.tdrWindow.td[i]) / y_step) - ) for i in range(min_index, max_index)] + (self.topMargin + height) + - int(np.real(self.tdrWindow.td[i]) / y_step), + ) + for i in range(min_index, max_index) + ] step_response_points = [ QPoint( self.leftMargin + int((i - min_index) / x_step), - (self.topMargin + height) - int((self.tdrWindow.step_response_Z[i] - min_impedance) / y_step) - ) for i in range(min_index, max_index)] + (self.topMargin + height) + - int( + (self.tdrWindow.step_response_Z[i] - min_impedance) / y_step + ), + ) + for i in range(min_index, max_index) + ] pen.setColor(Chart.color.sweep) qp.setPen(pen) @@ -542,7 +571,11 @@ def _draw_graph(self, height, width, qp: QPainter) -> None: [qp.drawPoint(p) for p in tdr_points if self.isPlotable(p)] pen.setColor(Chart.color.sweep_secondary) qp.setPen(pen) - [qp.drawPoint(p) for p in step_response_points if self.isPlotable(p)] + [ + qp.drawPoint(p) + for p in step_response_points + if self.isPlotable(p) + ] self._draw_max_point(height, x_step, y_step, min_index, qp) @@ -622,18 +655,20 @@ def _get_chart_parameters(self): ) ) x_step = float(max_length - min_length) / width_px - # logger.debug(f"min_length: {min_length}, max_length: {max_length}, x_step: {x_step}") return min_length, max_length, x_step def lengthAtPosition(self, x: int, limit=True): if not hasattr(self.tdrWindow, "td"): return 0 + width_px = self.width() - self.leftMargin - self.rightMargin min_length, max_length, x_step = self._get_chart_parameters() absx = x - self.leftMargin if limit and absx < 0: return float(min_length) return float( - max_length if limit and absx > width else absx * x_step + min_length + max_length + if limit and absx > width_px + else absx * x_step + min_length ) def positionAtLength(self, length, limit=True): @@ -667,8 +702,12 @@ def zoomTo(self, x1, y1, x2, y2) -> None: x_max = x_max + (at_zero - x_min) x_min = at_zero - if self.lengthAtPosition(x_max, limit=False) > (self.tdrWindow.distance_axis[-1] / 2): - at_end = self.positionAtLength(self.tdrWindow.distance_axis[-1] / 2, limit=False) + if self.lengthAtPosition(x_max, limit=False) > ( + self.tdrWindow.distance_axis[-1] / 2 + ): + at_end = self.positionAtLength( + self.tdrWindow.distance_axis[-1] / 2, limit=False + ) x_min = x_min + (at_end - x_max) x_max = at_end @@ -687,7 +726,9 @@ def resizeEvent(self, a0: QResizeEvent) -> None: self.dim.width = self.width() - self.leftMargin - self.rightMargin self.dim.height = self.height() - self.bottomMargin - self.topMargin - def _draw_centered_hanging_text(self, qp, text, center: QPoint, above: bool): + def _draw_centered_hanging_text( + self, qp, text, center: QPoint, above: bool + ): # Measure text size fm = QFontMetrics(qp.font()) text_width = fm.horizontalAdvance(text) @@ -695,11 +736,13 @@ def _draw_centered_hanging_text(self, qp, text, center: QPoint, above: bool): # Compute top-left position for centered text x = center.x() - text_width // 2 - y = center.y() + (- text_height / 4 if above else text_height) + y = round(center.y() + (-text_height / 4 if above else text_height)) # enhance readability when drawn over ticks margin = 5 - rect = QRect(x - margin, y - text_height, text_width + 2 * margin, text_height) + rect = QRect( + x - margin, y - text_height, text_width + 2 * margin, text_height + ) semi_transparent_bg = QColor(Chart.color.background) semi_transparent_bg.setAlpha(150) qp.fillRect(rect, semi_transparent_bg) @@ -713,4 +756,4 @@ def get_fft_points(self): separate points a lower (but still very high resolution) makes the GUI more responsive. """ - return 2 ** 12 if self.flag.draw_lines else 2 ** 14 + return 2**12 if self.flag.draw_lines else 2**14 diff --git a/src/NanoVNASaver/Hardware/Hardware.py b/src/NanoVNASaver/Hardware/Hardware.py index 360e3588..32d85094 100644 --- a/src/NanoVNASaver/Hardware/Hardware.py +++ b/src/NanoVNASaver/Hardware/Hardware.py @@ -144,6 +144,7 @@ def get_VNA(iface: Interface) -> VNA: # serial_port.timeout = TIMEOUT return NAME2DEVICE[iface.comment](iface) + def get_comment(iface: Interface) -> str: logger.info("Finding correct VNA type...") with iface.lock: diff --git a/src/NanoVNASaver/Hardware/NanoVNA_F_V2.py b/src/NanoVNASaver/Hardware/NanoVNA_F_V2.py index 38977426..62465887 100644 --- a/src/NanoVNASaver/Hardware/NanoVNA_F_V2.py +++ b/src/NanoVNASaver/Hardware/NanoVNA_F_V2.py @@ -21,6 +21,7 @@ import serial from PySide6.QtGui import QPixmap +from ..utils import Version from .Convert import get_rgb16_pixmap from .NanoVNA import NanoVNA from .Serial import Interface @@ -32,19 +33,19 @@ class NanoVNA_F_V2(NanoVNA): name = "NanoVNA-F_V2" screenwidth = 800 screenheight = 480 - valid_datapoints = (101, 11, 51, 201, 301) + valid_datapoints: tuple[int, ...] = (101, 11, 51, 201, 301) sweep_points_min = 11 sweep_points_max = 301 - + def __init__(self, iface: Interface): super().__init__(iface) self.sweep_max_freq_hz = 3e9 self.version = self.read_firmware_version() # max datapoints reach up to 301 since version 0.5.0 - if self.version >= Version("0.5.0"): + if self.version >= Version.parse("0.5.0"): pass # max datapoints reach up to 201 since version 0.2.0 - elif self.version >= Version("0.2.0"): + elif self.version >= Version.parse("0.2.0"): self.valid_datapoints = (101, 11, 51, 201) self.sweep_points_max = 201 # max datapoints reach up to 101 before version 0.2.0 @@ -66,15 +67,15 @@ def getScreenshot(self) -> QPixmap: return QPixmap() def read_firmware_version(self) -> "Version": - """For example, command version in NanoVNA_F_V2 and NanoVNA_F_V3 returns as this - 0.5.8 + """For example, command version in NanoVNA_F_V2 and NanoVNA_F_V3 + returns as this 0.5.8 """ result = list(self.exec_command("version")) logger.debug("firmware version result:\n%s", result[0]) - return Version(result[0]) + return Version.parse(result[0]) - def read_features(self): - super().read_features() + def get_features(self): + super().get_features() result = " ".join(self.exec_command("help")).split() if "sn:" or "SN:" in result: self.features.add("SN") diff --git a/src/NanoVNASaver/Hardware/NanoVNA_H4.py b/src/NanoVNASaver/Hardware/NanoVNA_H4.py index bdede4b4..e09c8e8c 100644 --- a/src/NanoVNASaver/Hardware/NanoVNA_H4.py +++ b/src/NanoVNASaver/Hardware/NanoVNA_H4.py @@ -41,11 +41,3 @@ def __init__(self, iface: Interface): self.sweep_method = "scan" if "Scan mask command" in self.features: self.sweep_method = "scan_mask" - - # def init_features(self) -> None: - # logger.debug("read_features") - # super().read_features() - # if self.readFirmware().find("DiSlord") > 0: - # self.features.add("Customizable data points") - # logger.info("VNA has 201 datapoints capability") - # self.valid_datapoints: tuple[int, ...] = [201, 11, 51, 101] diff --git a/src/NanoVNASaver/Hardware/TinySA.py b/src/NanoVNASaver/Hardware/TinySA.py index d3231317..0c9dd024 100644 --- a/src/NanoVNASaver/Hardware/TinySA.py +++ b/src/NanoVNASaver/Hardware/TinySA.py @@ -115,7 +115,6 @@ class TinySA_Ultra(TinySA): screenwidth = 480 screenheight = 320 valid_datapoints: tuple[int, ...] = (450, 51, 101, 145, 290) - hardware_revision: Version | None = None def __init__(self, iface: Interface): super().__init__(iface) diff --git a/src/NanoVNASaver/Hardware/VNA.py b/src/NanoVNASaver/Hardware/VNA.py index c0f70a99..84885fd6 100644 --- a/src/NanoVNASaver/Hardware/VNA.py +++ b/src/NanoVNASaver/Hardware/VNA.py @@ -56,7 +56,7 @@ class VNA: valid_datapoints: tuple[int, ...] = (101, 51, 11) wait = 0.05 SN = "NOT SUPPORTED" - hardware_revision = "NOT SUPPORTED" + hardware_revision: str | Version = "NOT SUPPORTED" sweep_points_max = 101 sweep_points_min = 11 diff --git a/src/NanoVNASaver/Windows/DeviceSettings.py b/src/NanoVNASaver/Windows/DeviceSettings.py index b9cca0c3..848ae5d1 100644 --- a/src/NanoVNASaver/Windows/DeviceSettings.py +++ b/src/NanoVNASaver/Windows/DeviceSettings.py @@ -23,7 +23,7 @@ from PySide6.QtGui import QIntValidator from .Defaults import make_scrollable -from .Screenshot import ScreenshotWindow, LiveViewWindow +from .Screenshot import LiveViewWindow, ScreenshotWindow from .ui import get_window_icon if TYPE_CHECKING: @@ -96,13 +96,15 @@ def __init__(self, app: "vna_app") -> None: self.btnCaptureScreenshot = QtWidgets.QPushButton("Screenshot") self.btnCaptureScreenshot.clicked.connect(self.captureScreenshot) control_layout.addWidget(self.btnCaptureScreenshot) - + self.liveViewWindow = LiveViewWindow(self) self.btnLiveView = QtWidgets.QPushButton("Live view") self.btnLiveView.clicked.connect(self.liveView) - self.liveViewWindow.setAttribute(QtCore.Qt.WidgetAttribute.WA_DeleteOnClose) + self.liveViewWindow.setAttribute( + QtCore.Qt.WidgetAttribute.WA_DeleteOnClose + ) control_layout.addWidget(self.btnLiveView) - + left_layout.addWidget(status_box) left_layout.addLayout(control_layout) @@ -158,9 +160,7 @@ def updateFields(self): self.label["firmware"].setText( f"{self.app.vna.name} v{self.app.vna.version}" ) - self.label["hardware"].setText( - f"{self.app.vna.hardware_revision}" - ) + self.label["hardware"].setText(f"{self.app.vna.hardware_revision}") if self.app.worker.isRunning(): self.label["calibration"].setText("(Sweep running)") else: @@ -212,11 +212,10 @@ def captureScreenshot(self) -> None: # TODO: Consider having a list of widgets that want to be # disabled when a sweep is running? - def liveView(self) -> None: - if self.app.worker.state != SweepState.RUNNING: + if not self.app.worker.isRunning(): self.liveViewWindow.start() - + def updateNrDatapoints(self, i) -> None: if i < 0 or self.app.worker.isRunning(): return diff --git a/src/NanoVNASaver/Windows/Screenshot.py b/src/NanoVNASaver/Windows/Screenshot.py index fea5c701..6b7031d6 100644 --- a/src/NanoVNASaver/Windows/Screenshot.py +++ b/src/NanoVNASaver/Windows/Screenshot.py @@ -120,19 +120,23 @@ def setScale(self, scale): ) self.resize(width, height) + class LiveViewWindow(ScreenshotWindow): def __init__(self, qtwidgets: QtWidgets.QTableWidget): super().__init__() self.setWindowTitle("Live View") self.qtwidgets = qtwidgets - self.timer = QTimer(self) + self.timer = QtCore.QTimer(self) self.timer.timeout.connect(self.update_screenshot) - + def start(self): - self.timer.start(2000) # Update every 2000ms (this will not burn the little chip too much on nanovna & tinysa) - + self.timer.start( + 2000 + ) # Update every 2000ms (this will not burn the little chip too + # much on nanovna & tinysa) + def update_screenshot(self): - if self.qtwidgets.app.worker.state != SweepState.RUNNING: # Check if worker is not running + if not self.qtwidgets.app.worker.isRunning(): pixmap = self.qtwidgets.app.vna.getScreenshot() self.qtwidgets.liveViewWindow.setScreenshot(pixmap) - self.qtwidgets.liveViewWindow.show() \ No newline at end of file + self.qtwidgets.liveViewWindow.show() diff --git a/src/NanoVNASaver/Windows/TDR.py b/src/NanoVNASaver/Windows/TDR.py index d4e7b2ac..54a6e2de 100644 --- a/src/NanoVNASaver/Windows/TDR.py +++ b/src/NanoVNASaver/Windows/TDR.py @@ -262,7 +262,11 @@ def updateTDR(self): if "lowpass" in TDR_format: td = self._tdr_lowpass(TDR_format, s11, TDR_window) else: - td = np.abs(np.fft.ifft(self.windowed_s11, self.app.tdr_chart.get_fft_points())) + td = np.abs( + np.fft.ifft( + self.windowed_s11, self.app.tdr_chart.get_fft_points() + ) + ) # Convolving with a step function is unnecessary, we can only get # the magnitude of impulse response if TDR_format == "Refl (bandpass)": @@ -272,7 +276,9 @@ def updateTDR(self): / TDR_window["corr"](len(s11), TDR_window["arg"]) ) - time_axis = np.linspace(0, 1 / step_size, self.app.tdr_chart.get_fft_points()) + time_axis = np.linspace( + 0, 1 / step_size, self.app.tdr_chart.get_fft_points() + ) self.distance_axis = time_axis * v * speed_of_light # peak = np.max(td) # We should check that this is an actual *peak*, and not just @@ -289,7 +295,9 @@ def updateTDR(self): self.updated.emit() def _tdr_lowpass(self, tdr_format, s11, tdr_window) -> np.ndarray: - pad_points = (self.app.tdr_chart.get_fft_points() - len(self.windowed_s11)) // 2 + pad_points = ( + self.app.tdr_chart.get_fft_points() - len(self.windowed_s11) + ) // 2 self.windowed_s11 = np.pad( self.windowed_s11, [pad_points + 1, pad_points] ) # Pad array to length self.app.tdr_chart.get_fft_points() diff --git a/tests/Hardware/test_litevna_64.py b/tests/Hardware/test_litevna_64.py index 77d3741c..c647695f 100644 --- a/tests/Hardware/test_litevna_64.py +++ b/tests/Hardware/test_litevna_64.py @@ -4,7 +4,6 @@ class TestScreenshotData: - @staticmethod def test_from_header() -> None: result = ScreenshotData.from_header(VALID_HEADER) @@ -21,9 +20,9 @@ def test_data_size() -> None: @staticmethod def test_repr() -> None: - assert f"{ScreenshotData(0,0,0)}" == "0x0 0bits (0 Bytes)" + assert f"{ScreenshotData(0, 0, 0)}" == "0x0 0bits (0 Bytes)" assert ( - f"{ScreenshotData(480,320,16)}" == "480x320 16bits (307200 Bytes)" + f"{ScreenshotData(480, 320, 16)}" == "480x320 16bits (307200 Bytes)" ) @staticmethod @@ -40,4 +39,4 @@ def test_get_rgb888_data() -> None: result = img.get_rgb888_data() assert len(result) == 3 * 3 - assert result == b"\x00\x00\x00\xFF\xFF\x00\xFF\xFF\xFF" + assert result == b"\x00\x00\x00\xff\xff\x00\xff\xff\xff" diff --git a/tests/conftest.py b/tests/conftest.py index 4b6fac88..79103b2b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,10 +1,10 @@ """ - Dummy conftest.py for NanoVNASaver. +Dummy conftest.py for NanoVNASaver. - If you don't know what this is for, just leave it empty. - Read more about conftest.py under: - - https://docs.pytest.org/en/stable/fixture.html - - https://docs.pytest.org/en/stable/writing_plugins.html +If you don't know what this is for, just leave it empty. +Read more about conftest.py under: +- https://docs.pytest.org/en/stable/fixture.html +- https://docs.pytest.org/en/stable/writing_plugins.html """ # import pytest diff --git a/tests/test_analytics.py b/tests/test_analytics.py index 963cefd5..ac263f1e 100644 --- a/tests/test_analytics.py +++ b/tests/test_analytics.py @@ -28,7 +28,6 @@ class AnalyticsTools(unittest.TestCase): - def test_zero_crossings(self): self.assertEqual( At.zero_crossings(SINEWAVE), [45, 90, 135, 180, 225, 270, 315] diff --git a/tests/test_formatSweepFrequency.py b/tests/test_formatSweepFrequency.py index 9b43d58d..ea68a2ee 100644 --- a/tests/test_formatSweepFrequency.py +++ b/tests/test_formatSweepFrequency.py @@ -25,7 +25,6 @@ class TestCases(unittest.TestCase): - def test_basicIntegerValues(self): # simple well-formed integers with no trailing zeros. Most importantly # there is no loss of accuracy in the result. Returned values are not diff --git a/tests/test_formatting.py b/tests/test_formatting.py index f17f6c6b..651d1897 100644 --- a/tests/test_formatting.py +++ b/tests/test_formatting.py @@ -23,7 +23,6 @@ class TestCases(unittest.TestCase): - def test_format_frequency(self): self.assertEqual(fmt.format_frequency(1), "1.00000Hz") self.assertEqual(fmt.format_frequency(12), "12.0000Hz") diff --git a/tests/test_parseFrequency.py b/tests/test_parseFrequency.py index c56a8367..8b1299f1 100644 --- a/tests/test_parseFrequency.py +++ b/tests/test_parseFrequency.py @@ -31,7 +31,6 @@ # the hardware developer already announced a successor # which will have different limits class TestCases(unittest.TestCase): - def test_basicSIUnits(self): # simple well-formed integers with correct SI units self.assertEqual(parse_frequency("123Hz"), 123) diff --git a/tests/test_rftools.py b/tests/test_rftools.py index 7186fe10..2348d7ae 100644 --- a/tests/test_rftools.py +++ b/tests/test_rftools.py @@ -37,7 +37,6 @@ class TestRFTools(unittest.TestCase): - def test_norm_to_impedance(self): self.assertEqual(norm_to_impedance(50, 0), 0) self.assertEqual(norm_to_impedance(1), 50) @@ -147,7 +146,6 @@ def test_cor_att_data(self): class TestRFToolsDatapoint(unittest.TestCase): - def setUp(self): self.dp = Datapoint(100000, 0.1091, 0.3118) self.dp0 = Datapoint(100000, 0, 0) diff --git a/tests/test_settings.py b/tests/test_settings.py index 452eb883..83dcb298 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -35,7 +35,6 @@ class TConfig: class TestCases(unittest.TestCase): - def setUp(self) -> None: self.settings_1 = AppSettings( "NanoVNASaver", diff --git a/tests/test_sitools.py b/tests/test_sitools.py index b4524156..55b41e19 100644 --- a/tests/test_sitools.py +++ b/tests/test_sitools.py @@ -52,7 +52,6 @@ class TestSIToolsValue(unittest.TestCase): - def test_format_assertions(self): self.assertRaises(AssertionError, Value, fmt=F_ASSERT_DIGITS_0) self.assertRaises(AssertionError, Value, fmt=F_ASSERT_DIGITS_2) @@ -183,7 +182,6 @@ def test_rounding(self): class TestSIToolsFunctions(unittest.TestCase): - def test_log_floor_125(self): self.assertEqual(log_floor_125(1), 1) self.assertEqual(log_floor_125(2), 2) diff --git a/tests/test_sweep.py b/tests/test_sweep.py index 25f76ee7..abc74c48 100644 --- a/tests/test_sweep.py +++ b/tests/test_sweep.py @@ -23,7 +23,6 @@ class TestCases(unittest.TestCase): - def test_sweep(self): sweep = Sweep() self.assertEqual(sweep.start, 3600000) diff --git a/tests/test_touchstone.py b/tests/test_touchstone.py index 766f0622..3d82103c 100644 --- a/tests/test_touchstone.py +++ b/tests/test_touchstone.py @@ -66,7 +66,6 @@ def test_parse(self): class TestTouchstoneTouchstone(unittest.TestCase): - def test_load(self): ts = Touchstone("./tests/data/valid.s1p") ts.load() diff --git a/tests/test_truncate.py b/tests/test_truncate.py index 5097d383..57cf5cae 100644 --- a/tests/test_truncate.py +++ b/tests/test_truncate.py @@ -64,7 +64,6 @@ class TestSweepWorkerTruncate(unittest.TestCase): - def test_truncate(self): x = truncate(DATA, 1) self.assertEqual(x, DATA_TRUNCATED) diff --git a/tests/utils/test_app_versions.py b/tests/utils/test_app_versions.py index 885ca75f..2ab1473a 100644 --- a/tests/utils/test_app_versions.py +++ b/tests/utils/test_app_versions.py @@ -1,5 +1,3 @@ - - from NanoVNASaver.utils import ( get_app_version, get_host_platform, @@ -14,6 +12,7 @@ def test_get_app_version() -> None: assert result assert result != "unknown" + def test_get_lib_versions() -> None: result = get_lib_versions() diff --git a/tests/utils/test_version.py b/tests/utils/test_version.py index 8f4a5659..94e6d64b 100644 --- a/tests/utils/test_version.py +++ b/tests/utils/test_version.py @@ -22,7 +22,6 @@ class TestCases: - @staticmethod def test_str() -> None: assert str(Version(1, 0, 0, "")) == "1.0.0" @@ -59,7 +58,6 @@ def test_parse_invalid_values() -> None: @staticmethod def test_build_normal_case() -> None: - assert Version.build(1, 2) == Version(1, 2, 0, "") assert Version.build(1, 2, 3) == Version(1, 2, 3, "") assert Version.build(1, 2, 3, "test") == Version(1, 2, 3, "test")