From 906cd45d3245ba0e9c4490ed2b69612891185c7c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 27 Aug 2025 09:17:50 -0500 Subject: [PATCH] testwwvb: better(?) alternative avoids typing.cast & pyrefly: ignore --- test/testwwvb.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/testwwvb.py b/test/testwwvb.py index e171bff..f66c67c 100755 --- a/test/testwwvb.py +++ b/test/testwwvb.py @@ -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: