testcli: Kill the last Any.

This commit is contained in:
Jeff Epler 2025-08-27 08:38:41 -05:00
parent 399fa8618f
commit 70e0c6fc54
2 changed files with 11 additions and 4 deletions

View file

@ -24,7 +24,7 @@ repos:
rev: v0.12.10 rev: v0.12.10
hooks: hooks:
# Run the linter. # Run the linter.
- id: ruff - id: ruff-check
args: [ --fix ] args: [ --fix ]
# Run the formatter. # Run the formatter.
- id: ruff-format - id: ruff-format

View file

@ -1,4 +1,5 @@
#!/usr/bin/python3 #!/usr/bin/python3
"""Test most wwvblib commandline programs""" """Test most wwvblib commandline programs"""
# ruff: noqa: N802 D102 # ruff: noqa: N802 D102
@ -6,13 +7,13 @@
# #
# SPDX-License-Identifier: GPL-3.0-only # SPDX-License-Identifier: GPL-3.0-only
from __future__ import annotations
import json import json
import os import os
import subprocess import subprocess
import sys import sys
import unittest import unittest
from collections.abc import Sequence
from typing import Any
# These imports must remain, even though the module contents are not used directly! # These imports must remain, even though the module contents are not used directly!
import wwvb.dut1table import wwvb.dut1table
@ -22,6 +23,12 @@ import wwvb.gen
assert wwvb.dut1table.__name__ == "wwvb.dut1table" assert wwvb.dut1table.__name__ == "wwvb.dut1table"
assert wwvb.gen.__name__ == "wwvb.gen" 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): class CLITestCase(unittest.TestCase):
"""Test various CLI commands within wwvbpy""" """Test various CLI commands within wwvbpy"""
@ -55,7 +62,7 @@ class CLITestCase(unittest.TestCase):
def assertStarts(self, expected: str, actual: str, *args: str) -> None: def assertStarts(self, expected: str, actual: str, *args: str) -> None:
self.assertMultiLineEqual(expected, actual[: len(expected)], f"args={args}") 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""" """Check the output from invoking a `python -m modulename` program matches the expected"""
actual = self.moduleOutput(*args) actual = self.moduleOutput(*args)
# Note: in mypy, revealed type of json.loads is typing.Any! # Note: in mypy, revealed type of json.loads is typing.Any!