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
hooks:
# Run the linter.
- id: ruff
- id: ruff-check
args: [ --fix ]
# Run the formatter.
- id: ruff-format

View file

@ -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!