testwwvb: better(?) alternative

avoids typing.cast & pyrefly: ignore
This commit is contained in:
Jeff Epler 2025-08-27 09:17:50 -05:00
parent bf0b767a74
commit 906cd45d32

View file

@ -14,7 +14,6 @@ import io
import pathlib
import random
import sys
import typing
import unittest
import uwwvb
@ -48,13 +47,12 @@ class WWVBTestCase(unittest.TestCase):
channel: WWVBChannel = "amplitude"
style = "default"
for o in options:
if o.startswith("--channel="):
value = o[10:]
if value in {"both", "amplitude", "phase"}:
# pyrefly: ignore # redundant-cast
channel = typing.cast("WWVBChannel", value)
else:
raise ValueError(f"Unknown channel {o!r}")
if o == "--channel=both":
channel = "both"
elif o == "--channel=amplitude":
channel = "amplitude"
elif o == "--channel=phase":
channel = "phase"
elif o.startswith("--style="):
style = o[8:]
else: