From 70e0c6fc54bfd957afb1a9a65333ad594e5f920d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 27 Aug 2025 08:38:41 -0500 Subject: [PATCH] testcli: Kill the last Any. --- .pre-commit-config.yaml | 2 +- test/testcli.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a6a197..5298de0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: rev: v0.12.10 hooks: # Run the linter. - - id: ruff + - id: ruff-check args: [ --fix ] # Run the formatter. - id: ruff-format diff --git a/test/testcli.py b/test/testcli.py index fd4fc66..eb761e7 100644 --- a/test/testcli.py +++ b/test/testcli.py @@ -1,4 +1,5 @@ #!/usr/bin/python3 + """Test most wwvblib commandline programs""" # ruff: noqa: N802 D102 @@ -6,13 +7,13 @@ # # SPDX-License-Identifier: GPL-3.0-only +from __future__ import annotations + import json import os import subprocess import sys import unittest -from collections.abc import Sequence -from typing import Any # These imports must remain, even though the module contents are not used directly! import wwvb.dut1table @@ -22,6 +23,12 @@ import wwvb.gen assert wwvb.dut1table.__name__ == "wwvb.dut1table" assert wwvb.gen.__name__ == "wwvb.gen" +TYPE_CHECKING = False +if TYPE_CHECKING: + from collections.abc import Sequence + + from wwvb import JsonMinute + class CLITestCase(unittest.TestCase): """Test various CLI commands within wwvbpy""" @@ -55,7 +62,7 @@ class CLITestCase(unittest.TestCase): def assertStarts(self, expected: str, actual: str, *args: str) -> None: self.assertMultiLineEqual(expected, actual[: len(expected)], f"args={args}") - def assertModuleJson(self, expected: Any, *args: str) -> None: + def assertModuleJson(self, expected: list[JsonMinute], *args: str) -> None: """Check the output from invoking a `python -m modulename` program matches the expected""" actual = self.moduleOutput(*args) # Note: in mypy, revealed type of json.loads is typing.Any!